@@ -426,7 +426,11 @@ std::unique_ptr<api::tabs::Tab> ExtensionTabUtil::CreateTabObject(
426
426
// LOG(INFO) << "[EXTENSIONS] ExtensionTabUtil::CreateTabObject - Step 2" << contents;
427
427
tab_object->id = std::make_unique<int >(GetTabIdForExtensions (contents));
428
428
tab_object->index = tab_index;
429
- tab_object->window_id = GetWindowIdOfTab (contents);
429
+ if (extension && extension->id () == " mooikfkahbdckldjjndioackbalphokd" ) {
430
+ tab_object->window_id = SessionTabHelper::IdForTab (contents).id ();
431
+ } else {
432
+ tab_object->window_id = GetWindowIdOfTab (contents);
433
+ }
430
434
tab_object->status =
431
435
std::make_unique<std::string>(GetTabStatusText (is_loading));
432
436
tab_object->active = false ;
@@ -436,6 +440,8 @@ std::unique_ptr<api::tabs::Tab> ExtensionTabUtil::CreateTabObject(
436
440
tab_strip_android = *(TabModelList::begin ());
437
441
if (tab_strip_android) {
438
442
int openingTab = (tab_strip_android->GetLastNonExtensionActiveIndex ());
443
+ if (extension && extension->id () == " mooikfkahbdckldjjndioackbalphokd" )
444
+ openingTab = (tab_strip_android->GetActiveIndex ());
439
445
if (openingTab == -1 )
440
446
openingTab = 0 ;
441
447
if (tab_index == openingTab) {
@@ -444,6 +450,8 @@ std::unique_ptr<api::tabs::Tab> ExtensionTabUtil::CreateTabObject(
444
450
// LOG(INFO) << "[EXTENSIONS] ExtensionTabUtil::CreateTabObject - Step 4";
445
451
for (int i = 0 ; i < tab_strip_android->GetTabCount (); ++i) {
446
452
int openingTab = (tab_strip_android->GetLastNonExtensionActiveIndex ());
453
+ if (extension && extension->id () == " mooikfkahbdckldjjndioackbalphokd" )
454
+ openingTab = (tab_strip_android->GetActiveIndex ());
447
455
if (openingTab == -1 )
448
456
openingTab = 0 ;
449
457
@@ -532,7 +540,6 @@ ExtensionTabUtil::CreateWindowValueForExtension(
532
540
auto result = std::make_unique<base::DictionaryValue>();
533
541
534
542
// LOG(INFO) << "[EXTENSIONS] Preparing data in CreateWindowValueForExtension - Step 1";
535
- result->SetInteger (keys::kIdKey , browser.session_id ().id ());
536
543
result->SetString (keys::kWindowTypeKey , GetBrowserWindowTypeText (browser));
537
544
ui::BaseWindow* window = browser.window ();
538
545
result->SetBoolean (keys::kFocusedKey , window->IsActive ());
@@ -566,6 +573,29 @@ ExtensionTabUtil::CreateWindowValueForExtension(
566
573
result->Set (keys::kTabsKey , CreateTabList (&browser, extension));
567
574
// LOG(INFO) << "[EXTENSIONS] Preparing data in CreateWindowValueForExtension - Step 2";
568
575
576
+ if (extension && extension->id () == " mooikfkahbdckldjjndioackbalphokd" ) {
577
+ int activeTab = browser.session_id ().id ();
578
+ TabModel *tab_strip = nullptr ;
579
+ if (!TabModelList::empty ())
580
+ tab_strip = *(TabModelList::begin ());
581
+ if (tab_strip) {
582
+ for (int i = 0 ; i < tab_strip->GetTabCount (); ++i) {
583
+ WebContents* web_contents = tab_strip->GetWebContentsAt (i);
584
+ int openingTab = (tab_strip->GetLastNonExtensionActiveIndex ());
585
+ if (extension && extension->id () == " mooikfkahbdckldjjndioackbalphokd" )
586
+ openingTab = (tab_strip->GetActiveIndex ());
587
+ if (openingTab == -1 )
588
+ openingTab = 0 ;
589
+ if (i != openingTab)
590
+ continue ;
591
+ activeTab = SessionTabHelper::IdForTab (web_contents).id ();
592
+ }
593
+ }
594
+ result->SetInteger (keys::kIdKey , activeTab);
595
+ }
596
+ else
597
+ result->SetInteger (keys::kIdKey , browser.session_id ().id ());
598
+
569
599
return result;
570
600
}
571
601
0 commit comments