Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Side by Side Diff: chrome/browser/extensions/extension_tab_util.cc

Issue 535203003: Replace Profile* in declarative_api with BrowserContext* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove changes to unit-test; those have to wait until move. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_tab_util.h" 5 #include "chrome/browser/extensions/extension_tab_util.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" 9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h"
10 #include "chrome/browser/extensions/chrome_extension_function.h" 10 #include "chrome/browser/extensions/chrome_extension_function.h"
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 if (*contents) { 446 if (*contents) {
447 if (tab_id) 447 if (tab_id)
448 *tab_id = GetTabId(*contents); 448 *tab_id = GetTabId(*contents);
449 return true; 449 return true;
450 } 450 }
451 451
452 return false; 452 return false;
453 } 453 }
454 454
455 bool ExtensionTabUtil::GetTabById(int tab_id, 455 bool ExtensionTabUtil::GetTabById(int tab_id,
456 Profile* profile, 456 content::BrowserContext* browser_context,
457 bool include_incognito, 457 bool include_incognito,
458 Browser** browser, 458 Browser** browser,
459 TabStripModel** tab_strip, 459 TabStripModel** tab_strip,
460 WebContents** contents, 460 WebContents** contents,
461 int* tab_index) { 461 int* tab_index) {
462 Profile* profile = Profile::FromBrowserContext(browser_context);
462 Profile* incognito_profile = 463 Profile* incognito_profile =
463 include_incognito && profile->HasOffTheRecordProfile() ? 464 include_incognito && profile->HasOffTheRecordProfile() ?
464 profile->GetOffTheRecordProfile() : NULL; 465 profile->GetOffTheRecordProfile() : NULL;
465 for (chrome::BrowserIterator it; !it.done(); it.Next()) { 466 for (chrome::BrowserIterator it; !it.done(); it.Next()) {
466 Browser* target_browser = *it; 467 Browser* target_browser = *it;
467 if (target_browser->profile() == profile || 468 if (target_browser->profile() == profile ||
468 target_browser->profile() == incognito_profile) { 469 target_browser->profile() == incognito_profile) {
469 TabStripModel* target_tab_strip = target_browser->tab_strip_model(); 470 TabStripModel* target_tab_strip = target_browser->tab_strip_model();
470 for (int i = 0; i < target_tab_strip->count(); ++i) { 471 for (int i = 0; i < target_tab_strip->count(); ++i) {
471 WebContents* target_contents = target_tab_strip->GetWebContentsAt(i); 472 WebContents* target_contents = target_tab_strip->GetWebContentsAt(i);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 false); 592 false);
592 browser->OpenURL(params); 593 browser->OpenURL(params);
593 browser->window()->Show(); 594 browser->window()->Show();
594 WebContents* web_contents = 595 WebContents* web_contents =
595 browser->tab_strip_model()->GetActiveWebContents(); 596 browser->tab_strip_model()->GetActiveWebContents();
596 web_contents->GetDelegate()->ActivateContents(web_contents); 597 web_contents->GetDelegate()->ActivateContents(web_contents);
597 } 598 }
598 } 599 }
599 600
600 } // namespace extensions 601 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_tab_util.h ('k') | chrome/browser/infobars/infobar_extension_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698