summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/accessibility/invert_bubble_views.cc4
-rw-r--r--chrome/browser/app_controller_mac.mm9
-rw-r--r--chrome/browser/app_controller_mac_browsertest.mm1
-rw-r--r--chrome/browser/autofill/autofill_feedback_infobar_delegate.cc3
-rw-r--r--chrome/browser/autofill/autofill_manager.cc6
-rw-r--r--chrome/browser/automation/automation_provider.cc4
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc13
-rw-r--r--chrome/browser/automation/testing_automation_provider.h5
-rw-r--r--chrome/browser/automation/testing_automation_provider_chromeos.cc1
-rw-r--r--chrome/browser/automation/testing_automation_provider_win.cc3
-rw-r--r--chrome/browser/background/background_contents_service.cc4
-rw-r--r--chrome/browser/background/background_mode_manager.cc6
-rw-r--r--chrome/browser/bookmarks/bookmark_context_menu_controller.cc4
-rw-r--r--chrome/browser/bookmarks/bookmark_utils.cc8
-rw-r--r--chrome/browser/chrome_main_browsertest.cc19
-rw-r--r--chrome/browser/chrome_to_mobile_service.cc8
-rw-r--r--chrome/browser/chromeos/background/ash_user_wallpaper_delegate.cc4
-rw-r--r--chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc1
-rw-r--r--chrome/browser/chromeos/enrollment_dialog_view.cc3
-rw-r--r--chrome/browser/chromeos/enrollment_dialog_view.h1
-rw-r--r--chrome/browser/chromeos/extensions/file_manager_util.cc9
-rw-r--r--chrome/browser/chromeos/gdata/gdata_util.cc4
-rw-r--r--chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.cc1
-rw-r--r--chrome/browser/chromeos/locale_change_guard.cc3
-rw-r--r--chrome/browser/chromeos/network_message_observer.cc4
-rw-r--r--chrome/browser/chromeos/oom_priority_manager.cc1
-rw-r--r--chrome/browser/chromeos/status/network_menu.cc5
-rw-r--r--chrome/browser/chromeos/system/ash_system_tray_delegate.cc3
-rw-r--r--chrome/browser/debugger/browser_list_tabcontents_provider.cc1
-rw-r--r--chrome/browser/download/chrome_download_manager_delegate.cc4
-rw-r--r--chrome/browser/extensions/api/browsing_data/browsing_data_api.cc2
-rw-r--r--chrome/browser/extensions/api/cookies/cookies_api.cc1
-rw-r--r--chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc4
-rw-r--r--chrome/browser/extensions/app_notify_channel_ui.cc4
-rw-r--r--chrome/browser/extensions/app_process_apitest.cc7
-rw-r--r--chrome/browser/extensions/extension_context_menu_browsertest.cc4
-rw-r--r--chrome/browser/extensions/extension_devtools_browsertests.cc1
-rw-r--r--chrome/browser/extensions/extension_function.cc4
-rw-r--r--chrome/browser/extensions/extension_host.cc3
-rw-r--r--chrome/browser/extensions/extension_icon_source_apitest.cc6
-rw-r--r--chrome/browser/extensions/extension_incognito_apitest.cc8
-rw-r--r--chrome/browser/extensions/extension_install_ui.cc8
-rw-r--r--chrome/browser/extensions/extension_install_ui_browsertest.cc3
-rw-r--r--chrome/browser/extensions/extension_management_apitest.cc19
-rw-r--r--chrome/browser/extensions/extension_override_apitest.cc4
-rw-r--r--chrome/browser/extensions/extension_process_manager.cc3
-rw-r--r--chrome/browser/extensions/extension_service.cc4
-rw-r--r--chrome/browser/extensions/extension_tabs_module.cc7
-rw-r--r--chrome/browser/extensions/lazy_background_page_apitest.cc4
-rw-r--r--chrome/browser/extensions/window_open_apitest.cc5
-rw-r--r--chrome/browser/first_run/first_run.cc3
-rw-r--r--chrome/browser/geolocation/geolocation_browsertest.cc4
-rw-r--r--chrome/browser/importer/importer_host.cc4
-rw-r--r--chrome/browser/intents/web_intents_util.cc1
-rw-r--r--chrome/browser/managed_mode.cc1
-rw-r--r--chrome/browser/net/gaia/gaia_oauth_fetcher.cc8
-rw-r--r--chrome/browser/notifications/balloon_host.cc4
-rw-r--r--chrome/browser/notifications/desktop_notification_service.cc5
-rw-r--r--chrome/browser/notifications/notification_options_menu_model.cc5
-rw-r--r--chrome/browser/omnibox_search_hint.cc5
-rw-r--r--chrome/browser/popup_blocker_browsertest.cc6
-rw-r--r--chrome/browser/prerender/prerender_browsertest.cc4
-rw-r--r--chrome/browser/prerender/prerender_contents.cc4
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc4
-rw-r--r--chrome/browser/printing/print_dialog_cloud.cc4
-rw-r--r--chrome/browser/printing/print_dialog_cloud_interative_uitest.cc1
-rw-r--r--chrome/browser/printing/print_dialog_gtk.cc4
-rw-r--r--chrome/browser/printing/print_preview_tab_controller.cc6
-rw-r--r--chrome/browser/profiles/profile_manager.cc10
-rw-r--r--chrome/browser/profiles/profile_manager_unittest.cc1
-rw-r--r--chrome/browser/protector/settings_change_global_error.cc3
-rw-r--r--chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm6
-rw-r--r--chrome/browser/safe_browsing/download_protection_service.cc1
-rw-r--r--chrome/browser/sessions/session_restore.cc8
-rw-r--r--chrome/browser/sessions/tab_restore_service_delegate.h4
-rw-r--r--chrome/browser/speech/speech_recognition_bubble_gtk.cc3
-rw-r--r--chrome/browser/speech/speech_recognition_bubble_views.cc3
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.cc5
-rw-r--r--chrome/browser/tab_contents/spelling_bubble_model.cc5
-rw-r--r--chrome/browser/tab_contents/web_drag_bookmark_handler_aura.cc3
-rw-r--r--chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.cc5
-rw-r--r--chrome/browser/tab_contents/web_drag_bookmark_handler_mac.mm5
-rw-r--r--chrome/browser/tab_contents/web_drag_bookmark_handler_win.cc5
-rw-r--r--chrome/browser/task_manager/task_manager.cc1
-rw-r--r--chrome/browser/task_manager/task_manager_resource_providers.cc1
-rw-r--r--chrome/browser/translate/translate_manager.cc4
-rw-r--r--chrome/browser/ui/browser.cc39
-rw-r--r--chrome/browser/ui/browser.h23
-rw-r--r--chrome/browser/ui/browser_browsertest.cc11
-rw-r--r--chrome/browser/ui/browser_finder.cc198
-rw-r--r--chrome/browser/ui/browser_finder.h85
-rw-r--r--chrome/browser/ui/browser_list.cc185
-rw-r--r--chrome/browser/ui/browser_list.h59
-rw-r--r--chrome/browser/ui/browser_navigator.cc8
-rw-r--r--chrome/browser/ui/browser_tab_restore_service_delegate.cc6
-rw-r--r--chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript.mm3
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm5
-rw-r--r--chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm3
-rw-r--r--chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm6
-rw-r--r--chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm4
-rw-r--r--chrome/browser/ui/cocoa/first_run_bubble_controller.mm4
-rw-r--r--chrome/browser/ui/cocoa/history_menu_cocoa_controller.mm5
-rw-r--r--chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm3
-rw-r--r--chrome/browser/ui/gtk/about_chrome_dialog.cc2
-rw-r--r--chrome/browser/ui/gtk/constrained_window_gtk.cc1
-rw-r--r--chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc3
-rw-r--r--chrome/browser/ui/gtk/extensions/extension_uninstall_dialog_gtk.cc4
-rw-r--r--chrome/browser/ui/gtk/first_run_bubble.cc4
-rw-r--r--chrome/browser/ui/gtk/gtk_theme_service.cc1
-rw-r--r--chrome/browser/ui/gtk/gtk_util.cc1
-rw-r--r--chrome/browser/ui/gtk/page_info_bubble_gtk.cc4
-rw-r--r--chrome/browser/ui/gtk/password_generation_bubble_gtk.cc4
-rw-r--r--chrome/browser/ui/gtk/website_settings_popup_gtk.cc1
-rw-r--r--chrome/browser/ui/intents/web_intent_picker_controller.cc11
-rw-r--r--chrome/browser/ui/panels/panel.cc3
-rw-r--r--chrome/browser/ui/panels/panel_browser_window_gtk.cc1
-rw-r--r--chrome/browser/ui/panels/panel_browsertest.cc7
-rw-r--r--chrome/browser/ui/startup/autolaunch_prompt_win.cc4
-rw-r--r--chrome/browser/ui/startup/session_crashed_prompt.cc4
-rw-r--r--chrome/browser/ui/startup/startup_browser_creator_browsertest.cc29
-rw-r--r--chrome/browser/ui/startup/startup_browser_creator_impl.cc3
-rw-r--r--chrome/browser/ui/sync/browser_synced_window_delegate.cc3
-rw-r--r--chrome/browser/ui/sync/one_click_signin_helper.cc4
-rw-r--r--chrome/browser/ui/views/about_chrome_view.cc4
-rw-r--r--chrome/browser/ui/views/ash/app_list/extension_app_item.cc4
-rw-r--r--chrome/browser/ui/views/ash/chrome_shell_delegate.cc7
-rw-r--r--chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.cc4
-rw-r--r--chrome/browser/ui/views/ash/panel_view_aura.cc4
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc4
-rw-r--r--chrome/browser/ui/views/extensions/extension_install_dialog_view.cc3
-rw-r--r--chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc5
-rw-r--r--chrome/browser/ui/views/first_run_bubble.cc5
-rw-r--r--chrome/browser/ui/views/frame/app_non_client_frame_view_aura_browsertest.cc4
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.cc3
-rw-r--r--chrome/browser/ui/views/sad_tab_view.cc4
-rw-r--r--chrome/browser/ui/views/select_file_dialog_extension.cc3
-rw-r--r--chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc1
-rw-r--r--chrome/browser/ui/webui/help/help_handler.cc6
-rw-r--r--chrome/browser/ui/webui/history_ui.cc4
-rw-r--r--chrome/browser/ui/webui/ntp/app_launcher_handler.cc6
-rw-r--r--chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc4
-rw-r--r--chrome/browser/ui/webui/ntp/ntp_login_handler.cc6
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.cc4
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/cros_language_options_handler2.cc3
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc8
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler2.cc4
-rw-r--r--chrome/browser/ui/webui/print_preview/print_preview_handler.cc1
-rw-r--r--chrome/browser/ui/webui/signin/login_ui_service.cc4
-rw-r--r--chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc4
-rw-r--r--chrome/browser/ui/webui/sync_setup_handler.cc1
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--chrome/test/base/ui_test_utils.cc3
152 files changed, 670 insertions, 575 deletions
diff --git a/chrome/browser/accessibility/invert_bubble_views.cc b/chrome/browser/accessibility/invert_bubble_views.cc
index 4c3f298..9bc1a46 100644
--- a/chrome/browser/accessibility/invert_bubble_views.cc
+++ b/chrome/browser/accessibility/invert_bubble_views.cc
@@ -6,6 +6,8 @@
#include "chrome/browser/accessibility/invert_bubble_views.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/views/event_utils.h"
#include "chrome/common/pref_names.h"
@@ -141,7 +143,7 @@ void InvertBubbleView::LinkClicked(views::Link* source, int event_flags) {
}
void InvertBubbleView::OpenLink(const std::string& url, int event_flags) {
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
if (browser) {
WindowOpenDisposition disposition =
event_utils::DispositionFromEventFlags(event_flags);
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 5d676e5..012c14b 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -37,6 +37,7 @@
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/sync/sync_ui_util_mac.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/startup/startup_browser_creator.h"
@@ -106,7 +107,7 @@ bool g_is_opening_new_window = false;
// not possible. If the last active browser is minimized (in particular, if
// there are only minimized windows), it will unminimize it.
Browser* ActivateBrowser(Profile* profile) {
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
+ Browser* browser = browser::FindLastActiveWithProfile(profile);
if (browser)
browser->window()->Activate();
return browser;
@@ -372,8 +373,8 @@ const AEEventClass kAECloudPrintUninstallClass = 'GCPu';
}
- (void)didEndMainMessageLoop {
- DCHECK(!BrowserList::HasBrowserWithProfile([self lastProfile]));
- if (!BrowserList::HasBrowserWithProfile([self lastProfile])) {
+ DCHECK_EQ(0u, browser::GetBrowserCount([self lastProfile]));
+ if (!browser::GetBrowserCount([self lastProfile])) {
// As we're shutting down, we need to nuke the TabRestoreService, which
// will start the shutdown of the NavigationControllers and allow for
// proper shutdown. If we don't do this, Chrome won't shut down cleanly,
@@ -682,7 +683,7 @@ const AEEventClass kAECloudPrintUninstallClass = 'GCPu';
if ([self userWillWaitForInProgressDownloads:downloadCount]) {
// Create a new browser window (if necessary) and navigate to the
// downloads page if the user chooses to wait.
- Browser* browser = BrowserList::FindBrowserWithProfile(profiles[i]);
+ Browser* browser = browser::FindBrowserWithProfile(profiles[i]);
if (!browser) {
browser = Browser::Create(profiles[i]);
browser->window()->Show();
diff --git a/chrome/browser/app_controller_mac_browsertest.mm b/chrome/browser/app_controller_mac_browsertest.mm
index ae67626..4489f07 100644
--- a/chrome/browser/app_controller_mac_browsertest.mm
+++ b/chrome/browser/app_controller_mac_browsertest.mm
@@ -8,6 +8,7 @@
#include "base/memory/scoped_nsobject.h"
#include "chrome/app/chrome_command_ids.h"
#import "chrome/browser/app_controller_mac.h"
+#import "chrome/browser/ui/browser.h"
#import "chrome/browser/ui/browser_list.h"
#import "chrome/common/chrome_switches.h"
#include "chrome/test/base/in_process_browser_test.h"
diff --git a/chrome/browser/autofill/autofill_feedback_infobar_delegate.cc b/chrome/browser/autofill/autofill_feedback_infobar_delegate.cc
index 0f0b26b..a0ba6c1 100644
--- a/chrome/browser/autofill/autofill_feedback_infobar_delegate.cc
+++ b/chrome/browser/autofill/autofill_feedback_infobar_delegate.cc
@@ -7,6 +7,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/infobars/infobar_tab_helper.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/webui/feedback_ui.h"
#include "chrome/browser/feedback/proto/extension.pb.h"
#include "content/public/browser/navigation_controller.h"
@@ -45,7 +46,7 @@ string16 AutofillFeedbackInfoBarDelegate::GetLinkText() const {
bool AutofillFeedbackInfoBarDelegate::LinkClicked(
WindowOpenDisposition disposition) {
browser::ShowWebFeedbackView(
- Browser::GetBrowserForController(
+ browser::FindBrowserForController(
&owner()->web_contents()->GetController(), NULL),
feedback_message_,
std::string(kCategoryTagAutofill));
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc
index 627b0cb..74677e8 100644
--- a/chrome/browser/autofill/autofill_manager.cc
+++ b/chrome/browser/autofill/autofill_manager.cc
@@ -40,7 +40,7 @@
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/autofill_messages.h"
@@ -635,7 +635,7 @@ void AutofillManager::OnShowAutofillDialog() {
#if defined(OS_ANDROID)
NOTIMPLEMENTED();
#else
- Browser* browser = BrowserList::GetLastActiveWithProfile(
+ Browser* browser = browser::FindLastActiveWithProfile(
Profile::FromBrowserContext(web_contents()->GetBrowserContext()));
if (browser)
browser->ShowOptionsTab(chrome::kAutofillSubPage);
@@ -691,7 +691,7 @@ void AutofillManager::OnShowPasswordGenerationPopup(const gfx::Rect& bounds) {
#if defined(OS_ANDROID)
NOTIMPLEMENTED();
#else
- Browser* browser = BrowserList::GetLastActiveWithProfile(
+ Browser* browser = browser::FindLastActiveWithProfile(
Profile::FromBrowserContext(web_contents()->GetBrowserContext()));
browser->window()->ShowPasswordGenerationBubble(bounds);
#endif // #if defined(OS_ANDROID)
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 816d521..7f5e7b1 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -46,7 +46,7 @@
#include "chrome/browser/ssl/ssl_blocking_page.h"
#include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
#include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/find_bar/find_bar.h"
#include "chrome/browser/ui/find_bar/find_bar_controller.h"
@@ -472,7 +472,7 @@ bool AutomationProvider::Send(IPC::Message* msg) {
Browser* AutomationProvider::FindAndActivateTab(
NavigationController* controller) {
int tab_index;
- Browser* browser = Browser::GetBrowserForController(controller, &tab_index);
+ Browser* browser = browser::FindBrowserForController(controller, &tab_index);
if (browser)
browser->ActivateTabAt(tab_index, true);
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index c9178c5..e9c43b3 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -98,6 +98,8 @@
#include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
#include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
#include "chrome/browser/ui/bookmarks/bookmark_bar.h"
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/find_bar/find_bar.h"
#include "chrome/browser/ui/fullscreen_controller.h"
@@ -631,7 +633,7 @@ void TestingAutomationProvider::CloseTab(int tab_handle,
if (tab_tracker_->ContainsHandle(tab_handle)) {
NavigationController* controller = tab_tracker_->GetResource(tab_handle);
int index;
- Browser* browser = Browser::GetBrowserForController(controller, &index);
+ Browser* browser = browser::FindBrowserForController(controller, &index);
DCHECK(browser);
new TabClosedNotificationObserver(this, wait_until_closed, reply_message);
browser->CloseTabContents(controller->GetWebContents());
@@ -748,8 +750,7 @@ void TestingAutomationProvider::GetBrowserWindowCount(int* window_count) {
}
void TestingAutomationProvider::GetNormalBrowserWindowCount(int* window_count) {
- *window_count = static_cast<int>(
- BrowserList::GetBrowserCountForType(profile_, true));
+ *window_count = static_cast<int>(browser::GetTabbedBrowserCount(profile_));
}
void TestingAutomationProvider::GetBrowserWindow(int index, int* handle) {
@@ -761,7 +762,7 @@ void TestingAutomationProvider::GetBrowserWindow(int index, int* handle) {
void TestingAutomationProvider::FindTabbedBrowserWindow(int* handle) {
*handle = 0;
- Browser* browser = BrowserList::FindTabbedBrowser(profile_, false);
+ Browser* browser = browser::FindTabbedBrowser(profile_, false);
if (browser)
*handle = browser_tracker_->Add(browser);
}
@@ -1253,7 +1254,7 @@ void TestingAutomationProvider::GetTabIndex(int handle, int* tabstrip_index) {
if (tab_tracker_->ContainsHandle(handle)) {
NavigationController* tab = tab_tracker_->GetResource(handle);
- Browser* browser = Browser::GetBrowserForController(tab, NULL);
+ Browser* browser = browser::FindBrowserForController(tab, NULL);
*tabstrip_index = browser->GetIndexOfController(tab);
}
}
@@ -7107,7 +7108,7 @@ void TestingAutomationProvider::GetParentBrowserOfTab(int tab_handle,
if (tab_tracker_->ContainsHandle(tab_handle)) {
NavigationController* controller = tab_tracker_->GetResource(tab_handle);
int index;
- Browser* browser = Browser::GetBrowserForController(controller, &index);
+ Browser* browser = browser::FindBrowserForController(controller, &index);
if (browser) {
*browser_handle = browser_tracker_->Add(browser);
*success = true;
diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h
index 5c135c6..c320695 100644
--- a/chrome/browser/automation/testing_automation_provider.h
+++ b/chrome/browser/automation/testing_automation_provider.h
@@ -35,6 +35,7 @@ class PowerManagerClientObserverForTesting;
class AutofillProfile;
class CreditCard;
class ImporterList;
+struct NativeWebKeyboardEvent;
namespace base {
class DictionaryValue;
@@ -44,6 +45,10 @@ namespace content {
class RenderViewHost;
}
+namespace gfx {
+class Rect;
+}
+
namespace webkit {
struct WebPluginInfo;
}
diff --git a/chrome/browser/automation/testing_automation_provider_chromeos.cc b/chrome/browser/automation/testing_automation_provider_chromeos.cc
index 89ad40a..e67bf51 100644
--- a/chrome/browser/automation/testing_automation_provider_chromeos.cc
+++ b/chrome/browser/automation/testing_automation_provider_chromeos.cc
@@ -35,6 +35,7 @@
#include "chrome/browser/policy/cloud_policy_subsystem.h"
#include "chrome/browser/policy/enterprise_install_attributes.h"
#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
#include "chrome/common/pref_names.h"
diff --git a/chrome/browser/automation/testing_automation_provider_win.cc b/chrome/browser/automation/testing_automation_provider_win.cc
index 21d2137..408b226 100644
--- a/chrome/browser/automation/testing_automation_provider_win.cc
+++ b/chrome/browser/automation/testing_automation_provider_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,6 +10,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/automation/automation_browser_tracker.h"
#include "chrome/browser/automation/automation_window_tracker.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
void TestingAutomationProvider::ActivateWindow(int handle) {
diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc
index b98f264..3cfaeab 100644
--- a/chrome/browser/background/background_contents_service.cc
+++ b/chrome/browser/background/background_contents_service.cc
@@ -22,7 +22,7 @@
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
@@ -605,7 +605,7 @@ void BackgroundContentsService::AddWebContents(
WindowOpenDisposition disposition,
const gfx::Rect& initial_pos,
bool user_gesture) {
- Browser* browser = BrowserList::GetLastActiveWithProfile(
+ Browser* browser = browser::FindLastActiveWithProfile(
Profile::FromBrowserContext(new_contents->GetBrowserContext()));
if (!browser)
return;
diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc
index 0a3bdd8..785994c 100644
--- a/chrome/browser/background/background_mode_manager.cc
+++ b/chrome/browser/background/background_mode_manager.cc
@@ -23,6 +23,8 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/status_icons/status_icon.h"
#include "chrome/browser/status_icons/status_tray.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_notification_types.h"
@@ -85,10 +87,10 @@ void BackgroundModeManager::BackgroundModeData::ExecuteCommand(int item) {
}
Browser* BackgroundModeManager::BackgroundModeData::GetBrowserWindow() {
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
if (!browser) {
Browser::OpenEmptyWindow(profile_);
- browser = BrowserList::GetLastActiveWithProfile(profile_);
+ browser = browser::FindLastActiveWithProfile(profile_);
}
return browser;
}
diff --git a/chrome/browser/bookmarks/bookmark_context_menu_controller.cc b/chrome/browser/bookmarks/bookmark_context_menu_controller.cc
index f375353..8aef4cf 100644
--- a/chrome/browser/bookmarks/bookmark_context_menu_controller.cc
+++ b/chrome/browser/bookmarks/bookmark_context_menu_controller.cc
@@ -13,7 +13,7 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/page_navigator.h"
#include "content/public/browser/user_metrics.h"
@@ -197,7 +197,7 @@ void BookmarkContextMenuController::ExecuteCommand(int id) {
case IDC_BOOKMARK_MANAGER: {
content::RecordAction(UserMetricsAction("ShowBookmarkManager"));
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
if (!browser) NOTREACHED();
if (selection_.size() != 1)
diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc
index 2af8a12..c5f1cc4 100644
--- a/chrome/browser/bookmarks/bookmark_utils.cc
+++ b/chrome/browser/bookmarks/bookmark_utils.cc
@@ -21,7 +21,7 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/simple_message_box.h"
#include "chrome/common/pref_names.h"
@@ -155,7 +155,7 @@ void OpenAllImpl(const BookmarkNode* node,
*opened_url = true;
// We opened the first URL which may have opened a new window or clobbered
// the current page, reset the navigator just to be sure.
- Browser* new_browser = BrowserList::GetLastActiveWithProfile(profile);
+ Browser* new_browser = browser::FindLastActiveWithProfile(profile);
if (new_browser) {
WebContents* current_tab = new_browser->GetSelectedWebContents();
if (current_tab)
@@ -388,7 +388,7 @@ void OpenAll(gfx::NativeWindow parent,
NewBrowserPageNavigator navigator_impl(profile);
if (!navigator) {
- Browser* browser = BrowserList::FindTabbedBrowser(profile, false);
+ Browser* browser = browser::FindTabbedBrowser(profile, false);
if (!browser || !browser->GetSelectedWebContents()) {
navigator = &navigator_impl;
} else {
@@ -666,7 +666,7 @@ void GetURLAndTitleToBookmark(WebContents* web_contents,
void GetURLAndTitleToBookmarkFromCurrentTab(Profile* profile,
GURL* url,
string16* title) {
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
+ Browser* browser = browser::FindLastActiveWithProfile(profile);
WebContents* web_contents = browser ? browser->GetSelectedWebContents()
: NULL;
if (web_contents)
diff --git a/chrome/browser/chrome_main_browsertest.cc b/chrome/browser/chrome_main_browsertest.cc
index 5f38cb2..1729cb7 100644
--- a/chrome/browser/chrome_main_browsertest.cc
+++ b/chrome/browser/chrome_main_browsertest.cc
@@ -9,6 +9,7 @@
#include "base/path_service.h"
#include "base/process_util.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
@@ -39,7 +40,7 @@ IN_PROC_BROWSER_TEST_F(ChromeMainTest, SecondLaunch) {
ui_test_utils::BrowserAddedObserver observer;
Relaunch(GetCommandLineForRelaunch());
observer.WaitForSingleNewBrowser();
- ASSERT_EQ(BrowserList::GetBrowserCount(browser()->profile()), 2u);
+ ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile()));
}
IN_PROC_BROWSER_TEST_F(ChromeMainTest, ReuseBrowserInstanceWhenOpeningFile) {
@@ -61,8 +62,7 @@ IN_PROC_BROWSER_TEST_F(ChromeMainTest, ReuseBrowserInstanceWhenOpeningFile) {
IN_PROC_BROWSER_TEST_F(ChromeMainTest, SecondLaunchWithIncognitoUrl) {
// We should start with one normal window.
- ASSERT_EQ(1u,
- BrowserList::GetBrowserCountForType(browser()->profile(), true));
+ ASSERT_EQ(1u, browser::GetTabbedBrowserCount(browser()->profile()));
// Run with --incognito switch and an URL specified.
FilePath test_file_path = ui_test_utils::GetTestFilePath(
@@ -79,21 +79,18 @@ IN_PROC_BROWSER_TEST_F(ChromeMainTest, SecondLaunchWithIncognitoUrl) {
observer.WaitForSingleNewBrowser();
ASSERT_EQ(2u, BrowserList::size());
- ASSERT_EQ(1u,
- BrowserList::GetBrowserCountForType(browser()->profile(), true));
+ ASSERT_EQ(1u, browser::GetTabbedBrowserCount(browser()->profile()));
}
IN_PROC_BROWSER_TEST_F(ChromeMainTest, SecondLaunchFromIncognitoWithNormalUrl) {
// We should start with one normal window.
- ASSERT_EQ(1u,
- BrowserList::GetBrowserCountForType(browser()->profile(), true));
+ ASSERT_EQ(1u, browser::GetTabbedBrowserCount(browser()->profile()));
// Create an incognito window.
browser()->NewIncognitoWindow();
ASSERT_EQ(2u, BrowserList::size());
- ASSERT_EQ(1u,
- BrowserList::GetBrowserCountForType(browser()->profile(), true));
+ ASSERT_EQ(1u, browser::GetTabbedBrowserCount(browser()->profile()));
// Close the first window.
Profile* profile = browser()->profile();
@@ -105,7 +102,7 @@ IN_PROC_BROWSER_TEST_F(ChromeMainTest, SecondLaunchFromIncognitoWithNormalUrl) {
// There should only be the incognito window open now.
ASSERT_EQ(1u, BrowserList::size());
- ASSERT_EQ(0u, BrowserList::GetBrowserCountForType(profile, true));
+ ASSERT_EQ(0u, browser::GetTabbedBrowserCount(profile));
// Run with just an URL specified, no --incognito switch.
FilePath test_file_path = ui_test_utils::GetTestFilePath(
@@ -120,7 +117,7 @@ IN_PROC_BROWSER_TEST_F(ChromeMainTest, SecondLaunchFromIncognitoWithNormalUrl) {
// There should be one normal and one incognito window now.
ASSERT_EQ(2u, BrowserList::size());
- ASSERT_EQ(1u, BrowserList::GetBrowserCountForType(profile, true));
+ ASSERT_EQ(1u, browser::GetTabbedBrowserCount(profile));
}
#endif // !OS_MACOSX
diff --git a/chrome/browser/chrome_to_mobile_service.cc b/chrome/browser/chrome_to_mobile_service.cc
index d6bab02..2009cdf 100644
--- a/chrome/browser/chrome_to_mobile_service.cc
+++ b/chrome/browser/chrome_to_mobile_service.cc
@@ -20,7 +20,7 @@
#include "chrome/browser/signin/token_service.h"
#include "chrome/browser/signin/token_service_factory.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/cloud_print/cloud_print_helpers.h"
@@ -245,7 +245,7 @@ void ChromeToMobileService::SendToMobile(const string16& mobile_id,
RequestData data;
data.mobile_id = mobile_id;
content::WebContents* web_contents =
- BrowserList::GetLastActiveWithProfile(profile_)->GetSelectedWebContents();
+ browser::FindLastActiveWithProfile(profile_)->GetSelectedWebContents();
data.url = web_contents->GetURL();
data.title = web_contents->GetTitle();
data.snapshot_path = snapshot;
@@ -331,7 +331,7 @@ void ChromeToMobileService::SnapshotFileCreated(
// Track the set of temporary files to be deleted later.
snapshots_.insert(path);
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
if (success && browser && browser->GetSelectedWebContents()) {
// Generate the snapshot and have the observer be called back on completion.
browser->GetSelectedWebContents()->GenerateMHTML(path,
@@ -473,7 +473,7 @@ void ChromeToMobileService::HandleSearchResponse() {
if (!mobiles_.empty())
LogMetric(DEVICES_AVAILABLE);
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
if (browser && browser->command_updater())
browser->command_updater()->UpdateCommandEnabled(
IDC_CHROME_TO_MOBILE_PAGE, !mobiles_.empty());
diff --git a/chrome/browser/chromeos/background/ash_user_wallpaper_delegate.cc b/chrome/browser/chromeos/background/ash_user_wallpaper_delegate.cc
index 7e19957..b098dc4 100644
--- a/chrome/browser/chromeos/background/ash_user_wallpaper_delegate.cc
+++ b/chrome/browser/chromeos/background/ash_user_wallpaper_delegate.cc
@@ -11,7 +11,7 @@
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/chrome_notification_types.h"
#include "content/public/browser/notification_service.h"
@@ -32,7 +32,7 @@ class UserWallpaperDelegate: public ash::UserWallpaperDelegate {
}
virtual void OpenSetWallpaperPage() OVERRIDE {
- Browser* browser = Browser::GetOrCreateTabbedBrowser(
+ Browser* browser = browser::FindOrCreateTabbedBrowser(
ProfileManager::GetDefaultProfileOrOffTheRecord());
browser->ShowOptionsTab("setWallpaper");
}
diff --git a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc
index a19b4b3..26e916e 100644
--- a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc
+++ b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc
@@ -8,6 +8,7 @@
#include "base/bind_helpers.h"
#include "base/threading/platform_thread.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "content/public/browser/browser_thread.h"
#include "dbus/bus.h"
#include "dbus/message.h"
#include "dbus/exported_object.h"
diff --git a/chrome/browser/chromeos/enrollment_dialog_view.cc b/chrome/browser/chromeos/enrollment_dialog_view.cc
index b8e5260..c2b85cf 100644
--- a/chrome/browser/chromeos/enrollment_dialog_view.cc
+++ b/chrome/browser/chromeos/enrollment_dialog_view.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/extensions/extension_host.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/themes/theme_service.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/views/extensions/extension_dialog.h"
#include "chrome/browser/ui/views/extensions/extension_dialog_observer.h"
#include "chrome/common/url_constants.h"
@@ -119,7 +120,7 @@ int EnrollmentDialogView::GetDialogButtons() const {
bool EnrollmentDialogView::Accept() {
// Navigate to the target URI in a browser tab.
- Browser* browser = BrowserList::FindTabbedBrowser(profile_, false);
+ Browser* browser = browser::FindTabbedBrowser(profile_, false);
if (!browser) {
// Couldn't find a tabbed browser: create one.
browser = Browser::Create(profile_);
diff --git a/chrome/browser/chromeos/enrollment_dialog_view.h b/chrome/browser/chromeos/enrollment_dialog_view.h
index 0e54c86..12fd5c8 100644
--- a/chrome/browser/chromeos/enrollment_dialog_view.h
+++ b/chrome/browser/chromeos/enrollment_dialog_view.h
@@ -20,7 +20,6 @@ class EnrollmentDelegate;
EnrollmentDelegate* CreateEnrollmentDelegate(gfx::NativeWindow owning_window,
const std::string& network_name,
-
Profile* profile);
} // namespace chromeos
diff --git a/chrome/browser/chromeos/extensions/file_manager_util.cc b/chrome/browser/chromeos/extensions/file_manager_util.cc
index 1cc825d..cad5222 100644
--- a/chrome/browser/chromeos/extensions/file_manager_util.cc
+++ b/chrome/browser/chromeos/extensions/file_manager_util.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/simple_message_box.h"
@@ -218,7 +219,7 @@ DictionaryValue* ProgessStatusToDictionaryValue(
void OpenNewTab(const GURL& url, Profile* profile) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- Browser* browser = Browser::GetOrCreateTabbedBrowser(
+ Browser* browser = browser::FindOrCreateTabbedBrowser(
profile ? profile : ProfileManager::GetDefaultProfileOrOffTheRecord());
browser->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_LINK);
// If the current browser is not tabbed then the new tab will be created
@@ -228,7 +229,9 @@ void OpenNewTab(const GURL& url, Profile* profile) {
// Shows a warning message box saying that the file could not be opened.
void ShowWarningMessageBox(Profile* profile, const FilePath& path) {
- Browser* browser = Browser::GetOrCreateTabbedBrowser(profile);
+ // TODO: if FindOrCreateTabbedBrowser creates a new browser the returned
+ // browser is leaked.
+ Browser* browser = browser::FindOrCreateTabbedBrowser(profile);
browser::ShowMessageBox(
browser->window()->GetNativeHandle(),
l10n_util::GetStringFUTF16(
@@ -503,7 +506,7 @@ class StandaloneExecutor : public FileTaskExecutor {
protected :
// FileTaskExecutor overrides.
virtual Browser* browser() {
- return Browser::GetOrCreateTabbedBrowser(profile());
+ return browser::FindOrCreateTabbedBrowser(profile());
}
virtual void Done(bool) {}
};
diff --git a/chrome/browser/chromeos/gdata/gdata_util.cc b/chrome/browser/chromeos/gdata/gdata_util.cc
index 8674c93..6d3babe 100644
--- a/chrome/browser/chromeos/gdata/gdata_util.cc
+++ b/chrome/browser/chromeos/gdata/gdata_util.cc
@@ -28,7 +28,7 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_security_policy.h"
#include "net/base/escape.h"
@@ -86,7 +86,7 @@ void GetHostedDocumentURLBlockingThread(const FilePath& gdata_cache_path,
}
void OpenEditURLUIThread(Profile* profile, GURL* edit_url) {
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
+ Browser* browser = browser::FindLastActiveWithProfile(profile);
if (browser) {
browser->OpenURL(content::OpenURLParams(*edit_url, content::Referrer(),
CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false));
diff --git a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.cc b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.cc
index 234eb87..f1c3a95 100644
--- a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.cc
+++ b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/policy/browser_policy_connector.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/chrome_switches.h"
+#include "content/public/browser/browser_thread.h"
namespace chromeos {
diff --git a/chrome/browser/chromeos/locale_change_guard.cc b/chrome/browser/chromeos/locale_change_guard.cc
index bb84120..0be0066 100644
--- a/chrome/browser/chromeos/locale_change_guard.cc
+++ b/chrome/browser/chromeos/locale_change_guard.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/notification_service.h"
@@ -74,7 +75,7 @@ void LocaleChangeGuard::RevertLocaleChange(const ListValue* list) {
profile_->ChangeAppLocale(
from_locale_, Profile::APP_LOCALE_CHANGED_VIA_REVERT);
- Browser* browser = Browser::GetTabbedBrowser(profile_, false);
+ Browser* browser = browser::FindTabbedBrowser(profile_, false);
if (browser)
browser->ExecuteCommand(IDC_EXIT);
}
diff --git a/chrome/browser/chromeos/network_message_observer.cc b/chrome/browser/chromeos/network_message_observer.cc
index b9e372b..5979589 100644
--- a/chrome/browser/chromeos/network_message_observer.cc
+++ b/chrome/browser/chromeos/network_message_observer.cc
@@ -18,7 +18,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/time_format.h"
#include "grit/generated_resources.h"
@@ -86,7 +86,7 @@ void NetworkMessageObserver::OpenMobileSetupPage(const ListValue* args) {
}
void NetworkMessageObserver::OpenMoreInfoPage(const ListValue* args) {
- Browser* browser = Browser::GetOrCreateTabbedBrowser(
+ Browser* browser = browser::FindOrCreateTabbedBrowser(
ProfileManager::GetDefaultProfileOrOffTheRecord());
chromeos::NetworkLibrary* lib =
chromeos::CrosLibrary::Get()->GetNetworkLibrary();
diff --git a/chrome/browser/chromeos/oom_priority_manager.cc b/chrome/browser/chromeos/oom_priority_manager.cc
index d17e1e9..07dd1fc 100644
--- a/chrome/browser/chromeos/oom_priority_manager.cc
+++ b/chrome/browser/chromeos/oom_priority_manager.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/low_memory_observer.h"
#include "chrome/browser/memory_details.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
diff --git a/chrome/browser/chromeos/status/network_menu.cc b/chrome/browser/chromeos/status/network_menu.cc
index b1b93c67..cdd9099 100644
--- a/chrome/browser/chromeos/status/network_menu.cc
+++ b/chrome/browser/chromeos/status/network_menu.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/defaults.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
@@ -498,7 +499,7 @@ void NetworkMenuModel::ActivatedAt(int index) {
if (active_vpn)
cros->DisconnectFromNetwork(active_vpn);
} else if (flags & FLAG_VIEW_ACCOUNT) {
- Browser* browser = Browser::GetOrCreateTabbedBrowser(
+ Browser* browser = browser::FindOrCreateTabbedBrowser(
ProfileManager::GetDefaultProfileOrOffTheRecord());
browser->ShowSingletonTab(GURL(top_up_url_));
}
@@ -1095,7 +1096,7 @@ bool NetworkMenu::ShouldHighlightNetwork(const Network* network) {
Browser* NetworkMenu::GetAppropriateBrowser() const {
DCHECK(chromeos::UserManager::Get()->IsSessionStarted());
- return Browser::GetOrCreateTabbedBrowser(
+ return browser::FindOrCreateTabbedBrowser(
ProfileManager::GetDefaultProfileOrOffTheRecord());
}
diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
index 618c56b..ceefff6 100644
--- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
+++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
@@ -52,6 +52,7 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/upgrade_detector.h"
#include "chrome/common/chrome_notification_types.h"
@@ -722,7 +723,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
// Returns the last active browser. If there is no such browser, creates a new
// browser window with an empty tab and returns it.
Browser* GetAppropriateBrowser() {
- return Browser::GetOrCreateTabbedBrowser(
+ return browser::FindOrCreateTabbedBrowser(
ProfileManager::GetDefaultProfileOrOffTheRecord());
}
diff --git a/chrome/browser/debugger/browser_list_tabcontents_provider.cc b/chrome/browser/debugger/browser_list_tabcontents_provider.cc
index efee965..260eefa 100644
--- a/chrome/browser/debugger/browser_list_tabcontents_provider.cc
+++ b/chrome/browser/debugger/browser_list_tabcontents_provider.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/history/top_sites.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "content/public/browser/browser_thread.h"
#include "grit/devtools_discovery_page_resources.h"
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc
index 56c3613..5edc20d 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -46,7 +46,7 @@
#if !defined(OS_ANDROID)
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#endif
#if defined(OS_CHROMEOS)
@@ -179,7 +179,7 @@ WebContents* ChromeDownloadManagerDelegate::
#else
// Start the download in the last active browser. This is not ideal but better
// than fully hiding the download from the user.
- Browser* last_active = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* last_active = browser::FindLastActiveWithProfile(profile_);
return last_active ? last_active->GetSelectedWebContents() : NULL;
#endif
}
diff --git a/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc b/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc
index b3f47c3..2540d9aa 100644
--- a/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc
+++ b/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc
@@ -15,7 +15,7 @@
#include "chrome/browser/plugin_data_remover_helper.h"
#include "chrome/browser/plugin_prefs.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_error_utils.h"
#include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/extensions/api/cookies/cookies_api.cc b/chrome/browser/extensions/api/cookies/cookies_api.cc
index bd224e0..f36ea1a 100644
--- a/chrome/browser/extensions/api/cookies/cookies_api.cc
+++ b/chrome/browser/extensions/api/cookies/cookies_api.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/extensions/api/cookies/cookies_helpers.h"
#include "chrome/browser/extensions/extension_event_router.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
index 01f939b..1152fcf 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
@@ -9,7 +9,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/render_view_context_menu.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/render_view_host.h"
@@ -302,7 +302,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationTargetBlankIncognito) {
"files/extensions/api_test/webnavigation/targetBlank/a.html");
ui_test_utils::OpenURLOffTheRecord(browser()->profile(), url);
- WebContents* tab = BrowserList::FindTabbedBrowser(
+ WebContents* tab = browser::FindTabbedBrowser(
browser()->profile()->GetOffTheRecordProfile(), false)->
GetSelectedWebContents();
diff --git a/chrome/browser/extensions/app_notify_channel_ui.cc b/chrome/browser/extensions/app_notify_channel_ui.cc
index 53afc12..f50f4df 100644
--- a/chrome/browser/extensions/app_notify_channel_ui.cc
+++ b/chrome/browser/extensions/app_notify_channel_ui.cc
@@ -13,7 +13,7 @@
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
@@ -153,7 +153,7 @@ void AppNotifyChannelUIImpl::OnInfoBarResult(bool accepted) {
}
}
// Any existing UI is now closed - display new login UI.
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
if (browser) {
browser->ShowOptionsTab(chrome::kSyncSetupForceLoginSubPage);
return;
diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc
index f4acf5b..01b3033 100644
--- a/chrome/browser/extensions/app_process_apitest.cc
+++ b/chrome/browser/extensions/app_process_apitest.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/extensions/process_map.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
@@ -150,7 +151,7 @@ class AppApiTest : public ExtensionApiTest {
// Opening tabs with window.open should keep the page in the opener's
// process.
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile()));
WindowOpenHelper(browser(), host1,
base_url.Resolve("path1/empty.html"), true);
LOG(INFO) << "WindowOpenHelper 1.";
@@ -222,7 +223,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) {
browser()->GetWebContentsAt(3)->GetRenderProcessHost());
// Now let's do the same using window.open. The same should happen.
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile()));
WindowOpenHelper(browser(), host,
base_url.Resolve("path1/empty.html"), true);
LOG(INFO) << "WindowOpenHelper 1.";
@@ -333,7 +334,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, BookmarkAppGetsNormalProcess) {
browser()->GetWebContentsAt(2)->GetRenderProcessHost());
// Now let's do the same using window.open. The same should happen.
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile()));
WindowOpenHelper(browser(), host,
base_url.Resolve("path1/empty.html"), true);
WindowOpenHelper(browser(), host,
diff --git a/chrome/browser/extensions/extension_context_menu_browsertest.cc b/chrome/browser/extensions/extension_context_menu_browsertest.cc
index 34cf4cd..83bb8bb 100644
--- a/chrome/browser/extensions/extension_context_menu_browsertest.cc
+++ b/chrome/browser/extensions/extension_context_menu_browsertest.cc
@@ -10,7 +10,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/render_view_context_menu.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/common/context_menu_params.h"
#include "net/base/mock_host_resolver.h"
@@ -457,7 +457,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionContextMenuBrowserTest, MAYBE_IncognitoSplit) {
GURL page_url("http://www.google.com");
// Create and build our test context menu.
- Browser* browser_incognito = BrowserList::FindTabbedBrowser(
+ Browser* browser_incognito = browser::FindTabbedBrowser(
browser()->profile()->GetOffTheRecordProfile(), false);
ASSERT_TRUE(browser_incognito);
scoped_ptr<TestRenderViewContextMenu> menu(
diff --git a/chrome/browser/extensions/extension_devtools_browsertests.cc b/chrome/browser/extensions/extension_devtools_browsertests.cc
index 51910d2..2c14017 100644
--- a/chrome/browser/extensions/extension_devtools_browsertests.cc
+++ b/chrome/browser/extensions/extension_devtools_browsertests.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_paths.h"
diff --git a/chrome/browser/extensions/extension_function.cc b/chrome/browser/extensions/extension_function.cc
index e21ff3b..f42910a 100644
--- a/chrome/browser/extensions/extension_function.cc
+++ b/chrome/browser/extensions/extension_function.cc
@@ -12,7 +12,7 @@
#include "chrome/browser/extensions/extension_window_list.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_host/chrome_render_message_filter.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/extensions/extension_messages.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
@@ -200,7 +200,7 @@ Browser* UIThreadExtensionFunction::GetCurrentBrowser() {
// |include_incognito|.
Profile* profile = Profile::FromBrowserContext(
render_view_host_->GetProcess()->GetBrowserContext());
- Browser* browser = BrowserList::FindAnyBrowser(profile, include_incognito_);
+ Browser* browser = browser::FindAnyBrowser(profile, include_incognito_);
// NOTE(rafaelw): This can return NULL in some circumstances. In particular,
// a background_page onload chrome.tabs api call can make it into here
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index d7507ec..722f279 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -23,6 +23,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
@@ -564,7 +565,7 @@ void ExtensionHost::AddNewContents(WebContents* source,
// NULL argument to NavigateParams is valid.
Profile* profile =
Profile::FromBrowserContext(new_contents->GetBrowserContext());
- Browser* browser = BrowserList::FindTabbedBrowser(
+ Browser* browser = browser::FindTabbedBrowser(
profile, false); // Match incognito exactly.
TabContentsWrapper* wrapper = new TabContentsWrapper(new_contents);
browser::NavigateParams params(browser, wrapper);
diff --git a/chrome/browser/extensions/extension_icon_source_apitest.cc b/chrome/browser/extensions/extension_icon_source_apitest.cc
index 8af5737..f77be46 100644
--- a/chrome/browser/extensions/extension_icon_source_apitest.cc
+++ b/chrome/browser/extensions/extension_icon_source_apitest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,7 +7,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/web_contents.h"
@@ -64,7 +64,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, IconsLoadedIncognito) {
ui_test_utils::OpenURLOffTheRecord(
browser()->profile(),
GURL("chrome-extension://gbmgkahjioeacddebbnengilkgbkhodg/index.html"));
- Browser* otr_browser = BrowserList::FindTabbedBrowser(
+ Browser* otr_browser = browser::FindTabbedBrowser(
browser()->profile()->GetOffTheRecordProfile(), false);
ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString(
otr_browser->GetSelectedWebContents()->GetRenderViewHost(), L"",
diff --git a/chrome/browser/extensions/extension_incognito_apitest.cc b/chrome/browser/extensions/extension_incognito_apitest.cc
index 6c56875..ddedd00 100644
--- a/chrome/browser/extensions/extension_incognito_apitest.cc
+++ b/chrome/browser/extensions/extension_incognito_apitest.cc
@@ -9,7 +9,7 @@
#include "chrome/browser/extensions/user_script_master.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -31,7 +31,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoNoScript) {
browser()->profile(),
test_server()->GetURL("files/extensions/test_file.html"));
- Browser* otr_browser = BrowserList::FindTabbedBrowser(
+ Browser* otr_browser = browser::FindTabbedBrowser(
browser()->profile()->GetOffTheRecordProfile(), false);
WebContents* tab = otr_browser->GetSelectedWebContents();
@@ -68,7 +68,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoYesScript) {
browser()->profile(),
test_server()->GetURL("files/extensions/test_file.html"));
- Browser* otr_browser = BrowserList::FindTabbedBrowser(
+ Browser* otr_browser = browser::FindTabbedBrowser(
browser()->profile()->GetOffTheRecordProfile(), false);
WebContents* tab = otr_browser->GetSelectedWebContents();
@@ -198,7 +198,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_IncognitoPopup) {
browser()->profile(),
test_server()->GetURL("files/extensions/test_file.html"));
- Browser* incognito_browser = BrowserList::FindTabbedBrowser(
+ Browser* incognito_browser = browser::FindTabbedBrowser(
browser()->profile()->GetOffTheRecordProfile(), false);
// Simulate the incognito's browser action being clicked.
diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc
index 9d1df2c..db904af 100644
--- a/chrome/browser/extensions/extension_install_ui.cc
+++ b/chrome/browser/extensions/extension_install_ui.cc
@@ -22,7 +22,7 @@
#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/simple_message_box.h"
@@ -364,7 +364,7 @@ void ExtensionInstallUI::OnInstallSuccess(const Extension* extension,
// Extensions aren't enabled by default in incognito so we confirm
// the install in a normal window.
Profile* profile = profile_->GetOriginalProfile();
- Browser* browser = Browser::GetOrCreateTabbedBrowser(profile);
+ Browser* browser = browser::FindOrCreateTabbedBrowser(profile);
if (browser->tab_count() == 0)
browser->AddBlankTab(true);
browser->window()->Show();
@@ -396,7 +396,7 @@ void ExtensionInstallUI::OnInstallFailure(const string16& error) {
if (disable_failure_ui_for_tests || skip_post_install_ui_)
return;
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
browser::ShowMessageBox(browser ? browser->window()->GetNativeHandle() : NULL,
l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALL_FAILURE_TITLE), error,
browser::MESSAGE_BOX_TYPE_WARNING);
@@ -457,7 +457,7 @@ void ExtensionInstallUI::ShowThemeInfoBar(const std::string& previous_theme_id,
return;
// Get last active tabbed browser of profile.
- Browser* browser = BrowserList::FindTabbedBrowser(profile, true);
+ Browser* browser = browser::FindTabbedBrowser(profile, true);
if (!browser)
return;
diff --git a/chrome/browser/extensions/extension_install_ui_browsertest.cc b/chrome/browser/extensions/extension_install_ui_browsertest.cc
index e62181d..5456236 100644
--- a/chrome/browser/extensions/extension_install_ui_browsertest.cc
+++ b/chrome/browser/extensions/extension_install_ui_browsertest.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/infobars/infobar_tab_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
#include "chrome/browser/themes/theme_service_factory.h"
@@ -116,7 +117,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
AppInstallConfirmation_Incognito) {
Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile();
- Browser* incognito_browser = Browser::GetOrCreateTabbedBrowser(
+ Browser* incognito_browser = browser::FindOrCreateTabbedBrowser(
incognito_profile);
int num_incognito_tabs = incognito_browser->tab_count();
diff --git a/chrome/browser/extensions/extension_management_apitest.cc b/chrome/browser/extensions/extension_management_apitest.cc
index 1bcda9e..e1d0d8a 100644
--- a/chrome/browser/extensions/extension_management_apitest.cc
+++ b/chrome/browser/extensions/extension_management_apitest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,7 @@
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
@@ -92,7 +93,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) {
ASSERT_FALSE(HasFatalFailure()); // Stop the test if any ASSERT failed.
// Find the app's browser. Check that it is a panel.
- ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile()));
Browser* app_browser = FindOtherBrowser(browser());
ASSERT_TRUE(app_browser->is_type_panel());
ASSERT_TRUE(app_browser->is_app());
@@ -107,7 +108,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) {
// Unload the extension.
UninstallExtension(app_id);
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile()));
ASSERT_FALSE(service->GetExtensionById(app_id, true));
// Set a pref indicating that the user wants to launch in a regular tab.
@@ -125,7 +126,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) {
// Find the app's browser. Apps that should load in a panel ignore
// prefs, so we should still see the launch in a panel.
- ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile()));
app_browser = FindOtherBrowser(browser());
ASSERT_TRUE(app_browser->is_type_panel());
ASSERT_TRUE(app_browser->is_app());
@@ -143,7 +144,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchTabApp) {
// Code below assumes that the test starts with a single browser window
// hosting one tab.
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile()));
ASSERT_EQ(1, browser()->tab_count());
// Load an app with app.launch.container = "tab".
@@ -152,12 +153,12 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchTabApp) {
ASSERT_FALSE(HasFatalFailure());
// Check that the app opened in a new tab of the existing browser.
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile()));
ASSERT_EQ(2, browser()->tab_count());
// Unload the extension.
UninstallExtension(app_id);
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile()));
ASSERT_FALSE(service->GetExtensionById(app_id, true));
// Set a pref indicating that the user wants to launch in a window.
@@ -174,12 +175,12 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchTabApp) {
#if defined(OS_MACOSX)
// App windows are not yet implemented on mac os. We should fall back
// to a normal tab.
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile()));
ASSERT_EQ(2, browser()->tab_count());
#else
// Find the app's browser. Opening in a new window will create
// a new browser.
- ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile()));
Browser* app_browser = FindOtherBrowser(browser());
ASSERT_TRUE(app_browser->is_app());
ASSERT_FALSE(app_browser->is_type_panel());
diff --git a/chrome/browser/extensions/extension_override_apitest.cc b/chrome/browser/extensions/extension_override_apitest.cc
index 1d4e213..50d59c5 100644
--- a/chrome/browser/extensions/extension_override_apitest.cc
+++ b/chrome/browser/extensions/extension_override_apitest.cc
@@ -9,7 +9,7 @@
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/navigation_entry.h"
@@ -89,7 +89,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, MAYBE_OverrideNewtabIncognito) {
// new tab page because we can't load chrome-extension URLs in incognito.
ui_test_utils::OpenURLOffTheRecord(browser()->profile(),
GURL("chrome://newtab/"));
- Browser* otr_browser = BrowserList::FindTabbedBrowser(
+ Browser* otr_browser = browser::FindTabbedBrowser(
browser()->profile()->GetOffTheRecordProfile(), false);
WebContents* tab = otr_browser->GetSelectedWebContents();
ASSERT_TRUE(tab->GetController().GetActiveEntry());
diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc
index 71e8b60..63437bd 100644
--- a/chrome/browser/extensions/extension_process_manager.cc
+++ b/chrome/browser/extensions/extension_process_manager.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
@@ -284,7 +285,7 @@ void ExtensionProcessManager::OpenOptionsPage(const Extension* extension,
// able to save settings from OTR.
if (!browser || browser->profile()->IsOffTheRecord()) {
Profile* profile = GetProfile();
- browser = Browser::GetOrCreateTabbedBrowser(profile->GetOriginalProfile());
+ browser = browser::FindOrCreateTabbedBrowser(profile->GetOriginalProfile());
}
OpenURLParams params(extension->options_url(), Referrer(), SINGLETON_TAB,
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index b393a40..98d581c 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -77,7 +77,7 @@
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/global_error_service.h"
#include "chrome/browser/ui/global_error_service_factory.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
@@ -1787,7 +1787,7 @@ void ExtensionService::IdentifyAlertableExtensions() {
if (PopulateExtensionGlobalError(extension_global_error_.get())) {
if (extension_prefs_->SetAlertSystemFirstRun()) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
if (browser) {
extension_global_error_->ShowBubbleView(browser);
did_show_alert = true;
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc
index dc228a8..7f15efc 100644
--- a/chrome/browser/extensions/extension_tabs_module.cc
+++ b/chrome/browser/extensions/extension_tabs_module.cc
@@ -33,6 +33,7 @@
#include "chrome/browser/sessions/restore_tab_helper.h"
#include "chrome/browser/translate/translate_tab_helper.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_window.h"
@@ -303,7 +304,7 @@ bool GetLastFocusedWindowFunction::RunImpl() {
// Note: currently this returns the last active browser. If we decide to
// include other window types (e.g. panels), we will need to add logic to
// ExtensionWindowList that mirrors the active behavior of BrowserList.
- Browser* browser = BrowserList::FindAnyBrowser(
+ Browser* browser = browser::FindAnyBrowser(
profile(), include_incognito());
if (!browser || !browser->window()) {
error_ = keys::kNoLastFocusedWindowError;
@@ -979,7 +980,7 @@ bool CreateTabFunction::RunImpl() {
// Ensure the selected browser is tabbed.
if (!browser->is_type_tabbed() && browser->IsAttemptingToCloseBrowser())
- browser = Browser::GetTabbedBrowser(profile(), include_incognito());
+ browser = browser::FindTabbedBrowser(profile(), include_incognito());
if (!browser || !browser->window())
return false;
@@ -1050,7 +1051,7 @@ bool CreateTabFunction::RunImpl() {
!GetExtension()->incognito_split_mode() &&
browser->profile()->IsOffTheRecord()) {
Profile* profile = browser->profile()->GetOriginalProfile();
- browser = BrowserList::FindTabbedBrowser(profile, false);
+ browser = browser::FindTabbedBrowser(profile, false);
if (!browser) {
browser = Browser::Create(profile);
browser->window()->Show();
diff --git a/chrome/browser/extensions/lazy_background_page_apitest.cc b/chrome/browser/extensions/lazy_background_page_apitest.cc
index 9ef6126..d5ddf9d 100644
--- a/chrome/browser/extensions/lazy_background_page_apitest.cc
+++ b/chrome/browser/extensions/lazy_background_page_apitest.cc
@@ -14,7 +14,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/omnibox/location_bar.h"
#include "chrome/common/chrome_notification_types.h"
@@ -275,7 +275,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, IncognitoSplitMode) {
// Open incognito window.
ui_test_utils::OpenURLOffTheRecord(
browser()->profile(), GURL("about:blank"));
- Browser* incognito_browser = BrowserList::FindTabbedBrowser(
+ Browser* incognito_browser = browser::FindTabbedBrowser(
browser()->profile()->GetOffTheRecordProfile(), false);
ASSERT_TRUE(incognito_browser);
diff --git a/chrome/browser/extensions/window_open_apitest.cc b/chrome/browser/extensions/window_open_apitest.cc
index a0000f7..63a216e 100644
--- a/chrome/browser/extensions/window_open_apitest.cc
+++ b/chrome/browser/extensions/window_open_apitest.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
@@ -43,14 +44,14 @@ void WaitForTabsAndPopups(Browser* browser,
const base::TimeDelta kWaitTime = base::TimeDelta::FromSeconds(15);
base::TimeTicks end_time = base::TimeTicks::Now() + kWaitTime;
while (base::TimeTicks::Now() < end_time) {
- if (BrowserList::GetBrowserCount(browser->profile()) == num_browsers &&
+ if (browser::GetBrowserCount(browser->profile()) == num_browsers &&
browser->tab_count() == num_tabs)
break;
ui_test_utils::RunAllPendingInMessageLoop();
}
- EXPECT_EQ(num_browsers, BrowserList::GetBrowserCount(browser->profile()));
+ EXPECT_EQ(num_browsers, browser::GetBrowserCount(browser->profile()));
EXPECT_EQ(num_tabs, browser->tab_count());
int num_popups_seen = 0;
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc
index 0387368..f831c6b 100644
--- a/chrome/browser/first_run/first_run.cc
+++ b/chrome/browser/first_run/first_run.cc
@@ -28,6 +28,7 @@
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/global_error_service.h"
#include "chrome/browser/ui/global_error_service_factory.h"
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
@@ -497,7 +498,7 @@ void FirstRunBubbleLauncher::Observe(
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK_EQ(type, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME);
- Browser* browser = BrowserList::FindBrowserWithWebContents(
+ Browser* browser = browser::FindBrowserWithWebContents(
content::Source<content::WebContents>(source).ptr());
if (!browser || !browser->is_type_tabbed())
return;
diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc
index a53ade3..001f61d 100644
--- a/chrome/browser/geolocation/geolocation_browsertest.cc
+++ b/chrome/browser/geolocation/geolocation_browsertest.cc
@@ -16,7 +16,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
@@ -238,7 +238,7 @@ class GeolocationBrowserTest : public InProcessBrowserTest {
LOG(WARNING) << "before navigate";
if (options == INITIALIZATION_OFFTHERECORD) {
ui_test_utils::OpenURLOffTheRecord(browser()->profile(), current_url_);
- current_browser_ = BrowserList::FindTabbedBrowser(
+ current_browser_ = browser::FindTabbedBrowser(
browser()->profile()->GetOffTheRecordProfile(), false);
} else if (options == INITIALIZATION_NEWTAB) {
current_browser_ = browser();
diff --git a/chrome/browser/importer/importer_host.cc b/chrome/browser/importer/importer_host.cc
index bff8dfe..3b0a34c 100644
--- a/chrome/browser/importer/importer_host.cc
+++ b/chrome/browser/importer/importer_host.cc
@@ -20,7 +20,7 @@
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/simple_message_box.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
@@ -163,7 +163,7 @@ void ImporterHost::OnGoogleGAIACookieChecked(bool result) {
GURL url("https://accounts.google.com/ServiceLogin");
DCHECK(profile_);
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
if (browser)
browser->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED);
diff --git a/chrome/browser/intents/web_intents_util.cc b/chrome/browser/intents/web_intents_util.cc
index ea6fc22..848d11a 100644
--- a/chrome/browser/intents/web_intents_util.cc
+++ b/chrome/browser/intents/web_intents_util.cc
@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
diff --git a/chrome/browser/managed_mode.cc b/chrome/browser/managed_mode.cc
index fa4f303..12c579b 100644
--- a/chrome/browser/managed_mode.cc
+++ b/chrome/browser/managed_mode.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
#include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
diff --git a/chrome/browser/net/gaia/gaia_oauth_fetcher.cc b/chrome/browser/net/gaia/gaia_oauth_fetcher.cc
index c156bac..580bb6d 100644
--- a/chrome/browser/net/gaia/gaia_oauth_fetcher.cc
+++ b/chrome/browser/net/gaia/gaia_oauth_fetcher.cc
@@ -13,7 +13,8 @@
#include "base/string_util.h"
#include "chrome/browser/net/gaia/gaia_oauth_consumer.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/net/gaia/gaia_auth_fetcher.h"
@@ -24,6 +25,7 @@
#include "chrome/common/net/url_util.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
+#include "content/public/common/referrer.h"
#include "content/public/common/url_fetcher.h"
#include "grit/chromium_strings.h"
#include "net/base/load_flags.h"
@@ -311,7 +313,7 @@ void GaiaOAuthFetcher::StartGetOAuthToken() {
chrome::NOTIFICATION_COOKIE_CHANGED,
content::Source<Profile>(profile_));
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
DCHECK(browser);
OpenGetOAuthTokenURL(browser,
@@ -321,7 +323,7 @@ void GaiaOAuthFetcher::StartGetOAuthToken() {
WebKit::WebReferrerPolicyDefault),
NEW_POPUP,
content::PAGE_TRANSITION_AUTO_BOOKMARK);
- popup_ = BrowserList::GetLastActiveWithProfile(profile_);
+ popup_ = browser::FindLastActiveWithProfile(profile_);
DCHECK(popup_ && popup_ != browser);
registrar_.Add(this,
chrome::NOTIFICATION_BROWSER_CLOSING,
diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc
index 9fafe3c..03e0126 100644
--- a/chrome/browser/notifications/balloon_host.cc
+++ b/chrome/browser/notifications/balloon_host.cc
@@ -10,7 +10,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_preferences_util.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_view_type.h"
@@ -80,7 +80,7 @@ void BalloonHost::AddNewContents(WebContents* source,
WindowOpenDisposition disposition,
const gfx::Rect& initial_pos,
bool user_gesture) {
- Browser* browser = BrowserList::GetLastActiveWithProfile(
+ Browser* browser = browser::FindLastActiveWithProfile(
Profile::FromBrowserContext(new_contents->GetBrowserContext()));
if (!browser)
return;
diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc
index cf22a9a..ff35176 100644
--- a/chrome/browser/notifications/desktop_notification_service.cc
+++ b/chrome/browser/notifications/desktop_notification_service.cc
@@ -21,7 +21,8 @@
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/content_settings.h"
@@ -332,7 +333,7 @@ void DesktopNotificationService::RequestPermission(
WebContents* tab) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (!tab) {
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
if (browser)
tab = browser->GetSelectedWebContents();
}
diff --git a/chrome/browser/notifications/notification_options_menu_model.cc b/chrome/browser/notifications/notification_options_menu_model.cc
index 4a39595..33c1f00 100644
--- a/chrome/browser/notifications/notification_options_menu_model.cc
+++ b/chrome/browser/notifications/notification_options_menu_model.cc
@@ -18,7 +18,8 @@
#include "chrome/browser/notifications/notification_prefs_manager.h"
#include "chrome/browser/notifications/notification_ui_manager.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/content_settings_types.h"
#include "chrome/common/extensions/extension.h"
@@ -248,7 +249,7 @@ void NotificationOptionsMenuModel::ExecuteCommand(int command_id) {
}
case kOpenContentSettingsCommand: {
Browser* browser =
- BrowserList::GetLastActiveWithProfile(balloon_->profile());
+ browser::FindLastActiveWithProfile(balloon_->profile());
if (!browser) {
// It is possible that there is no browser window (e.g. when there are
// background pages, or for a chrome frame process on windows).
diff --git a/chrome/browser/omnibox_search_hint.cc b/chrome/browser/omnibox_search_hint.cc
index 8846f9d..72bd7c5 100644
--- a/chrome/browser/omnibox_search_hint.cc
+++ b/chrome/browser/omnibox_search_hint.cc
@@ -19,7 +19,8 @@
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/omnibox/location_bar.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
@@ -211,7 +212,7 @@ void OmniboxSearchHint::ShowInfoBar() {
}
void OmniboxSearchHint::ShowEnteringQuery() {
- LocationBar* location_bar = BrowserList::GetLastActiveWithProfile(
+ LocationBar* location_bar = browser::FindLastActiveWithProfile(
tab_->profile())->window()->GetLocationBar();
OmniboxView* omnibox_view = location_bar->GetLocationEntry();
location_bar->FocusLocation(true);
diff --git a/chrome/browser/popup_blocker_browsertest.cc b/chrome/browser/popup_blocker_browsertest.cc
index e794f77..43db42d 100644
--- a/chrome/browser/popup_blocker_browsertest.cc
+++ b/chrome/browser/popup_blocker_browsertest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,7 +9,7 @@
#include "base/path_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/in_process_browser_test.h"
@@ -34,7 +34,7 @@ IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, PopupBlockedPostBlank) {
// If the popup blocker blocked the blank post, there should be only one
// tab in only one browser window and the URL of current tab must be equal
// to the original URL.
- EXPECT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile()));
+ EXPECT_EQ(1u, browser::GetBrowserCount(browser()->profile()));
EXPECT_EQ(1, browser()->tab_count());
WebContents* cur_tab = browser()->GetSelectedWebContents();
ASSERT_TRUE(cur_tab);
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc
index cb9b660..85fb399 100644
--- a/chrome/browser/prerender/prerender_browsertest.cc
+++ b/chrome/browser/prerender/prerender_browsertest.cc
@@ -25,7 +25,7 @@
#include "chrome/browser/task_manager/task_manager.h"
#include "chrome/browser/task_manager/task_manager_browsertest_util.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_notification_types.h"
@@ -1025,7 +1025,7 @@ IN_PROC_BROWSER_TEST_F(
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderIncognito) {
Profile* normal_profile = current_browser()->profile();
ui_test_utils::OpenURLOffTheRecord(normal_profile, GURL("about:blank"));
- set_browser(BrowserList::FindBrowserWithProfile(
+ set_browser(browser::FindBrowserWithProfile(
normal_profile->GetOffTheRecordProfile()));
// Increase memory expectations on the incognito PrerenderManager.
IncreasePrerenderMemory();
diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc
index e29e857..9f70bfe 100644
--- a/chrome/browser/prerender/prerender_contents.cc
+++ b/chrome/browser/prerender/prerender_contents.cc
@@ -17,7 +17,7 @@
#include "chrome/browser/prerender/prerender_tracker.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/icon_messages.h"
@@ -296,7 +296,7 @@ void PrerenderContents::StartPrerendering(
// can't get the size, and |default_tab_bounds| will be set to the right
// value.
if (Browser* active_browser =
- BrowserList::GetLastActiveWithProfile(profile_)) {
+ browser::FindLastActiveWithProfile(profile_)) {
if (WebContents* active_web_contents = active_browser->GetWebContentsAt(
active_browser->active_index())) {
gfx::Rect container_bounds;
diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
index d4a0736..f41c1e0 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
+++ b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
@@ -19,7 +19,7 @@
#include "chrome/browser/service/service_process_control.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/common/net/gaia/gaia_auth_fetcher.h"
@@ -62,7 +62,7 @@ CloudPrintSetupFlow* CloudPrintSetupFlow::OpenDialog(
const base::WeakPtr<Delegate>& delegate,
gfx::NativeWindow parent_window) {
DCHECK(profile);
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
+ Browser* browser = browser::FindLastActiveWithProfile(profile);
// Set the arguments for showing the gaia login page.
DictionaryValue args;
args.SetString("user", "");
diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc
index d35d915..ccec885 100644
--- a/chrome/browser/printing/print_dialog_cloud.cc
+++ b/chrome/browser/printing/print_dialog_cloud.cc
@@ -20,6 +20,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser_dialogs.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
@@ -665,7 +667,7 @@ void CreateDialogImpl(const FilePath& path_to_file,
g_browser_process->profile_manager()->GetLoadedProfiles();
DCHECK_GT(loaded_profiles.size(), 0U);
profile = loaded_profiles[0];
- browser = BrowserList::GetLastActiveWithProfile(profile);
+ browser = browser::FindLastActiveWithProfile(profile);
}
DCHECK(profile);
PrefService* pref_service = profile->GetPrefs();
diff --git a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc
index be481b4..85f0e21 100644
--- a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc
+++ b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc
@@ -16,6 +16,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/printing/cloud_print/cloud_print_url.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
diff --git a/chrome/browser/printing/print_dialog_gtk.cc b/chrome/browser/printing/print_dialog_gtk.cc
index efaaf24..e9309a0 100644
--- a/chrome/browser/printing/print_dialog_gtk.cc
+++ b/chrome/browser/printing/print_dialog_gtk.cc
@@ -18,6 +18,8 @@
#include "base/logging.h"
#include "base/message_loop_proxy.h"
#include "base/utf_string_conversions.h"
+#include "base/values.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "printing/metafile.h"
@@ -152,7 +154,7 @@ void PrintDialogGtk::UseDefaultSettings() {
InitPrintSettings(ranges_vector, &settings);
}
-bool PrintDialogGtk::UpdateSettings(const DictionaryValue& job_settings,
+bool PrintDialogGtk::UpdateSettings(const base::DictionaryValue& job_settings,
const printing::PageRanges& ranges,
printing::PrintSettings* settings) {
bool collate;
diff --git a/chrome/browser/printing/print_preview_tab_controller.cc b/chrome/browser/printing/print_preview_tab_controller.cc
index c07781c..30d0c1e 100644
--- a/chrome/browser/printing/print_preview_tab_controller.cc
+++ b/chrome/browser/printing/print_preview_tab_controller.cc
@@ -16,7 +16,7 @@
#include "chrome/browser/printing/print_view_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
@@ -183,7 +183,7 @@ void PrintPreviewWebContentDelegate::HandleKeyboardEvent(
// Disabled on Mac due to http://crbug.com/112173.
#if !defined(OS_MACOSX)
Browser* current_browser =
- BrowserList::FindBrowserWithWebContents(tab_->web_contents());
+ browser::FindBrowserWithWebContents(tab_->web_contents());
if (!current_browser)
return;
current_browser->window()->HandleKeyboardEvent(event);
@@ -410,7 +410,7 @@ TabContentsWrapper* PrintPreviewTabController::CreatePrintPreviewTab(
AutoReset<bool> auto_reset(&is_creating_print_preview_tab_, true);
WebContents* web_contents = initiator_tab->web_contents();
Browser* current_browser =
- BrowserList::FindBrowserWithWebContents(web_contents);
+ browser::FindBrowserWithWebContents(web_contents);
if (!current_browser) {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeFrame)) {
Profile* profile =
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index b6b4ede..8ca460e 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -28,6 +28,7 @@
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
@@ -38,9 +39,6 @@
#include "chrome/common/logging_chrome.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
-#if defined(OS_WIN)
-#include "chrome/installer/util/browser_distribution.h"
-#endif
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/user_metrics.h"
@@ -51,6 +49,10 @@
#include "net/url_request/url_request_job.h"
#include "ui/base/l10n/l10n_util.h"
+#if defined(OS_WIN)
+#include "chrome/installer/util/browser_distribution.h"
+#endif
+
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/cryptohome_library.h"
@@ -476,7 +478,7 @@ void ProfileManager::FindOrCreateNewWindowForProfile(
DCHECK(profile);
if (!always_create) {
- Browser* browser = BrowserList::FindTabbedBrowser(profile, false);
+ Browser* browser = browser::FindTabbedBrowser(profile, false);
if (browser) {
browser->window()->Activate();
return;
diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc
index 2644176..e2f9725 100644
--- a/chrome/browser/profiles/profile_manager_unittest.cc
+++ b/chrome/browser/profiles/profile_manager_unittest.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
diff --git a/chrome/browser/protector/settings_change_global_error.cc b/chrome/browser/protector/settings_change_global_error.cc
index 9a18a04..e7ab716 100644
--- a/chrome/browser/protector/settings_change_global_error.cc
+++ b/chrome/browser/protector/settings_change_global_error.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/protector/base_setting_change.h"
#include "chrome/browser/protector/settings_change_global_error_delegate.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/global_error_service.h"
#include "chrome/browser/ui/global_error_service_factory.h"
@@ -99,7 +100,7 @@ void SettingsChangeGlobalError::RemoveFromProfile() {
void SettingsChangeGlobalError::ShowBubble() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(profile_);
- Browser* browser = BrowserList::FindTabbedBrowser(
+ Browser* browser = browser::FindTabbedBrowser(
profile_,
// match incognito
true);
diff --git a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm
index 805fdee..3db2a64 100644
--- a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm
+++ b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm
@@ -11,7 +11,7 @@
#include "chrome/browser/debugger/devtools_window.h"
#include "chrome/browser/spellchecker/spellcheck_platform_mac.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#import "chrome/browser/ui/cocoa/history_overlay_controller.h"
#import "chrome/browser/ui/cocoa/view_id_util.h"
#include "chrome/common/spellcheck_messages.h"
@@ -177,7 +177,7 @@ class SpellCheckRenderViewObserver : public content::RenderViewHostObserver {
if (gotUnhandledWheelEvent_ &&
[NSEvent isSwipeTrackingFromScrollEventsEnabled] &&
[theEvent phase] == NSEventPhaseChanged) {
- Browser* browser = BrowserList::FindBrowserWithWindow([theEvent window]);
+ Browser* browser = browser::FindBrowserWithWindow([theEvent window]);
totalScrollDelta_.width += [theEvent scrollingDeltaX];
totalScrollDelta_.height += [theEvent scrollingDeltaY];
@@ -258,7 +258,7 @@ class SpellCheckRenderViewObserver : public content::RenderViewHostObserver {
// |gestureAmount| obeys -[NSEvent isDirectionInvertedFromDevice]
// automatically.
- Browser* browser = BrowserList::FindBrowserWithWindow(
+ Browser* browser = browser::FindBrowserWithWindow(
historyOverlay.view.window);
if (ended && browser) {
if (goForward)
diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc
index c62bc4a..3033bd6 100644
--- a/chrome/browser/safe_browsing/download_protection_service.cc
+++ b/chrome/browser/safe_browsing/download_protection_service.cc
@@ -19,6 +19,7 @@
#include "base/time.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/safe_browsing/signature_util.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/safe_browsing/csd.pb.h"
#include "chrome/common/url_constants.h"
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index e3262ba..ffea378 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -25,7 +25,7 @@
#include "chrome/browser/sessions/session_service_factory.h"
#include "chrome/browser/sessions/session_types.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
@@ -261,7 +261,7 @@ void TabLoader::LoadNextTab() {
tab->LoadIfNecessary();
if (tab->GetWebContents()) {
int tab_index;
- Browser* browser = Browser::GetBrowserForController(tab, &tab_index);
+ Browser* browser = browser::FindBrowserForController(tab, &tab_index);
if (browser && browser->active_index() != tab_index) {
// By default tabs are marked as visible. As only the active tab is
// visible we need to explicitly tell non-active tabs they are hidden.
@@ -574,7 +574,7 @@ class SessionRestoreImpl : public content::NotificationObserver {
DCHECK(browser_ == NULL);
Browser* browser = use_new_window ?
Browser::Create(profile_) :
- BrowserList::GetLastActiveWithProfile(profile_);
+ browser::FindLastActiveWithProfile(profile_);
RecordAppLaunchForTab(browser, tab, selected_index);
@@ -737,7 +737,7 @@ class SessionRestoreImpl : public content::NotificationObserver {
StartTabCreation();
Browser* current_browser =
- browser_ ? browser_ : BrowserList::GetLastActiveWithProfile(profile_);
+ browser_ ? browser_ : browser::FindLastActiveWithProfile(profile_);
// After the for loop this contains the last TABBED_BROWSER. Is null if no
// tabbed browsers exist.
Browser* last_browser = NULL;
diff --git a/chrome/browser/sessions/tab_restore_service_delegate.h b/chrome/browser/sessions/tab_restore_service_delegate.h
index 5c7182f..867891c 100644
--- a/chrome/browser/sessions/tab_restore_service_delegate.h
+++ b/chrome/browser/sessions/tab_restore_service_delegate.h
@@ -64,12 +64,12 @@ class TabRestoreServiceDelegate {
static TabRestoreServiceDelegate* Create(Profile* profile,
const std::string& app_name);
- // see BrowserList::GetBrowserForController
+ // see browser::FindBrowserForController
static TabRestoreServiceDelegate* FindDelegateForController(
const content::NavigationController* controller,
int* index);
- // see BrowserList::FindBrowserWithID
+ // see browser::FindBrowserWithID
static TabRestoreServiceDelegate* FindDelegateWithID(
SessionID::id_type desired_id);
diff --git a/chrome/browser/speech/speech_recognition_bubble_gtk.cc b/chrome/browser/speech/speech_recognition_bubble_gtk.cc
index 7d98671..41fa036 100644
--- a/chrome/browser/speech/speech_recognition_bubble_gtk.cc
+++ b/chrome/browser/speech/speech_recognition_bubble_gtk.cc
@@ -7,6 +7,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/gtk/browser_toolbar_gtk.h"
#include "chrome/browser/ui/gtk/browser_window_gtk.h"
#include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
@@ -186,7 +187,7 @@ void SpeechRecognitionBubbleGtk::Show() {
target_rect.y() > container_rect.height()) {
// Target is not in screen view, so point to wrench.
Browser* browser =
- Browser::GetOrCreateTabbedBrowser(profile);
+ browser::FindOrCreateTabbedBrowser(profile);
BrowserWindowGtk* browser_window =
BrowserWindowGtk::GetBrowserWindowForNativeWindow(
browser->window()->GetNativeHandle());
diff --git a/chrome/browser/speech/speech_recognition_bubble_views.cc b/chrome/browser/speech/speech_recognition_bubble_views.cc
index fad7fff..913b4ea 100644
--- a/chrome/browser/speech/speech_recognition_bubble_views.cc
+++ b/chrome/browser/speech/speech_recognition_bubble_views.cc
@@ -8,6 +8,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/location_bar/location_icon_view.h"
#include "chrome/browser/ui/views/toolbar_view.h"
@@ -358,7 +359,7 @@ SpeechRecognitionBubbleImpl::~SpeechRecognitionBubbleImpl() {
void SpeechRecognitionBubbleImpl::Show() {
if (!bubble_) {
// Anchor to the location icon view, in case |element_rect| is offscreen.
- Browser* browser = Browser::GetOrCreateTabbedBrowser(
+ Browser* browser = browser::FindOrCreateTabbedBrowser(
Profile::FromBrowserContext(GetWebContents()->GetBrowserContext()));
BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser);
views::View* icon = browser_view->GetLocationBarView() ?
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index 54fdbf8..59d76443 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -47,6 +47,7 @@
#include "chrome/browser/translate/translate_prefs.h"
#include "chrome/browser/translate/translate_tab_helper.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_constants.h"
@@ -1690,7 +1691,7 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) {
case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: {
NavigationController* controller = &source_web_contents_->GetController();
NavigationEntry* nav_entry = controller->GetActiveEntry();
- Browser* browser = Browser::GetBrowserForController(controller, NULL);
+ Browser* browser = browser::FindBrowserForController(controller, NULL);
browser->ShowPageInfo(source_web_contents_, nav_entry->GetURL(),
nav_entry->GetSSL(), true);
break;
@@ -1732,7 +1733,7 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) {
break;
case IDC_CONTENT_CONTEXT_VIEWFRAMEINFO: {
- Browser* browser = Browser::GetBrowserForController(
+ Browser* browser = browser::FindBrowserForController(
&source_web_contents_->GetController(), NULL);
browser->ShowPageInfo(source_web_contents_, params_.frame_url,
params_.security_info, false);
diff --git a/chrome/browser/tab_contents/spelling_bubble_model.cc b/chrome/browser/tab_contents/spelling_bubble_model.cc
index b9c9ae3..2dfcd6a 100644
--- a/chrome/browser/tab_contents/spelling_bubble_model.cc
+++ b/chrome/browser/tab_contents/spelling_bubble_model.cc
@@ -7,7 +7,8 @@
#include "base/logging.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "googleurl/src/gurl.h"
@@ -60,7 +61,7 @@ string16 SpellingBubbleModel::GetLinkText() const {
}
void SpellingBubbleModel::LinkClicked() {
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
OpenURLParams params(
GURL(chrome::kPrivacyLearnMoreURL), Referrer(), NEW_FOREGROUND_TAB,
content::PAGE_TRANSITION_LINK, false);
diff --git a/chrome/browser/tab_contents/web_drag_bookmark_handler_aura.cc b/chrome/browser/tab_contents/web_drag_bookmark_handler_aura.cc
index 35de5a5..ef9f12e 100644
--- a/chrome/browser/tab_contents/web_drag_bookmark_handler_aura.cc
+++ b/chrome/browser/tab_contents/web_drag_bookmark_handler_aura.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/bookmarks/bookmark_node_data.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
@@ -68,7 +69,7 @@ void WebDragBookmarkHandlerAura::OnDrop() {
}
// Focus the target browser.
- Browser* browser = Browser::GetBrowserForController(
+ Browser* browser = browser::FindBrowserForController(
&tab_->web_contents()->GetController(), NULL);
if (browser)
browser->window()->Show();
diff --git a/chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.cc b/chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.cc
index c80bb06..8f075c4 100644
--- a/chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.cc
+++ b/chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.cc
@@ -1,10 +1,11 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h"
#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
@@ -83,7 +84,7 @@ void WebDragBookmarkHandlerGtk::OnDrop() {
}
// Focus the target browser.
- Browser* browser = Browser::GetBrowserForController(
+ Browser* browser = browser::FindBrowserForController(
&tab_->web_contents()->GetController(), NULL);
if (browser)
browser->window()->Show();
diff --git a/chrome/browser/tab_contents/web_drag_bookmark_handler_mac.mm b/chrome/browser/tab_contents/web_drag_bookmark_handler_mac.mm
index 91f461b..e0ed038 100644
--- a/chrome/browser/tab_contents/web_drag_bookmark_handler_mac.mm
+++ b/chrome/browser/tab_contents/web_drag_bookmark_handler_mac.mm
@@ -1,10 +1,11 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/tab_contents/web_drag_bookmark_handler_mac.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
@@ -50,7 +51,7 @@ void WebDragBookmarkHandlerMac::OnDrop() {
}
// Focus the target browser.
- Browser* browser = Browser::GetBrowserForController(
+ Browser* browser = browser::FindBrowserForController(
&tab_->web_contents()->GetController(), NULL);
if (browser)
browser->window()->Show();
diff --git a/chrome/browser/tab_contents/web_drag_bookmark_handler_win.cc b/chrome/browser/tab_contents/web_drag_bookmark_handler_win.cc
index c74452c..fab2241 100644
--- a/chrome/browser/tab_contents/web_drag_bookmark_handler_win.cc
+++ b/chrome/browser/tab_contents/web_drag_bookmark_handler_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#include "chrome/browser/bookmarks/bookmark_node_data.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
@@ -74,7 +75,7 @@ void WebDragBookmarkHandlerWin::OnDrop(IDataObject* data_object) {
}
// Focus the target browser.
- Browser* browser = Browser::GetBrowserForController(
+ Browser* browser = browser::FindBrowserForController(
&tab_->web_contents()->GetController(), NULL);
if (browser)
browser->window()->Show();
diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc
index 5ba8f20..a5030cd 100644
--- a/chrome/browser/task_manager/task_manager.cc
+++ b/chrome/browser/task_manager/task_manager.cc
@@ -23,6 +23,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/task_manager/task_manager_resource_providers.h"
#include "chrome/browser/task_manager/task_manager_worker_resource_provider.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc
index d68c9df..c32082c 100644
--- a/chrome/browser/task_manager/task_manager_resource_providers.cc
+++ b/chrome/browser/task_manager/task_manager_resource_providers.cc
@@ -34,6 +34,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/tab_contents/background_contents.h"
#include "chrome/browser/tab_contents/tab_util.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_notification_types.h"
diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc
index 75ca905..21565cf 100644
--- a/chrome/browser/translate/translate_manager.cc
+++ b/chrome/browser/translate/translate_manager.cc
@@ -26,7 +26,7 @@
#include "chrome/browser/translate/translate_prefs.h"
#include "chrome/browser/translate/translate_tab_helper.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_notification_types.h"
@@ -676,7 +676,7 @@ void TranslateManager::ReportLanguageDetectionError(WebContents* web_contents) {
// Open that URL in a new tab so that the user can tell us more.
Profile* profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
+ Browser* browser = browser::FindLastActiveWithProfile(profile);
if (!browser) {
NOTREACHED();
return;
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index b85f8a6..f596aa1 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -102,6 +102,7 @@
#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
#include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h"
#include "chrome/browser/ui/browser_dialogs.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_tab_restore_service_delegate.h"
@@ -493,7 +494,7 @@ Browser::~Browser() {
tab_restore_service->BrowserClosed(tab_restore_service_delegate());
#if !defined(OS_MACOSX)
- if (!BrowserList::HasBrowserWithProfile(profile_)) {
+ if (!browser::GetBrowserCount(profile_)) {
// We're the last browser window with this profile. We need to nuke the
// TabRestoreService, which will start the shutdown of the
// NavigationControllers and allow for proper shutdown. If we don't do this
@@ -680,7 +681,7 @@ void Browser::OpenWindowWithRestoredTabs(Profile* profile) {
// static
void Browser::OpenURLOffTheRecord(Profile* profile, const GURL& url) {
- Browser* browser = GetOrCreateTabbedBrowser(
+ Browser* browser = browser::FindOrCreateTabbedBrowser(
profile->GetOffTheRecordProfile());
browser->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_LINK);
browser->window()->Show();
@@ -854,7 +855,7 @@ WebContents* Browser::OpenApplicationTab(Profile* profile,
const Extension* extension,
const GURL& override_url,
WindowOpenDisposition disposition) {
- Browser* browser = BrowserList::FindTabbedBrowser(profile, false);
+ Browser* browser = browser::FindTabbedBrowser(profile, false);
WebContents* contents = NULL;
if (!browser) {
// No browser for this profile, need to open a new one.
@@ -1680,7 +1681,7 @@ void Browser::NewTab() {
AddBlankTab(true);
GetSelectedWebContents()->GetView()->RestoreFocus();
} else {
- Browser* b = GetOrCreateTabbedBrowser(profile_);
+ Browser* b = browser::FindOrCreateTabbedBrowser(profile_);
b->AddBlankTab(true);
b->window()->Show();
// The call to AddBlankTab above did not set the focus to the tab as its
@@ -2500,36 +2501,6 @@ bool Browser::RunUnloadEventsHelper(WebContents* contents) {
}
// static
-Browser* Browser::GetBrowserForController(
- const NavigationController* controller, int* index_result) {
- BrowserList::const_iterator it;
- for (it = BrowserList::begin(); it != BrowserList::end(); ++it) {
- int index = (*it)->GetIndexOfController(controller);
- if (index != TabStripModel::kNoTab) {
- if (index_result)
- *index_result = index;
- return *it;
- }
- }
-
- return NULL;
-}
-
-// static
-Browser* Browser::GetTabbedBrowser(Profile* profile,
- bool match_original_profiles) {
- return BrowserList::FindTabbedBrowser(profile, match_original_profiles);
-}
-
-// static
-Browser* Browser::GetOrCreateTabbedBrowser(Profile* profile) {
- Browser* browser = GetTabbedBrowser(profile, false);
- if (!browser)
- browser = Browser::Create(profile);
- return browser;
-}
-
-// static
void Browser::RunFileChooserHelper(
WebContents* tab, const content::FileChooserParams& params) {
Profile* profile =
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index 56cb971..16b97ed 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -271,7 +271,7 @@ class Browser : public TabStripModelDelegate,
// Browser Creation Helpers /////////////////////////////////////////////////
// Opens a new window with the default blank tab.
- static void NewEmptyWindow(Profile* profile);
+ static void NewEmptyWindow(Profile* profile);
// Opens a new window with the default blank tab. This bypasses metrics and
// various internal bookkeeping; NewEmptyWindow (above) is preferred.
@@ -680,27 +680,6 @@ class Browser : public TabStripModelDelegate,
// Helper function to run unload listeners on a WebContents.
static bool RunUnloadEventsHelper(content::WebContents* contents);
- // Returns the Browser which contains the tab with the given
- // NavigationController, also filling in |index| (if valid) with the tab's
- // index in the tab strip.
- // Returns NULL if not found.
- // This call is O(N) in the number of tabs.
- static Browser* GetBrowserForController(
- const content::NavigationController* controller, int* index);
-
- // Retrieve the last active tabbed browser with a profile matching |profile|.
- // If |match_original_profiles| is true, matching is done based on the
- // original profile, eg profile->GetOriginalProfile() ==
- // browser->profile()->GetOriginalProfile(). This has the effect of matching
- // against both non-incognito and incognito profiles. If
- // |match_original_profiles| is false, only an exact match may be returned.
- static Browser* GetTabbedBrowser(Profile* profile,
- bool match_original_profiles);
-
- // Retrieve the last active tabbed browser with a profile matching |profile|.
- // Creates a new Browser if none are available.
- static Browser* GetOrCreateTabbedBrowser(Profile* profile);
-
// Helper function to display the file selection dialog.
static void RunFileChooserHelper(
content::WebContents* tab, const content::FileChooserParams& params);
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index 6b0127a..02a51c3 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -28,6 +28,7 @@
#include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h"
#include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_window.h"
@@ -769,7 +770,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) {
WebContents* app_tab = browser()->AddSelectedTabWithURL(
http_url, content::PAGE_TRANSITION_TYPED)->web_contents();
ASSERT_EQ(2, browser()->tab_count());
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile()));
// Normal tabs should accept load drops.
EXPECT_TRUE(initial_tab->GetMutableRendererPrefs()->can_accept_load_drops);
@@ -779,7 +780,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) {
browser()->ConvertContentsToApplication(app_tab);
// The launch should have created a new browser.
- ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile()));
// Find the new browser.
Browser* app_browser = NULL;
@@ -907,7 +908,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, AppIdSwitch) {
// Check that the new browser has an app name.
// The launch should have created a new browser.
- ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile()));
// Find the new browser.
Browser* new_browser = NULL;
@@ -1259,7 +1260,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, RestorePinnedTabs) {
launch.ProcessStartupURLs(std::vector<GURL>());
// The launch should have created a new browser.
- ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile()));
// Find the new browser.
Browser* new_browser = NULL;
@@ -1337,7 +1338,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OpenAppWindowLikeNtp) {
EXPECT_EQ(extension_app->GetFullLaunchURL(), app_window->GetURL());
// The launch should have created a new browser.
- ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile()));
// Find the new browser.
Browser* new_browser = NULL;
diff --git a/chrome/browser/ui/browser_finder.cc b/chrome/browser/ui/browser_finder.cc
new file mode 100644
index 0000000..16923b3
--- /dev/null
+++ b/chrome/browser/ui/browser_finder.cc
@@ -0,0 +1,198 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/browser_finder.h"
+
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "content/public/browser/navigation_controller.h"
+
+using content::WebContents;
+
+namespace browser {
+
+namespace {
+
+// Type used to indicate to match anything.
+const int kMatchAny = 0;
+
+// See BrowserMatches for details.
+const int kMatchOriginalProfile = 1 << 0;
+const int kMatchCanSupportWindowFeature = 1 << 1;
+const int kMatchTabbed = 1 << 2;
+
+// Returns true if the specified |browser| matches the specified arguments.
+// |match_types| is a bitmask dictating what parameters to match:
+// . If it contains kMatchOriginalProfile then the original profile of the
+// browser must match |profile->GetOriginalProfile()|. This is used to match
+// incognito windows.
+// . If it contains kMatchCanSupportWindowFeature
+// |CanSupportWindowFeature(window_feature)| must return true.
+// . If it contains kMatchTabbed, the browser must be a tabbed browser.
+bool BrowserMatches(Browser* browser,
+ Profile* profile,
+ Browser::WindowFeature window_feature,
+ uint32 match_types) {
+ if (match_types & kMatchCanSupportWindowFeature &&
+ !browser->CanSupportWindowFeature(window_feature)) {
+ return false;
+ }
+
+ if (match_types & kMatchOriginalProfile) {
+ if (browser->profile()->GetOriginalProfile() !=
+ profile->GetOriginalProfile())
+ return false;
+ } else if (browser->profile() != profile) {
+ return false;
+ }
+
+ if (match_types & kMatchTabbed)
+ return browser->is_type_tabbed();
+
+ return true;
+}
+
+// Returns the first browser in the specified iterator that returns true from
+// |BrowserMatches|, or null if no browsers match the arguments. See
+// |BrowserMatches| for details on the arguments.
+template <class T>
+Browser* FindBrowserMatching(const T& begin,
+ const T& end,
+ Profile* profile,
+ Browser::WindowFeature window_feature,
+ uint32 match_types) {
+ for (T i = begin; i != end; ++i) {
+ if (BrowserMatches(*i, profile, window_feature, match_types))
+ return *i;
+ }
+ return NULL;
+}
+
+Browser* FindBrowserWithTabbedOrAnyType(Profile* profile,
+ bool match_tabbed,
+ bool match_original_profiles) {
+ uint32 match_types = kMatchAny;
+ if (match_tabbed)
+ match_types |= kMatchTabbed;
+ if (match_original_profiles)
+ match_types |= kMatchOriginalProfile;
+ Browser* browser = FindBrowserMatching(
+ BrowserList::begin_last_active(), BrowserList::end_last_active(),
+ profile, Browser::FEATURE_NONE, match_types);
+ // Fall back to a forward scan of all Browsers if no active one was found.
+ return browser ? browser :
+ FindBrowserMatching(BrowserList::begin(), BrowserList::end(), profile,
+ Browser::FEATURE_NONE, match_types);
+}
+
+size_t GetBrowserCountImpl(Profile* profile, uint32 match_types) {
+ size_t count = 0;
+ for (BrowserList::const_iterator i = BrowserList::begin();
+ i != BrowserList::end(); ++i) {
+ if (BrowserMatches(*i, profile, Browser::FEATURE_NONE, match_types))
+ count++;
+ }
+ return count;
+}
+
+} // namespace
+
+Browser* FindTabbedBrowser(Profile* profile, bool match_original_profiles) {
+ return FindBrowserWithTabbedOrAnyType(profile,
+ true,
+ match_original_profiles);
+}
+
+Browser* FindOrCreateTabbedBrowser(Profile* profile) {
+ Browser* browser = FindTabbedBrowser(profile, false);
+ if (!browser)
+ browser = Browser::Create(profile);
+ return browser;
+}
+
+Browser* FindAnyBrowser(Profile* profile, bool match_original_profiles) {
+ return FindBrowserWithTabbedOrAnyType(profile,
+ false,
+ match_original_profiles);
+}
+
+Browser* FindBrowserWithFeature(Profile* profile,
+ Browser::WindowFeature feature) {
+ Browser* browser = FindBrowserMatching(
+ BrowserList::begin_last_active(), BrowserList::end_last_active(),
+ profile, feature, kMatchCanSupportWindowFeature);
+ // Fall back to a forward scan of all Browsers if no active one was found.
+ return browser ? browser :
+ FindBrowserMatching(BrowserList::begin(), BrowserList::end(), profile,
+ feature, kMatchCanSupportWindowFeature);
+}
+
+Browser* FindBrowserWithProfile(Profile* profile) {
+ return FindAnyBrowser(profile, false);
+}
+
+Browser* FindBrowserWithID(SessionID::id_type desired_id) {
+ for (BrowserList::const_iterator i = BrowserList::begin();
+ i != BrowserList::end(); ++i) {
+ if ((*i)->session_id().id() == desired_id)
+ return *i;
+ }
+ return NULL;
+}
+
+Browser* FindBrowserWithWindow(gfx::NativeWindow window) {
+ for (BrowserList::const_iterator it = BrowserList::begin();
+ it != BrowserList::end(); ++it) {
+ Browser* browser = *it;
+ if (browser->window() && browser->window()->GetNativeHandle() == window)
+ return browser;
+ }
+ return NULL;
+}
+
+Browser* FindBrowserWithWebContents(WebContents* web_contents) {
+ DCHECK(web_contents);
+ for (TabContentsIterator it; !it.done(); ++it) {
+ if (it->web_contents() == web_contents)
+ return it.browser();
+ }
+ return NULL;
+}
+
+Browser* FindBrowserForController(
+ const content::NavigationController* controller,
+ int* index_result) {
+ for (BrowserList::const_iterator it = BrowserList::begin();
+ it != BrowserList::end(); ++it) {
+ int index = (*it)->GetIndexOfController(controller);
+ if (index != TabStripModel::kNoTab) {
+ if (index_result)
+ *index_result = index;
+ return *it;
+ }
+ }
+ return NULL;
+}
+
+
+Browser* FindLastActiveWithProfile(Profile* profile) {
+ // We are only interested in last active browsers, so we don't fall back to
+ // all browsers like FindBrowserWith* do.
+ return FindBrowserMatching(
+ BrowserList::begin_last_active(), BrowserList::end_last_active(), profile,
+ Browser::FEATURE_NONE, kMatchAny);
+}
+
+size_t GetBrowserCount(Profile* profile) {
+ return GetBrowserCountImpl(profile, kMatchAny);
+}
+
+size_t GetTabbedBrowserCount(Profile* profile) {
+ return GetBrowserCountImpl(profile, kMatchTabbed);
+}
+
+} // namespace browser
diff --git a/chrome/browser/ui/browser_finder.h b/chrome/browser/ui/browser_finder.h
new file mode 100644
index 0000000..e399207
--- /dev/null
+++ b/chrome/browser/ui/browser_finder.h
@@ -0,0 +1,85 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_BROWSER_FINDER_H_
+#define CHROME_BROWSER_UI_BROWSER_FINDER_H_
+#pragma once
+
+#include "chrome/browser/ui/browser.h"
+#include "ui/gfx/native_widget_types.h"
+
+class Profile;
+
+namespace contents {
+class NavigationController;
+class WebContents;
+}
+
+// Collection of functions to find Browsers based on various criteria.
+
+namespace browser {
+
+// Retrieve the last active tabbed browser with a profile matching |profile|.
+// If |match_original_profiles| is true, matching is done based on the
+// original profile, eg profile->GetOriginalProfile() ==
+// browser->profile()->GetOriginalProfile(). This has the effect of matching
+// against both non-incognito and incognito profiles. If
+// |match_original_profiles| is false, only an exact match may be returned.
+Browser* FindTabbedBrowser(Profile* profile, bool match_original_profiles);
+
+// Returns the first tabbed browser matching |profile|. If there is no tabbed
+// browser a new one is created and returned. If a new browser is created it is
+// not made visible.
+Browser* FindOrCreateTabbedBrowser(Profile* profile);
+
+// Find an existing browser window with any type. See comment above for
+// additional information.
+Browser* FindAnyBrowser(Profile* profile, bool match_original_profiles);
+
+// Find an existing browser window that can provide the specified type (this
+// uses Browser::CanSupportsWindowFeature, not
+// Browser::SupportsWindowFeature). This searches in the order of last
+// activation. Only browsers that have been active can be returned. Returns
+// NULL if no such browser currently exists.
+Browser* FindBrowserWithFeature(Profile* profile,
+ Browser::WindowFeature feature);
+
+// Find an existing browser window with the provided profile. Searches in the
+// order of last activation. Only browsers that have been active can be
+// returned. Returns NULL if no such browser currently exists.
+Browser* FindBrowserWithProfile(Profile* profile);
+
+// Find an existing browser with the provided ID. Returns NULL if no such
+// browser currently exists.
+Browser* FindBrowserWithID(SessionID::id_type desired_id);
+
+// Find the browser represented by |window| or NULL if not found.
+Browser* FindBrowserWithWindow(gfx::NativeWindow window);
+
+// Find the browser containing |web_contents| or NULL if none is found.
+// |web_contents| must not be NULL.
+Browser* FindBrowserWithWebContents(content::WebContents* web_contents);
+
+// Returns the Browser which contains the tab with the given
+// NavigationController, also filling in |index| (if valid) with the tab's index
+// in the tab strip. Returns NULL if not found. This call is O(N) in the
+// number of tabs.
+Browser* FindBrowserForController(
+ const content::NavigationController* controller,
+ int* index);
+
+// Identical in behavior to BrowserList::GetLastActive(), except that the most
+// recently open browser owned by |profile| is returned. If none exist, returns
+// NULL. WARNING: see warnings in BrowserList::GetLastActive().
+Browser* FindLastActiveWithProfile(Profile* profile);
+
+// Returns the number of browsers with the Profile |profile|.
+size_t GetBrowserCount(Profile* profile);
+
+// Returns the number of tabbed browsers with the Profile |profile|.
+size_t GetTabbedBrowserCount(Profile* profile);
+
+} // namespace browser
+
+#endif // CHROME_BROWSER_UI_BROWSER_FINDER_H_
diff --git a/chrome/browser/ui/browser_list.cc b/chrome/browser/ui/browser_list.cc
index fd9eead..f87f4bc 100644
--- a/chrome/browser/ui/browser_list.cc
+++ b/chrome/browser/ui/browser_list.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/printing/background_printing_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_notification_types.h"
@@ -115,14 +116,6 @@ class BrowserActivityObserver : public content::NotificationObserver {
BrowserActivityObserver* activity_observer = NULL;
-// Type used to indicate to match anything.
-const int kMatchAny = 0;
-
-// See BrowserMatches for details.
-const int kMatchOriginalProfile = 1 << 0;
-const int kMatchCanSupportWindowFeature = 1 << 1;
-const int kMatchTabbed = 1 << 2;
-
static BrowserList::BrowserVector& browsers() {
CR_DEFINE_STATIC_LOCAL(BrowserList::BrowserVector, browser_vector, ());
return browser_vector;
@@ -139,70 +132,6 @@ static ObserverList<BrowserList::Observer>& observers() {
return observer_vector;
}
-// Returns true if the specified |browser| matches the specified arguments.
-// |match_types| is a bitmask dictating what parameters to match:
-// . If it contains kMatchOriginalProfile then the original profile of the
-// browser must match |profile->GetOriginalProfile()|. This is used to match
-// incognito windows.
-// . If it contains kMatchCanSupportWindowFeature
-// |CanSupportWindowFeature(window_feature)| must return true.
-// . If it contains kMatchTabbed, the browser must be a tabbed browser.
-bool BrowserMatches(Browser* browser,
- Profile* profile,
- Browser::WindowFeature window_feature,
- uint32 match_types) {
- if (match_types & kMatchCanSupportWindowFeature &&
- !browser->CanSupportWindowFeature(window_feature)) {
- return false;
- }
-
- if (match_types & kMatchOriginalProfile) {
- if (browser->profile()->GetOriginalProfile() !=
- profile->GetOriginalProfile())
- return false;
- } else if (browser->profile() != profile) {
- return false;
- }
-
- if (match_types & kMatchTabbed)
- return browser->is_type_tabbed();
-
- return true;
-}
-
-// Returns the first browser in the specified iterator that returns true from
-// |BrowserMatches|, or null if no browsers match the arguments. See
-// |BrowserMatches| for details on the arguments.
-template <class T>
-Browser* FindBrowserMatching(const T& begin,
- const T& end,
- Profile* profile,
- Browser::WindowFeature window_feature,
- uint32 match_types) {
- for (T i = begin; i != end; ++i) {
- if (BrowserMatches(*i, profile, window_feature, match_types))
- return *i;
- }
- return NULL;
-}
-
-Browser* FindBrowserWithTabbedOrAnyType(Profile* profile,
- bool match_tabbed,
- bool match_original_profiles) {
- uint32 match_types = kMatchAny;
- if (match_tabbed)
- match_types |= kMatchTabbed;
- if (match_original_profiles)
- match_types |= kMatchOriginalProfile;
- Browser* browser = FindBrowserMatching(
- BrowserList::begin_last_active(), BrowserList::end_last_active(),
- profile, Browser::FEATURE_NONE, match_types);
- // Fall back to a forward scan of all Browsers if no active one was found.
- return browser ? browser :
- FindBrowserMatching(BrowserList::begin(), BrowserList::end(), profile,
- Browser::FEATURE_NONE, match_types);
-}
-
printing::BackgroundPrintingManager* GetBackgroundPrintingManager() {
return g_browser_process->background_printing_manager();
}
@@ -461,10 +390,8 @@ void BrowserList::CloseAllBrowsersWithProfile(Profile* profile) {
BrowserVector browsers_to_close;
for (BrowserList::const_iterator i = BrowserList::begin();
i != BrowserList::end(); ++i) {
- if (BrowserMatches(*i, profile, Browser::FEATURE_NONE,
- kMatchOriginalProfile)) {
+ if ((*i)->profile()->GetOriginalProfile() == profile->GetOriginalProfile())
browsers_to_close.push_back(*i);
- }
}
for (BrowserVector::const_iterator i = browsers_to_close.begin();
@@ -601,15 +528,6 @@ void BrowserList::SessionEnding() {
}
// static
-bool BrowserList::HasBrowserWithProfile(Profile* profile) {
- return FindBrowserMatching(BrowserList::begin(),
- BrowserList::end(),
- profile,
- Browser::FEATURE_NONE,
- kMatchAny) != NULL;
-}
-
-// static
int BrowserList::keep_alive_count_ = 0;
// static
@@ -690,80 +608,6 @@ Browser* BrowserList::GetLastActive() {
}
// static
-Browser* BrowserList::GetLastActiveWithProfile(Profile* profile) {
- // We are only interested in last active browsers, so we don't fall back to
- // all browsers like FindBrowserWith* do.
- return FindBrowserMatching(
- BrowserList::begin_last_active(), BrowserList::end_last_active(), profile,
- Browser::FEATURE_NONE, kMatchAny);
-}
-
-// static
-Browser* BrowserList::FindTabbedBrowser(Profile* profile,
- bool match_original_profiles) {
- return FindBrowserWithTabbedOrAnyType(profile,
- true,
- match_original_profiles);
-}
-
-// static
-Browser* BrowserList::FindAnyBrowser(Profile* profile,
- bool match_original_profiles) {
- return FindBrowserWithTabbedOrAnyType(profile,
- false,
- match_original_profiles);
-}
-
-// static
-Browser* BrowserList::FindBrowserWithFeature(Profile* profile,
- Browser::WindowFeature feature) {
- Browser* browser = FindBrowserMatching(
- BrowserList::begin_last_active(), BrowserList::end_last_active(),
- profile, feature, kMatchCanSupportWindowFeature);
- // Fall back to a forward scan of all Browsers if no active one was found.
- return browser ? browser :
- FindBrowserMatching(BrowserList::begin(), BrowserList::end(), profile,
- feature, kMatchCanSupportWindowFeature);
-}
-
-// static
-Browser* BrowserList::FindBrowserWithProfile(Profile* profile) {
- return FindAnyBrowser(profile, false);
-}
-
-// static
-Browser* BrowserList::FindBrowserWithID(SessionID::id_type desired_id) {
- for (BrowserList::const_iterator i = BrowserList::begin();
- i != BrowserList::end(); ++i) {
- if ((*i)->session_id().id() == desired_id)
- return *i;
- }
- return NULL;
-}
-
-// static
-Browser* BrowserList::FindBrowserWithWindow(gfx::NativeWindow window) {
- for (BrowserList::const_iterator it = BrowserList::begin();
- it != BrowserList::end();
- ++it) {
- Browser* browser = *it;
- if (browser->window() && browser->window()->GetNativeHandle() == window)
- return browser;
- }
- return NULL;
-}
-
-// static
-Browser* BrowserList::FindBrowserWithWebContents(WebContents* web_contents) {
- DCHECK(web_contents);
- for (TabContentsIterator it; !it.done(); ++it) {
- if (it->web_contents() == web_contents)
- return it.browser();
- }
- return NULL;
-}
-
-// static
BrowserList::const_reverse_iterator BrowserList::begin_last_active() {
return last_active_browsers().rbegin();
}
@@ -774,31 +618,6 @@ BrowserList::const_reverse_iterator BrowserList::end_last_active() {
}
// static
-size_t BrowserList::GetBrowserCount(Profile* profile) {
- size_t result = 0;
- for (BrowserList::const_iterator i = BrowserList::begin();
- i != BrowserList::end(); ++i) {
- if (BrowserMatches(*i, profile, Browser::FEATURE_NONE, kMatchAny)) {
- ++result;
- }
- }
- return result;
-}
-
-// static
-size_t BrowserList::GetBrowserCountForType(Profile* profile,
- bool match_tabbed) {
- size_t result = 0;
- for (BrowserList::const_iterator i = BrowserList::begin();
- i != BrowserList::end(); ++i) {
- if (BrowserMatches(*i, profile, Browser::FEATURE_NONE,
- match_tabbed ? kMatchTabbed : kMatchAny))
- ++result;
- }
- return result;
-}
-
-// static
bool BrowserList::IsOffTheRecordSessionActive() {
for (BrowserList::const_iterator i = BrowserList::begin();
i != BrowserList::end(); ++i) {
diff --git a/chrome/browser/ui/browser_list.h b/chrome/browser/ui/browser_list.h
index 2cbc704..5eca0c6 100644
--- a/chrome/browser/ui/browser_list.h
+++ b/chrome/browser/ui/browser_list.h
@@ -10,9 +10,11 @@
#include <vector>
#include "base/observer_list.h"
-#include "chrome/browser/ui/browser.h"
#include "ui/gfx/native_widget_types.h"
+class Browser;
+class Profile;
+
// Stores a list of all Browser objects.
class BrowserList {
public:
@@ -62,50 +64,6 @@ class BrowserList {
// WARNING #2: this will always be NULL in unit tests run on the bots.
static Browser* GetLastActive();
- // Identical in behavior to GetLastActive(), except that the most recently
- // open browser owned by |profile| is returned. If none exist, returns NULL.
- // WARNING: see warnings in GetLastActive().
- static Browser* GetLastActiveWithProfile(Profile* profile);
-
- // Retrieve the last active tabbed browser with a profile matching |profile|.
- // If |match_original_profiles| is true, matching is done based on the
- // original profile, eg profile->GetOriginalProfile() ==
- // browser->profile()->GetOriginalProfile(). This has the effect of matching
- // against both non-incognito and incognito profiles. If
- // |match_original_profiles| is false, only an exact match may be returned.
- static Browser* FindTabbedBrowser(Profile* profile,
- bool match_original_profiles);
-
- // Find an existing browser window with any type. See comment above for
- // additional information.
- static Browser* FindAnyBrowser(Profile* profile,
- bool match_original_profiles);
-
- // Find an existing browser window that can provide the specified type (this
- // uses Browser::CanSupportsWindowFeature, not
- // Browser::SupportsWindowFeature). This searches in the order of last
- // activation. Only browsers that have been active can be returned. Returns
- // NULL if no such browser currently exists.
- static Browser* FindBrowserWithFeature(Profile* profile,
- Browser::WindowFeature feature);
-
- // Find an existing browser window with the provided profile. Searches in the
- // order of last activation. Only browsers that have been active can be
- // returned. Returns NULL if no such browser currently exists.
- static Browser* FindBrowserWithProfile(Profile* profile);
-
- // Find an existing browser with the provided ID. Returns NULL if no such
- // browser currently exists.
- static Browser* FindBrowserWithID(SessionID::id_type desired_id);
-
- // Find the browser represented by |window| or NULL if not found.
- static Browser* FindBrowserWithWindow(gfx::NativeWindow window);
-
- // Find the browser containing |web_contents| or NULL if none is found.
- // |web_contents| must not be NULL.
- static Browser* FindBrowserWithWebContents(
- content::WebContents* web_contents);
-
// Checks if the browser can be automatically restarted to install upgrades
// The browser can be automatically restarted when:
// 1. It's in the background mode (no visible windows).
@@ -155,9 +113,6 @@ class BrowserList {
// Begins shutdown of the application when the desktop session is ending.
static void SessionEnding();
- // Returns true if there is at least one Browser with the specified profile.
- static bool HasBrowserWithProfile(Profile* profile);
-
// Tells the BrowserList to keep the application alive after the last Browser
// closes. This is implemented as a count, so callers should pair their calls
// to StartKeepAlive() with matching calls to EndKeepAlive() when they no
@@ -187,14 +142,6 @@ class BrowserList {
static const_reverse_iterator begin_last_active();
static const_reverse_iterator end_last_active();
- // Return the number of browsers with the following profile which are
- // currently open.
- static size_t GetBrowserCount(Profile* profile);
-
- // Return the number of browsers with the following profile and type which are
- // currently open.
- static size_t GetBrowserCountForType(Profile* profile, bool match_tabbed);
-
// Returns true if at least one incognito session is active.
static bool IsOffTheRecordSessionActive();
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc
index d08dc296..2f1af3e 100644
--- a/chrome/browser/ui/browser_navigator.cc
+++ b/chrome/browser/ui/browser_navigator.cc
@@ -22,7 +22,7 @@
#include "chrome/browser/rlz/rlz.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/omnibox/location_bar.h"
#include "chrome/browser/ui/status_bubble.h"
@@ -56,7 +56,7 @@ bool WindowCanOpenTabs(Browser* browser) {
// Finds an existing Browser compatible with |profile|, making a new one if no
// such Browser is located.
Browser* GetOrCreateBrowser(Profile* profile) {
- Browser* browser = BrowserList::FindTabbedBrowser(profile, false);
+ Browser* browser = browser::FindTabbedBrowser(profile, false);
return browser ? browser : Browser::Create(profile);
}
@@ -101,7 +101,7 @@ bool AdjustNavigateParamsForURL(browser::NavigateParams* params) {
params->disposition = SINGLETON_TAB;
params->profile = profile;
- params->browser = Browser::GetOrCreateTabbedBrowser(profile);
+ params->browser = browser::FindOrCreateTabbedBrowser(profile);
params->window_action = browser::NavigateParams::SHOW_WINDOW;
}
@@ -127,7 +127,7 @@ Browser* GetBrowserForDisposition(browser::NavigateParams* params) {
case CURRENT_TAB:
if (!params->browser && profile) {
// We specified a profile instead of a browser; find or create one.
- params->browser = Browser::GetOrCreateTabbedBrowser(profile);
+ params->browser = browser::FindOrCreateTabbedBrowser(profile);
}
return params->browser;
case SINGLETON_TAB:
diff --git a/chrome/browser/ui/browser_tab_restore_service_delegate.cc b/chrome/browser/ui/browser_tab_restore_service_delegate.cc
index 38f2c3b..2a1e1ac 100644
--- a/chrome/browser/ui/browser_tab_restore_service_delegate.cc
+++ b/chrome/browser/ui/browser_tab_restore_service_delegate.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/ui/browser_tab_restore_service_delegate.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "content/public/browser/navigation_controller.h"
@@ -99,7 +99,7 @@ TabRestoreServiceDelegate* TabRestoreServiceDelegate::Create(
TabRestoreServiceDelegate* TabRestoreServiceDelegate::FindDelegateForController(
const NavigationController* controller,
int* index) {
- Browser* browser = Browser::GetBrowserForController(controller, index);
+ Browser* browser = browser::FindBrowserForController(controller, index);
if (browser)
return browser->tab_restore_service_delegate();
else
@@ -109,7 +109,7 @@ TabRestoreServiceDelegate* TabRestoreServiceDelegate::FindDelegateForController(
// static
TabRestoreServiceDelegate* TabRestoreServiceDelegate::FindDelegateWithID(
SessionID::id_type desired_id) {
- Browser* browser = BrowserList::FindBrowserWithID(desired_id);
+ Browser* browser = browser::FindBrowserWithID(desired_id);
if (browser)
return browser->tab_restore_service_delegate();
else
diff --git a/chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript.mm b/chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript.mm
index dbccb01..b2c1b09 100644
--- a/chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript.mm
+++ b/chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +9,7 @@
#import "chrome/browser/app_controller_mac.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#import "chrome/browser/ui/cocoa/applescript/bookmark_folder_applescript.h"
#import "chrome/browser/ui/cocoa/applescript/constants_applescript.h"
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm
index 1053e8c..7a98a24 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm
@@ -11,6 +11,7 @@
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h"
#include "chrome/browser/ui/cocoa/event_utils.h"
#include "content/public/browser/user_metrics.h"
@@ -92,7 +93,7 @@ const NSUInteger kMaximumMenuPixelsWide = 300;
// Open the URL of the given BookmarkNode in the current tab.
- (void)openURLForNode:(const BookmarkNode*)node {
- Browser* browser = Browser::GetTabbedBrowser(bridge_->GetProfile(), true);
+ Browser* browser = browser::FindTabbedBrowser(bridge_->GetProfile(), true);
if (!browser)
browser = Browser::Create(bridge_->GetProfile());
WindowOpenDisposition disposition =
@@ -111,7 +112,7 @@ const NSUInteger kMaximumMenuPixelsWide = 300;
const BookmarkNode* node = [self nodeForIdentifier:identifier];
DCHECK(node);
- Browser* browser = Browser::GetTabbedBrowser(bridge_->GetProfile(), true);
+ Browser* browser = browser::FindTabbedBrowser(bridge_->GetProfile(), true);
if (!browser)
browser = Browser::Create(bridge_->GetProfile());
DCHECK(browser);
diff --git a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm
index a7b7a4f..1b63043a 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm
@@ -11,6 +11,7 @@
#include "chrome/browser/prefs/pref_change_registrar.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/cocoa/browser_window_cocoa.h"
#include "chrome/browser/ui/cocoa/browser_window_controller.h"
@@ -151,7 +152,7 @@ int CurrentTabId() {
}
- (void)dispatch:(id)menuItem {
- Browser* browser = BrowserList::FindBrowserWithProfile(profile_);
+ Browser* browser = browser::FindBrowserWithProfile(profile_);
if (!browser)
return;
diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm
index 2495fe9..504edb9 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm
@@ -14,7 +14,7 @@
#include "chrome/browser/extensions/bundle_installer.h"
#include "chrome/browser/extensions/extension_install_dialog.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/extensions/extension.h"
#include "grit/generated_resources.h"
@@ -135,7 +135,7 @@ void AppendRatingStarsShim(const SkBitmap* skiaImage, void* data) {
- (IBAction)storeLinkClicked:(id)sender {
GURL store_url(extension_urls::GetWebstoreItemDetailURLPrefix() +
prompt_->extension()->id());
- BrowserList::GetLastActiveWithProfile(profile_)->OpenURL(OpenURLParams(
+ browser::FindLastActiveWithProfile(profile_)->OpenURL(OpenURLParams(
store_url, Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK,
false));
@@ -321,7 +321,7 @@ void ShowExtensionInstallDialogImpl(
Profile* profile,
ExtensionInstallUI::Delegate* delegate,
const ExtensionInstallUI::Prompt& prompt) {
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
+ Browser* browser = browser::FindLastActiveWithProfile(profile);
if (!browser) {
delegate->InstallUIAbort(false);
return;
diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm
index 12c7b92..133beda 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm
@@ -12,7 +12,7 @@
#include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
@@ -31,7 +31,7 @@ static void ShowGenericExtensionInstalledInfoBar(
const Extension* new_extension,
const SkBitmap& icon,
Profile* profile) {
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
+ Browser* browser = browser::FindLastActiveWithProfile(profile);
if (!browser)
return;
diff --git a/chrome/browser/ui/cocoa/first_run_bubble_controller.mm b/chrome/browser/ui/cocoa/first_run_bubble_controller.mm
index 4583023..c1c193f 100644
--- a/chrome/browser/ui/cocoa/first_run_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/first_run_bubble_controller.mm
@@ -8,7 +8,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/search_engines/util.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#import "chrome/browser/ui/cocoa/l10n_util.h"
#import "chrome/browser/ui/cocoa/info_bubble_view.h"
#include "grit/generated_resources.h"
@@ -86,7 +86,7 @@
- (IBAction)onChange:(id)sender {
first_run::LogFirstRunMetric(first_run::FIRST_RUN_BUBBLE_CHANGE_INVOKED);
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
[self close];
if (browser)
browser->OpenSearchEngineOptionsDialog();
diff --git a/chrome/browser/ui/cocoa/history_menu_cocoa_controller.mm b/chrome/browser/ui/cocoa/history_menu_cocoa_controller.mm
index 2f3a050..ca9600d 100644
--- a/chrome/browser/ui/cocoa/history_menu_cocoa_controller.mm
+++ b/chrome/browser/ui/cocoa/history_menu_cocoa_controller.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,6 +13,7 @@
#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/browser/sessions/tab_restore_service_factory.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_tab_restore_service_delegate.h"
#include "chrome/browser/ui/cocoa/event_utils.h"
#include "webkit/glue/window_open_disposition.h"
@@ -37,7 +38,7 @@ using content::Referrer;
// Open the URL of the given history item in the current tab.
- (void)openURLForItem:(const HistoryMenuBridge::HistoryItem*)node {
- Browser* browser = Browser::GetOrCreateTabbedBrowser(bridge_->profile());
+ Browser* browser = browser::FindOrCreateTabbedBrowser(bridge_->profile());
WindowOpenDisposition disposition =
event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]);
diff --git a/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm b/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm
index 58060e2..ac680f7 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm
@@ -7,6 +7,7 @@
#include "base/sys_string_conversions.h"
#import "chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
@@ -104,7 +105,7 @@ bool LocationIconDecoration::OnMousePressed(NSRect frame) {
NOTREACHED();
return true;
}
- Browser* browser = Browser::GetBrowserForController(&controller, NULL);
+ Browser* browser = browser::FindBrowserForController(&controller, NULL);
browser->ShowPageInfo(tab, nav_entry->GetURL(), nav_entry->GetSSL(), true);
return true;
}
diff --git a/chrome/browser/ui/gtk/about_chrome_dialog.cc b/chrome/browser/ui/gtk/about_chrome_dialog.cc
index e87fff3..3645e6c 100644
--- a/chrome/browser/ui/gtk/about_chrome_dialog.cc
+++ b/chrome/browser/ui/gtk/about_chrome_dialog.cc
@@ -12,11 +12,13 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/google/google_util.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/gtk/gtk_chrome_link_button.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/url_constants.h"
+#include "content/public/browser/page_navigator.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
diff --git a/chrome/browser/ui/gtk/constrained_window_gtk.cc b/chrome/browser/ui/gtk/constrained_window_gtk.cc
index 38b9f6c..2429193 100644
--- a/chrome/browser/ui/gtk/constrained_window_gtk.cc
+++ b/chrome/browser/ui/gtk/constrained_window_gtk.cc
@@ -10,6 +10,7 @@
#include "base/message_loop.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/constrained_window_tab_helper.h"
+#include "chrome/browser/ui/constrained_window_tab_helper_delegate.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc b/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc
index 26d7f89..ca5607e 100644
--- a/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/extensions/bundle_installer.h"
#include "chrome/browser/extensions/extension_install_dialog.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/gtk/browser_window_gtk.h"
@@ -265,7 +266,7 @@ void ShowExtensionInstallDialogImpl(
Profile* profile,
ExtensionInstallUI::Delegate* delegate,
const ExtensionInstallUI::Prompt& prompt) {
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
+ Browser* browser = browser::FindLastActiveWithProfile(profile);
if (!browser) {
delegate->InstallUIAbort(false);
return;
diff --git a/chrome/browser/ui/gtk/extensions/extension_uninstall_dialog_gtk.cc b/chrome/browser/ui/gtk/extensions/extension_uninstall_dialog_gtk.cc
index d98998b..62cb434f 100644
--- a/chrome/browser/ui/gtk/extensions/extension_uninstall_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/extensions/extension_uninstall_dialog_gtk.cc
@@ -10,7 +10,7 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/extensions/extension_uninstall_dialog.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/gtk/browser_window_gtk.h"
#include "chrome/common/extensions/extension.h"
@@ -46,7 +46,7 @@ ExtensionUninstallDialogGtk::ExtensionUninstallDialogGtk(
dialog_(NULL) {}
void ExtensionUninstallDialogGtk::Show() {
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
if (!browser) {
delegate_->ExtensionUninstallCanceled();
return;
diff --git a/chrome/browser/ui/gtk/first_run_bubble.cc b/chrome/browser/ui/gtk/first_run_bubble.cc
index 4b0a8de..948b4b1 100644
--- a/chrome/browser/ui/gtk/first_run_bubble.cc
+++ b/chrome/browser/ui/gtk/first_run_bubble.cc
@@ -10,7 +10,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/search_engines/util.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/gtk/gtk_theme_service.h"
#include "grit/generated_resources.h"
#include "ui/base/gtk/gtk_hig_constants.h"
@@ -89,7 +89,7 @@ void FirstRunBubble::HandleChangeLink(GtkWidget* sender) {
first_run::LogFirstRunMetric(first_run::FIRST_RUN_BUBBLE_CHANGE_INVOKED);
// Get |profile_|'s browser before closing the bubble, which deletes |this|.
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
bubble_->Close();
if (browser)
browser->OpenSearchEngineOptionsDialog();
diff --git a/chrome/browser/ui/gtk/gtk_theme_service.cc b/chrome/browser/ui/gtk/gtk_theme_service.cc
index 30d92ef..a422bda 100644
--- a/chrome/browser/ui/gtk/gtk_theme_service.cc
+++ b/chrome/browser/ui/gtk/gtk_theme_service.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/themes/theme_service_factory.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/gtk/chrome_gtk_frame.h"
diff --git a/chrome/browser/ui/gtk/gtk_util.cc b/chrome/browser/ui/gtk/gtk_util.cc
index 826c3e3b..0be5653 100644
--- a/chrome/browser/ui/gtk/gtk_util.cc
+++ b/chrome/browser/ui/gtk/gtk_util.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/gtk/browser_window_gtk.h"
diff --git a/chrome/browser/ui/gtk/page_info_bubble_gtk.cc b/chrome/browser/ui/gtk/page_info_bubble_gtk.cc
index 6876d6e..8fcb483 100644
--- a/chrome/browser/ui/gtk/page_info_bubble_gtk.cc
+++ b/chrome/browser/ui/gtk/page_info_bubble_gtk.cc
@@ -11,7 +11,7 @@
#include "chrome/browser/certificate_viewer.h"
#include "chrome/browser/page_info_model.h"
#include "chrome/browser/page_info_model_observer.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/gtk/browser_toolbar_gtk.h"
#include "chrome/browser/ui/gtk/browser_window_gtk.h"
#include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
@@ -227,7 +227,7 @@ void PageInfoBubbleGtk::OnViewCertLinkClicked(GtkWidget* widget) {
}
void PageInfoBubbleGtk::OnHelpLinkClicked(GtkWidget* widget) {
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
browser->OpenURL(OpenURLParams(
GURL(chrome::kPageInfoHelpCenterURL), content::Referrer(),
NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false));
diff --git a/chrome/browser/ui/gtk/password_generation_bubble_gtk.cc b/chrome/browser/ui/gtk/password_generation_bubble_gtk.cc
index 2fb2412..fc3818a 100644
--- a/chrome/browser/ui/gtk/password_generation_bubble_gtk.cc
+++ b/chrome/browser/ui/gtk/password_generation_bubble_gtk.cc
@@ -6,7 +6,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
#include "chrome/browser/ui/gtk/gtk_chrome_link_button.h"
#include "chrome/browser/ui/gtk/gtk_theme_service.h"
@@ -90,7 +90,7 @@ void PasswordGenerationBubbleGtk::OnAcceptClicked(GtkWidget* widget) {
}
void PasswordGenerationBubbleGtk::OnLearnMoreLinkClicked(GtkButton* button) {
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
content::OpenURLParams params(
GURL(chrome::kAutoPasswordGenerationLearnMoreURL), content::Referrer(),
NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false);
diff --git a/chrome/browser/ui/gtk/website_settings_popup_gtk.cc b/chrome/browser/ui/gtk/website_settings_popup_gtk.cc
index fd28f01..a6d6df4 100644
--- a/chrome/browser/ui/gtk/website_settings_popup_gtk.cc
+++ b/chrome/browser/ui/gtk/website_settings_popup_gtk.cc
@@ -10,6 +10,7 @@
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/certificate_viewer.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/gtk/browser_toolbar_gtk.h"
#include "chrome/browser/ui/gtk/browser_window_gtk.h"
diff --git a/chrome/browser/ui/intents/web_intent_picker_controller.cc b/chrome/browser/ui/intents/web_intent_picker_controller.cc
index 1802c56..f59d8ec 100644
--- a/chrome/browser/ui/intents/web_intent_picker_controller.cc
+++ b/chrome/browser/ui/intents/web_intent_picker_controller.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/intents/web_intent_picker.h"
@@ -263,7 +264,7 @@ void WebIntentPickerController::OnServiceChosen(const GURL& url,
case WebIntentPickerModel::DISPOSITION_WINDOW: {
int index = TabStripModel::kNoTab;
- Browser* browser = Browser::GetBrowserForController(
+ Browser* browser = browser::FindBrowserForController(
&wrapper_->web_contents()->GetController(), &index);
TabContentsWrapper* contents = Browser::TabContentsFactory(
wrapper_->profile(),
@@ -319,7 +320,7 @@ void WebIntentPickerController::OnExtensionInstallRequested(
void WebIntentPickerController::OnExtensionLinkClicked(const std::string& id) {
// Navigate from source tab.
Browser* browser =
- BrowserList::FindBrowserWithWebContents(wrapper_->web_contents());
+ browser::FindBrowserWithWebContents(wrapper_->web_contents());
GURL extension_url(extension_urls::GetWebstoreItemDetailURLPrefix() + id);
browser::NavigateParams params(browser, extension_url,
content::PAGE_TRANSITION_AUTO_BOOKMARK);
@@ -330,7 +331,7 @@ void WebIntentPickerController::OnExtensionLinkClicked(const std::string& id) {
void WebIntentPickerController::OnSuggestionsLinkClicked() {
// Navigate from source tab.
Browser* browser =
- BrowserList::FindBrowserWithWebContents(wrapper_->web_contents());
+ browser::FindBrowserWithWebContents(wrapper_->web_contents());
GURL query_url = extension_urls::GetWebstoreIntentQueryURL(
UTF16ToUTF8(picker_model_->action()),
UTF16ToUTF8(picker_model_->mimetype()));
@@ -395,7 +396,7 @@ void WebIntentPickerController::OnSendReturnMessage(
if (service_tab_ &&
reply_type != webkit_glue::WEB_INTENT_SERVICE_CONTENTS_CLOSED) {
int index = TabStripModel::kNoTab;
- Browser* browser = Browser::GetBrowserForController(
+ Browser* browser = browser::FindBrowserForController(
&service_tab_->GetController(), &index);
if (browser) {
browser->tab_strip_model()->CloseTabContentsAt(
@@ -403,7 +404,7 @@ void WebIntentPickerController::OnSendReturnMessage(
// Activate source tab.
Browser* source_browser =
- BrowserList::FindBrowserWithWebContents(wrapper_->web_contents());
+ browser::FindBrowserWithWebContents(wrapper_->web_contents());
if (source_browser) {
int source_index =
source_browser->tab_strip_model()->GetIndexOfTabContents(wrapper_);
diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc
index e4ca2ea..d98d021 100644
--- a/chrome/browser/ui/panels/panel.cc
+++ b/chrome/browser/ui/panels/panel.cc
@@ -8,6 +8,7 @@
#include "base/message_loop.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/panels/native_panel.h"
#include "chrome/browser/ui/panels/panel_manager.h"
#include "chrome/browser/ui/panels/panel_strip.h"
@@ -530,7 +531,7 @@ bool Panel::IsDownloadShelfVisible() const {
DownloadShelf* Panel::GetDownloadShelf() {
Browser* panel_browser = native_panel_->GetPanelBrowser();
Profile* profile = panel_browser->profile();
- Browser* tabbed_browser = Browser::GetTabbedBrowser(profile, true);
+ Browser* tabbed_browser = browser::FindTabbedBrowser(profile, true);
if (!tabbed_browser) {
// Set initial bounds so window will not be positioned at an offset
diff --git a/chrome/browser/ui/panels/panel_browser_window_gtk.cc b/chrome/browser/ui/panels/panel_browser_window_gtk.cc
index d249e7e..896114e 100644
--- a/chrome/browser/ui/panels/panel_browser_window_gtk.cc
+++ b/chrome/browser/ui/panels/panel_browser_window_gtk.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/panels/panel_browser_window_gtk.h"
#include "base/bind.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/gtk/browser_titlebar.h"
#include "chrome/browser/ui/gtk/custom_button.h"
diff --git a/chrome/browser/ui/panels/panel_browsertest.cc b/chrome/browser/ui/panels/panel_browsertest.cc
index 90b765b..b7f1260 100644
--- a/chrome/browser/ui/panels/panel_browsertest.cc
+++ b/chrome/browser/ui/panels/panel_browsertest.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
#include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/find_bar/find_bar.h"
@@ -1436,7 +1437,7 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DISABLED_CreateWithExistingContents) {
signal.Wait();
EXPECT_EQ(0, PanelManager::GetInstance()->num_panels());
- Browser* tabbed_browser = BrowserList::FindTabbedBrowser(profile, false);
+ Browser* tabbed_browser = browser::FindTabbedBrowser(profile, false);
EXPECT_EQ(contents, tabbed_browser->GetSelectedTabContentsWrapper());
tabbed_browser->window()->Close();
}
@@ -1711,7 +1712,7 @@ IN_PROC_BROWSER_TEST_F(PanelDownloadTest, MAYBE_DownloadNoTabbedBrowser) {
browser()->CloseWindow();
signal.Wait();
ASSERT_EQ(1U, BrowserList::size());
- ASSERT_EQ(NULL, Browser::GetTabbedBrowser(profile, false));
+ ASSERT_EQ(NULL, browser::FindTabbedBrowser(profile, false));
scoped_ptr<DownloadObserver> observer(new DownloadObserver(profile));
FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
@@ -1725,7 +1726,7 @@ IN_PROC_BROWSER_TEST_F(PanelDownloadTest, MAYBE_DownloadNoTabbedBrowser) {
EXPECT_EQ(2U, BrowserList::size());
- Browser* tabbed_browser = Browser::GetTabbedBrowser(profile, false);
+ Browser* tabbed_browser = browser::FindTabbedBrowser(profile, false);
EXPECT_EQ(1, tabbed_browser->tab_count());
ASSERT_TRUE(tabbed_browser->window()->IsDownloadShelfVisible());
tabbed_browser->CloseWindow();
diff --git a/chrome/browser/ui/startup/autolaunch_prompt_win.cc b/chrome/browser/ui/startup/autolaunch_prompt_win.cc
index 5525821..b3dd711 100644
--- a/chrome/browser/ui/startup/autolaunch_prompt_win.cc
+++ b/chrome/browser/ui/startup/autolaunch_prompt_win.cc
@@ -14,7 +14,7 @@
#include "chrome/browser/infobars/infobar_tab_helper.h"
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
@@ -153,7 +153,7 @@ void CheckAutoLaunchCallback(Profile* profile) {
// We must not use GetLastActive here because this is at Chrome startup and
// no window might have been made active yet. We'll settle for any window.
- Browser* browser = BrowserList::FindAnyBrowser(profile, true);
+ Browser* browser = browser::FindAnyBrowser(profile, true);
TabContentsWrapper* tab = browser->GetSelectedTabContentsWrapper();
// Don't show the info-bar if there are already info-bars showing.
diff --git a/chrome/browser/ui/startup/session_crashed_prompt.cc b/chrome/browser/ui/startup/session_crashed_prompt.cc
index 70dca07..7c727e0 100644
--- a/chrome/browser/ui/startup/session_crashed_prompt.cc
+++ b/chrome/browser/ui/startup/session_crashed_prompt.cc
@@ -10,7 +10,7 @@
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/web_contents.h"
#include "grit/chromium_strings.h"
@@ -75,7 +75,7 @@ string16 SessionCrashedInfoBarDelegate::GetButtonLabel(
bool SessionCrashedInfoBarDelegate::Accept() {
uint32 behavior = 0;
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
if (browser && browser->tab_count() == 1
&& browser->GetWebContentsAt(0)->GetURL() ==
GURL(chrome::kChromeUINewTabURL)) {
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
index 5f29058..8f83a6a 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sessions/session_restore.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/startup/startup_browser_creator.h"
@@ -59,7 +60,7 @@ class StartupBrowserCreatorTest : public ExtensionBrowserTest {
ASSERT_TRUE(*out_app_extension);
// Code that opens a new browser assumes we start with exactly one.
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(1u, browser::GetBrowserCount(browser()->profile()));
}
void SetAppLaunchPref(const std::string& app_id,
@@ -71,7 +72,7 @@ class StartupBrowserCreatorTest : public ExtensionBrowserTest {
// Check that there are two browsers. Find the one that is not |browser()|.
void FindOneOtherBrowser(Browser** out_other_browser) {
// There should only be one other browser.
- ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile()));
// Find the new browser.
Browser* other_browser = NULL;
@@ -299,7 +300,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutTabPref) {
// When an app shortcut is open and the pref indicates a tab should
// open, the tab is open in a new browser window. Expect a new window.
- ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile()));
+ ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile()));
Browser* new_browser = NULL;
ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser));
@@ -416,13 +417,13 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, StartupURLsForTwoProfiles) {
Browser* new_browser = NULL;
// |browser()| is still around at this point, even though we've closed its
// window. Thus the browser count for default_profile is 2.
- ASSERT_EQ(2u, BrowserList::GetBrowserCount(default_profile));
+ ASSERT_EQ(2u, browser::GetBrowserCount(default_profile));
new_browser = FindOneOtherBrowserForProfile(default_profile, browser());
ASSERT_TRUE(new_browser);
ASSERT_EQ(1, new_browser->tab_count());
EXPECT_EQ(urls1[0], new_browser->GetWebContentsAt(0)->GetURL());
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(other_profile));
+ ASSERT_EQ(1u, browser::GetBrowserCount(other_profile));
new_browser = FindOneOtherBrowserForProfile(other_profile, NULL);
ASSERT_TRUE(new_browser);
ASSERT_EQ(1, new_browser->tab_count());
@@ -486,14 +487,14 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, UpdateWithTwoProfiles) {
EXPECT_TRUE(profile2->restored_last_session());
Browser* new_browser = NULL;
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(profile1));
+ ASSERT_EQ(1u, browser::GetBrowserCount(profile1));
new_browser = FindOneOtherBrowserForProfile(profile1, NULL);
ASSERT_TRUE(new_browser);
ASSERT_EQ(1, new_browser->tab_count());
EXPECT_EQ(GURL(chrome::kAboutBlankURL),
new_browser->GetWebContentsAt(0)->GetURL());
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(profile2));
+ ASSERT_EQ(1u, browser::GetBrowserCount(profile2));
new_browser = FindOneOtherBrowserForProfile(profile2, NULL);
ASSERT_TRUE(new_browser);
ASSERT_EQ(1, new_browser->tab_count());
@@ -571,7 +572,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
Browser* new_browser = NULL;
// The last open profile (the profile_home1 in this case) will always be
// launched, even if it will open just the home page.
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(profile_home1));
+ ASSERT_EQ(1u, browser::GetBrowserCount(profile_home1));
new_browser = FindOneOtherBrowserForProfile(profile_home1, NULL);
ASSERT_TRUE(new_browser);
ASSERT_EQ(1, new_browser->tab_count());
@@ -579,14 +580,14 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
new_browser->GetWebContentsAt(0)->GetURL());
// profile_urls opened the urls.
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(profile_urls));
+ ASSERT_EQ(1u, browser::GetBrowserCount(profile_urls));
new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL);
ASSERT_TRUE(new_browser);
ASSERT_EQ(1, new_browser->tab_count());
EXPECT_EQ(urls[0], new_browser->GetWebContentsAt(0)->GetURL());
// profile_last opened the last open pages.
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(profile_last));
+ ASSERT_EQ(1u, browser::GetBrowserCount(profile_last));
new_browser = FindOneOtherBrowserForProfile(profile_last, NULL);
ASSERT_TRUE(new_browser);
ASSERT_EQ(1, new_browser->tab_count());
@@ -594,7 +595,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
new_browser->GetWebContentsAt(0)->GetURL());
// profile_home2 was not launched since it would've only opened the home page.
- ASSERT_EQ(0u, BrowserList::GetBrowserCount(profile_home2));
+ ASSERT_EQ(0u, browser::GetBrowserCount(profile_home2));
}
IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) {
@@ -658,7 +659,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) {
// The profile which normally opens the home page displays the new tab page.
Browser* new_browser = NULL;
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(profile_home));
+ ASSERT_EQ(1u, browser::GetBrowserCount(profile_home));
new_browser = FindOneOtherBrowserForProfile(profile_home, NULL);
ASSERT_TRUE(new_browser);
ASSERT_EQ(1, new_browser->tab_count());
@@ -668,7 +669,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) {
infobar_count());
// The profile which normally opens last open pages displays the new tab page.
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(profile_last));
+ ASSERT_EQ(1u, browser::GetBrowserCount(profile_last));
new_browser = FindOneOtherBrowserForProfile(profile_last, NULL);
ASSERT_TRUE(new_browser);
ASSERT_EQ(1, new_browser->tab_count());
@@ -678,7 +679,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) {
infobar_count());
// The profile which normally opens URLs displays the new tab page.
- ASSERT_EQ(1u, BrowserList::GetBrowserCount(profile_urls));
+ ASSERT_EQ(1u, browser::GetBrowserCount(profile_urls));
new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL);
ASSERT_TRUE(new_browser);
ASSERT_EQ(1, new_browser->tab_count());
diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
index f356826..bcf88f8 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
@@ -41,6 +41,7 @@
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sessions/session_service_factory.h"
#include "chrome/browser/shell_integration.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_window.h"
@@ -509,7 +510,7 @@ void StartupBrowserCreatorImpl::ProcessLaunchURLs(
if (adjust_urls.empty())
AddStartupURLs(&adjust_urls);
else if (!command_line_.HasSwitch(switches::kOpenInNewWindow))
- browser = BrowserList::GetLastActiveWithProfile(profile_);
+ browser = browser::FindLastActiveWithProfile(profile_);
// This will launch a browser; prevent session restore.
in_synchronous_profile_launch = true;
diff --git a/chrome/browser/ui/sync/browser_synced_window_delegate.cc b/chrome/browser/ui/sync/browser_synced_window_delegate.cc
index 7a6a3aa..66814ae 100644
--- a/chrome/browser/ui/sync/browser_synced_window_delegate.cc
+++ b/chrome/browser/ui/sync/browser_synced_window_delegate.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/sessions/session_id.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
@@ -30,7 +31,7 @@ const std::set<browser_sync::SyncedWindowDelegate*>
const browser_sync::SyncedWindowDelegate*
browser_sync::SyncedWindowDelegate::FindSyncedWindowDelegateWithId(
SessionID::id_type id) {
- Browser* browser = BrowserList::FindBrowserWithID(id);
+ Browser* browser = browser::FindBrowserWithID(id);
// In case we don't find the browser (e.g. for Developer Tools).
return browser ? browser->synced_window_delegate() : NULL;
}
diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc
index a467179..736af5e 100644
--- a/chrome/browser/ui/sync/one_click_signin_helper.cc
+++ b/chrome/browser/ui/sync/one_click_signin_helper.cc
@@ -20,7 +20,7 @@
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
#include "chrome/browser/tab_contents/tab_util.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/sync/one_click_signin_dialog.h"
#include "chrome/browser/ui/sync/one_click_signin_histogram.h"
@@ -155,7 +155,7 @@ void StartSync(content::WebContents* web_contents,
new OneClickSigninSyncStarter(
profile, session_index, email, password, use_default_settings));
- Browser* browser = BrowserList::FindBrowserWithWebContents(web_contents);
+ Browser* browser = browser::FindBrowserWithWebContents(web_contents);
browser->window()->ShowOneClickSigninBubble(
base::Bind(&OnLearnMore, base::Unretained(browser)),
base::Bind(&OnAdvanced, base::Unretained(browser)));
diff --git a/chrome/browser/ui/views/about_chrome_view.cc b/chrome/browser/ui/views/about_chrome_view.cc
index eff8751..d187f77 100644
--- a/chrome/browser/ui/views/about_chrome_view.cc
+++ b/chrome/browser/ui/views/about_chrome_view.cc
@@ -19,6 +19,8 @@
#include "base/win/windows_version.h"
#include "chrome/browser/google/google_util.h"
#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_version_info.h"
@@ -621,7 +623,7 @@ void AboutChromeView::LinkClicked(views::Link* source, int event_flags) {
NOTREACHED() << "Unknown link source";
}
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
OpenURLParams params(
url, Referrer(), NEW_WINDOW, content::PAGE_TRANSITION_LINK, false);
browser->OpenURL(params);
diff --git a/chrome/browser/ui/views/ash/app_list/extension_app_item.cc b/chrome/browser/ui/views/ash/app_list/extension_app_item.cc
index ce97abb..6aef8c7 100644
--- a/chrome/browser/ui/views/ash/app_list/extension_app_item.cc
+++ b/chrome/browser/ui/views/ash/app_list/extension_app_item.cc
@@ -10,7 +10,7 @@
#include "chrome/browser/extensions/extension_uninstall_dialog.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/views/ash/extension_utils.h"
#include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h"
@@ -161,7 +161,7 @@ void ExtensionAppItem::ShowExtensionOptions() {
if (!extension)
return;
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
if (!browser) {
browser = Browser::Create(profile_);
browser->window()->Show();
diff --git a/chrome/browser/ui/views/ash/chrome_shell_delegate.cc b/chrome/browser/ui/views/ash/chrome_shell_delegate.cc
index b52caed..7016013 100644
--- a/chrome/browser/ui/views/ash/chrome_shell_delegate.cc
+++ b/chrome/browser/ui/views/ash/chrome_shell_delegate.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/views/ash/app_list/app_list_view_delegate.h"
#include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h"
@@ -135,7 +136,7 @@ void ChromeShellDelegate::Search() {
}
}
- Browser* target_browser = Browser::GetOrCreateTabbedBrowser(
+ Browser* target_browser = browser::FindOrCreateTabbedBrowser(
last_active ? last_active->profile() :
ProfileManager::GetDefaultProfileOrOffTheRecord());
const GURL& url = target_browser->GetSelectedWebContents() ?
@@ -158,7 +159,7 @@ void ChromeShellDelegate::OpenFileManager() {
void ChromeShellDelegate::OpenCrosh() {
#if defined(OS_CHROMEOS)
- Browser* browser = Browser::GetOrCreateTabbedBrowser(
+ Browser* browser = browser::FindOrCreateTabbedBrowser(
ProfileManager::GetDefaultProfileOrOffTheRecord());
GURL crosh_url = TerminalExtensionHelper::GetCroshExtensionURL(
browser->profile());
@@ -175,7 +176,7 @@ void ChromeShellDelegate::OpenCrosh() {
void ChromeShellDelegate::OpenMobileSetup() {
#if defined(OS_CHROMEOS)
- Browser* browser = Browser::GetOrCreateTabbedBrowser(
+ Browser* browser = browser::FindOrCreateTabbedBrowser(
ProfileManager::GetDefaultProfileOrOffTheRecord());
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableMobileSetupDialog)) {
diff --git a/chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.cc
index 21cc2ae..6ca146e 100644
--- a/chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.cc
+++ b/chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.cc
@@ -19,7 +19,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
@@ -412,7 +412,7 @@ void ChromeLauncherController::SetAutoHideBehavior(
}
void ChromeLauncherController::CreateNewTab() {
- Browser *last_browser = BrowserList::FindTabbedBrowser(
+ Browser *last_browser = browser::FindTabbedBrowser(
GetProfileForNewWindows(), true);
if (!last_browser) {
diff --git a/chrome/browser/ui/views/ash/panel_view_aura.cc b/chrome/browser/ui/views/ash/panel_view_aura.cc
index 6f25443..7f7028f 100644
--- a/chrome/browser/ui/views/ash/panel_view_aura.cc
+++ b/chrome/browser/ui/views/ash/panel_view_aura.cc
@@ -14,7 +14,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_id.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/chrome_view_type.h"
#include "chrome/common/extensions/extension_messages.h"
#include "content/public/browser/site_instance.h"
@@ -140,7 +140,7 @@ void PanelHost::AddNewContents(content::WebContents* source,
WindowOpenDisposition disposition,
const gfx::Rect& initial_pos,
bool user_gesture) {
- Browser* browser = BrowserList::GetLastActiveWithProfile(
+ Browser* browser = browser::FindLastActiveWithProfile(
Profile::FromBrowserContext(new_contents->GetBrowserContext()));
if (!browser)
return;
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc
index 89851e6..942be77 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc
@@ -13,7 +13,7 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/page_navigator.h"
#include "content/public/browser/user_metrics.h"
@@ -190,7 +190,7 @@ void BookmarkContextMenuControllerViews::ExecuteCommand(int id) {
case IDC_BOOKMARK_MANAGER: {
content::RecordAction(UserMetricsAction("ShowBookmarkManager"));
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
if (!browser) NOTREACHED();
if (selection_.size() != 1)
diff --git a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
index ad519fb..6b348bd 100644
--- a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/extensions/bundle_installer.h"
#include "chrome/browser/extensions/extension_install_dialog.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/extensions/extension.h"
@@ -352,7 +353,7 @@ void ShowExtensionInstallDialogImpl(
Profile* profile,
ExtensionInstallUI::Delegate* delegate,
const ExtensionInstallUI::Prompt& prompt) {
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
+ Browser* browser = browser::FindLastActiveWithProfile(profile);
if (!browser) {
delegate->InstallUIAbort(false);
return;
diff --git a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
index 5cd0a2f..bfebd0e 100644
--- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
@@ -8,7 +8,8 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/extensions/extension_uninstall_dialog.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/extensions/extension.h"
#include "grit/generated_resources.h"
@@ -46,7 +47,7 @@ gfx::NativeWindow GetParent(Profile* profile) {
return app_list;
#endif
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
+ Browser* browser = browser::FindLastActiveWithProfile(profile);
if (browser && browser->window())
return browser->window()->GetNativeHandle();
diff --git a/chrome/browser/ui/views/first_run_bubble.cc b/chrome/browser/ui/views/first_run_bubble.cc
index 25a4546..6aec578 100644
--- a/chrome/browser/ui/views/first_run_bubble.cc
+++ b/chrome/browser/ui/views/first_run_bubble.cc
@@ -7,7 +7,8 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/search_engines/util.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
@@ -95,7 +96,7 @@ void FirstRunBubble::LinkClicked(views::Link* source, int event_flags) {
first_run::LogFirstRunMetric(first_run::FIRST_RUN_BUBBLE_CHANGE_INVOKED);
// Get |profile_|'s browser before closing the bubble, which deletes |this|.
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
GetWidget()->Close();
if (browser)
browser->OpenSearchEngineOptionsDialog();
diff --git a/chrome/browser/ui/views/frame/app_non_client_frame_view_aura_browsertest.cc b/chrome/browser/ui/views/frame/app_non_client_frame_view_aura_browsertest.cc
index f157d42..b0c35b6 100644
--- a/chrome/browser/ui/views/frame/app_non_client_frame_view_aura_browsertest.cc
+++ b/chrome/browser/ui/views/frame/app_non_client_frame_view_aura_browsertest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/views/frame/app_non_client_frame_view_aura.h"
@@ -94,6 +95,5 @@ IN_PROC_BROWSER_TEST_F(AppNonClientFrameViewAuraTest, ClickClose) {
eg.ClickLeftButton();
signal.Wait();
EXPECT_EQ(1,
- static_cast<int>(
- BrowserList::GetBrowserCount(browser()->profile())));
+ static_cast<int>(browser::GetBrowserCount(browser()->profile())));
}
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 9a8d6fb..1f2823d 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/browser_dialogs.h"
@@ -1019,7 +1020,7 @@ void LocationBarView::RefreshPageActionViews() {
WebContents* contents = GetWebContentsFromDelegate(delegate_);
if (!page_action_views_.empty() && contents) {
Browser* browser =
- Browser::GetBrowserForController(&contents->GetController(), NULL);
+ browser::FindBrowserForController(&contents->GetController(), NULL);
GURL url = browser->GetSelectedWebContents()->GetURL();
for (PageActionViews::const_iterator i(page_action_views_.begin());
diff --git a/chrome/browser/ui/views/sad_tab_view.cc b/chrome/browser/ui/views/sad_tab_view.cc
index 566cf9b..0da6523 100644
--- a/chrome/browser/ui/views/sad_tab_view.cc
+++ b/chrome/browser/ui/views/sad_tab_view.cc
@@ -11,6 +11,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/feedback/feedback_util.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/webui/feedback_ui.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/navigation_controller.h"
@@ -119,7 +120,8 @@ void SadTabView::LinkClicked(views::Link* source, int event_flags) {
web_contents_->OpenURL(params);
} else if (source == feedback_link_) {
browser::ShowWebFeedbackView(
- Browser::GetBrowserForController(&web_contents_->GetController(), NULL),
+ browser::FindBrowserForController(&web_contents_->GetController(),
+ NULL),
l10n_util::GetStringUTF8(IDS_KILLED_TAB_FEEDBACK_MESSAGE),
std::string(kCategoryTagCrash));
}
diff --git a/chrome/browser/ui/views/select_file_dialog_extension.cc b/chrome/browser/ui/views/select_file_dialog_extension.cc
index 59dc61e..0d820cf 100644
--- a/chrome/browser/ui/views/select_file_dialog_extension.cc
+++ b/chrome/browser/ui/views/select_file_dialog_extension.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/sessions/restore_tab_helper.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
@@ -247,7 +248,7 @@ void SelectFileDialogExtension::SelectFileImpl(
}
// Extension background pages may not supply an owner_window.
owner_browser_ = (owner_window ?
- BrowserList::FindBrowserWithWindow(owner_window) :
+ browser::FindBrowserWithWindow(owner_window) :
BrowserList::GetLastActive());
if (!owner_browser_) {
NOTREACHED() << "Can't find owning browser";
diff --git a/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc b/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc
index 0cfe145c..1a548a2 100644
--- a/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/chromeos/input_method/xkeyboard.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
diff --git a/chrome/browser/ui/webui/help/help_handler.cc b/chrome/browser/ui/webui/help/help_handler.cc
index 6ab1e71..7cf3454 100644
--- a/chrome/browser/ui/webui/help/help_handler.cc
+++ b/chrome/browser/ui/webui/help/help_handler.cc
@@ -17,7 +17,7 @@
#include "chrome/browser/google/google_util.h"
#include "chrome/browser/policy/browser_policy_connector.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/url_constants.h"
@@ -295,14 +295,14 @@ void HelpHandler::RelaunchNow(const ListValue* args) {
void HelpHandler::OpenFeedbackDialog(const ListValue* args) {
DCHECK(args->empty());
- Browser* browser = BrowserList::FindBrowserWithWebContents(
+ Browser* browser = browser::FindBrowserWithWebContents(
web_ui()->GetWebContents());
browser->OpenFeedbackDialog();
}
void HelpHandler::OpenHelpPage(const base::ListValue* args) {
DCHECK(args->empty());
- Browser* browser = BrowserList::FindBrowserWithWebContents(
+ Browser* browser = browser::FindBrowserWithWebContents(
web_ui()->GetWebContents());
browser->ShowHelpTab();
}
diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc
index 5c6adce..1f3c0fa 100644
--- a/chrome/browser/ui/webui/history_ui.cc
+++ b/chrome/browser/ui/webui/history_ui.cc
@@ -24,7 +24,7 @@
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
#include "chrome/browser/ui/webui/favicon_source.h"
@@ -286,7 +286,7 @@ void BrowsingHistoryHandler::HandleClearBrowsingData(const ListValue* args) {
// TODO(beng): This is an improper direct dependency on Browser. Route this
// through some sort of delegate.
Profile* profile = Profile::FromWebUI(web_ui());
- Browser* browser = BrowserList::FindBrowserWithProfile(profile);
+ Browser* browser = browser::FindBrowserWithProfile(profile);
if (browser)
browser->OpenClearBrowsingDataDialog();
#endif
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index 2a05454..e56bcef 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -28,7 +28,7 @@
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
@@ -558,7 +558,7 @@ void AppLauncherHandler::HandleLaunchApp(const ListValue* args) {
// To give a more "launchy" experience when using the NTP launcher, we close
// it automatically.
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
+ Browser* browser = browser::FindLastActiveWithProfile(profile);
WebContents* old_contents = NULL;
if (browser)
old_contents = browser->GetSelectedWebContents();
@@ -630,7 +630,7 @@ void AppLauncherHandler::HandleCreateAppShortcut(const ListValue* args) {
if (!extension)
return;
- Browser* browser = BrowserList::GetLastActiveWithProfile(
+ Browser* browser = browser::FindLastActiveWithProfile(
extension_service_->profile());
if (!browser)
return;
diff --git a/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc b/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc
index fb85261..9821461 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc
@@ -20,7 +20,7 @@
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
#include "chrome/common/pref_names.h"
@@ -127,7 +127,7 @@ void NewTabPageSyncHandler::HandleSyncLinkClicked(const ListValue* args) {
if (!sync_service_->IsSyncEnabled())
return;
Browser* browser =
- BrowserList::FindBrowserWithWebContents(web_ui()->GetWebContents());
+ browser::FindBrowserWithWebContents(web_ui()->GetWebContents());
if (!browser || browser->IsAttemptingToCloseBrowser())
return;
browser->ShowSyncSetup(SyncPromoUI::SOURCE_NTP_LINK);
diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
index 9c51c9d..2f79470 100644
--- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
@@ -23,7 +23,7 @@
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
@@ -127,7 +127,7 @@ void NTPLoginHandler::HandleShowSyncLoginUI(const ListValue* args) {
std::string username = profile->GetPrefs()->GetString(
prefs::kGoogleServicesUsername);
content::WebContents* web_contents = web_ui()->GetWebContents();
- Browser* browser = BrowserList::FindBrowserWithWebContents(web_contents);
+ Browser* browser = browser::FindBrowserWithWebContents(web_contents);
if (!browser)
return;
@@ -185,7 +185,7 @@ void NTPLoginHandler::HandleLoginMessageSeen(const ListValue* args) {
void NTPLoginHandler::HandleShowAdvancedLoginUI(const ListValue* args) {
Browser* browser =
- BrowserList::FindBrowserWithWebContents(web_ui()->GetWebContents());
+ browser::FindBrowserWithWebContents(web_ui()->GetWebContents());
if (browser)
browser->ShowSyncSetup(SyncPromoUI::SOURCE_NTP_LINK);
}
diff --git a/chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.cc
index e8310ea..f2fa95e 100644
--- a/chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler2.cc
@@ -16,7 +16,7 @@
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/options/take_photo_dialog.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/webui/web_ui_util.h"
#include "chrome/common/chrome_notification_types.h"
@@ -339,7 +339,7 @@ void ChangePictureOptionsHandler::Observe(
gfx::NativeWindow ChangePictureOptionsHandler::GetBrowserWindow() const {
Browser* browser =
- BrowserList::FindBrowserWithProfile(Profile::FromWebUI(web_ui()));
+ browser::FindBrowserWithProfile(Profile::FromWebUI(web_ui()));
if (!browser)
return NULL;
return browser->window()->GetNativeHandle();
diff --git a/chrome/browser/ui/webui/options2/chromeos/cros_language_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/cros_language_options_handler2.cc
index 484e598..e8479cc 100644
--- a/chrome/browser/ui/webui/options2/chromeos/cros_language_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/cros_language_options_handler2.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/chromeos/input_method/input_method_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
@@ -217,7 +218,7 @@ void CrosLanguageOptionsHandler::SetApplicationLocale(
void CrosLanguageOptionsHandler::RestartCallback(const ListValue* args) {
content::RecordAction(UserMetricsAction("LanguageOptions_SignOut"));
- Browser* browser = Browser::GetBrowserForController(
+ Browser* browser = browser::FindBrowserForController(
&web_ui()->GetWebContents()->GetController(), NULL);
if (browser)
browser->ExecuteCommand(IDC_EXIT);
diff --git a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc
index b7fade7..de19737 100644
--- a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc
@@ -40,7 +40,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/webui/web_ui_util.h"
#include "chrome/common/chrome_notification_types.h"
@@ -541,7 +541,7 @@ void InternetOptionsHandler::DisableCellularCallback(const ListValue* args) {
void InternetOptionsHandler::ShowMorePlanInfoCallback(const ListValue* args) {
if (!web_ui())
return;
- Browser* browser = BrowserList::FindBrowserWithFeature(
+ Browser* browser = browser::FindBrowserWithFeature(
Profile::FromWebUI(web_ui()), Browser::FEATURE_TABSTRIP);
if (!browser)
return;
@@ -1057,12 +1057,12 @@ gfx::NativeWindow InternetOptionsHandler::GetNativeWindow() const {
// TODO(beng): This is an improper direct dependency on Browser. Route this
// through some sort of delegate.
Browser* browser =
- BrowserList::FindBrowserWithProfile(Profile::FromWebUI(web_ui()));
+ browser::FindBrowserWithProfile(Profile::FromWebUI(web_ui()));
return browser->window()->GetNativeHandle();
}
Browser* InternetOptionsHandler::GetAppropriateBrowser() {
- return Browser::GetOrCreateTabbedBrowser(
+ return browser::FindOrCreateTabbedBrowser(
ProfileManager::GetDefaultProfileOrOffTheRecord());
}
diff --git a/chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler2.cc
index e2dc781..2b113b1 100644
--- a/chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler2.cc
@@ -15,7 +15,7 @@
#include "base/values.h"
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/webui/options2/chromeos/wallpaper_thumbnail_source2.h"
#include "chrome/browser/ui/webui/web_ui_util.h"
@@ -237,7 +237,7 @@ void SetWallpaperOptionsHandler::HandleRandomWallpaper(const ListValue* args) {
gfx::NativeWindow SetWallpaperOptionsHandler::GetBrowserWindow() const {
Browser* browser =
- BrowserList::FindBrowserWithProfile(Profile::FromWebUI(web_ui()));
+ browser::FindBrowserWithProfile(Profile::FromWebUI(web_ui()));
if (!browser)
return NULL;
return browser->window()->GetNativeHandle();
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
index 494c6dc..33793f7 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -34,6 +34,7 @@
#include "chrome/browser/printing/print_view_manager.h"
#include "chrome/browser/printing/printer_manager_dialog.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
diff --git a/chrome/browser/ui/webui/signin/login_ui_service.cc b/chrome/browser/ui/webui/signin/login_ui_service.cc
index e6d2a98..2116928 100644
--- a/chrome/browser/ui/webui/signin/login_ui_service.cc
+++ b/chrome/browser/ui/webui/signin/login_ui_service.cc
@@ -6,7 +6,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/url_constants.h"
@@ -36,7 +36,7 @@ void LoginUIService::ShowLoginUI() {
// Need to navigate to the settings page and display the UI.
if (profile_) {
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ Browser* browser = browser::FindLastActiveWithProfile(profile_);
if (!browser) {
browser = Browser::Create(profile_);
browser->ShowOptionsTab(chrome::kSyncSetupSubPage);
diff --git a/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc b/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc
index 5ff70903..c9ee318 100644
--- a/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc
+++ b/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc
@@ -13,7 +13,7 @@
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h"
#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
@@ -192,7 +192,7 @@ void SyncPromoHandler::HandleCloseSyncPromo(const base::ListValue* args) {
// If the browser window is being closed then don't try to navigate to another
// URL. This prevents the browser window from flashing during close.
Browser* browser =
- BrowserList::FindBrowserWithWebContents(web_ui()->GetWebContents());
+ browser::FindBrowserWithWebContents(web_ui()->GetWebContents());
if (!browser || !browser->IsAttemptingToCloseBrowser()) {
GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL(
web_ui()->GetWebContents()->GetURL());
diff --git a/chrome/browser/ui/webui/sync_setup_handler.cc b/chrome/browser/ui/webui/sync_setup_handler.cc
index 66e5aaf..47d3aa3 100644
--- a/chrome/browser/ui/webui/sync_setup_handler.cc
+++ b/chrome/browser/ui/webui/sync_setup_handler.cc
@@ -23,6 +23,7 @@
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 27ea9f9..fbff207 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2305,6 +2305,8 @@
'browser/ui/browser_content_setting_bubble_model_delegate.cc',
'browser/ui/browser_content_setting_bubble_model_delegate.h',
'browser/ui/browser_dialogs.h',
+ 'browser/ui/browser_finder.cc',
+ 'browser/ui/browser_finder.h',
'browser/ui/browser_list.cc',
'browser/ui/browser_list.h',
'browser/ui/browser_list_aura.cc',
diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc
index 5570fc1..62c7fc8 100644
--- a/chrome/test/base/ui_test_utils.cc
+++ b/chrome/test/base/ui_test_utils.cc
@@ -34,6 +34,7 @@
#include "chrome/browser/tab_contents/thumbnail_generator.h"
#include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_window.h"
@@ -378,7 +379,7 @@ Browser* WaitForBrowserNotInSet(std::set<Browser*> excluded_browsers) {
void OpenURLOffTheRecord(Profile* profile, const GURL& url) {
Browser::OpenURLOffTheRecord(profile, url);
- Browser* browser = BrowserList::FindTabbedBrowser(
+ Browser* browser = browser::FindTabbedBrowser(
profile->GetOffTheRecordProfile(), false);
WaitForNavigations(&browser->GetSelectedWebContents()->GetController(), 1);
}