diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-09 13:39:25 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-09 13:39:25 +0000 |
commit | 75072736267b699320cb3a5b253f01dbaeed9153 (patch) | |
tree | eb9f858702217d0c5809f78eaf299e4061bb6ff1 | |
parent | c57cd8ea2b1742f30615ffd6b80dba8c5005cc2e (diff) | |
download | chromium_src-75072736267b699320cb3a5b253f01dbaeed9153.zip chromium_src-75072736267b699320cb3a5b253f01dbaeed9153.tar.gz chromium_src-75072736267b699320cb3a5b253f01dbaeed9153.tar.bz2 |
browser: Move FindTabbedBrowser() function into chrome namespace.
BUG=133088
TBR=ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11779019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175792 0039d316-1c4b-4281-b951-d872f2087c98
22 files changed, 51 insertions, 61 deletions
diff --git a/chrome/browser/captive_portal/captive_portal_browsertest.cc b/chrome/browser/captive_portal/captive_portal_browsertest.cc index fe36271..255851e 100644 --- a/chrome/browser/captive_portal/captive_portal_browsertest.cc +++ b/chrome/browser/captive_portal/captive_portal_browsertest.cc @@ -2070,8 +2070,8 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, DISABLED_TwoWindows) { // when running multiple tests at once, the original browser window may // remain the profile's active window. Browser* active_browser = - browser::FindTabbedBrowser(browser()->profile(), true, - browser()->host_desktop_type()); + chrome::FindTabbedBrowser(browser()->profile(), true, + browser()->host_desktop_type()); Browser* inactive_browser; if (active_browser == browser2) { // When only one test is running at a time, the new browser will probably be @@ -2100,8 +2100,8 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, DISABLED_TwoWindows) { // Make sure the active window hasn't changed, and its new tab is // active. ASSERT_EQ(active_browser, - browser::FindTabbedBrowser(browser()->profile(), true, - browser()->host_desktop_type())); + chrome::FindTabbedBrowser(browser()->profile(), true, + browser()->host_desktop_type())); ASSERT_EQ(1, active_browser->tab_strip_model()->active_index()); // Check that the only two navigated tabs were the new error tab in the diff --git a/chrome/browser/chromeos/enrollment_dialog_view.cc b/chrome/browser/chromeos/enrollment_dialog_view.cc index ad83fe6..cfab93d 100644 --- a/chrome/browser/chromeos/enrollment_dialog_view.cc +++ b/chrome/browser/chromeos/enrollment_dialog_view.cc @@ -108,8 +108,8 @@ int EnrollmentDialogView::GetDialogButtons() const { bool EnrollmentDialogView::Accept() { // TODO(beng): use Navigate(). // Navigate to the target URI in a browser tab. - Browser* browser = browser::FindTabbedBrowser(profile_, false, - chrome::HOST_DESKTOP_TYPE_ASH); + Browser* browser = chrome::FindTabbedBrowser(profile_, false, + chrome::HOST_DESKTOP_TYPE_ASH); if (!browser) { // Couldn't find a tabbed browser: create one. browser = new Browser( diff --git a/chrome/browser/chromeos/locale_change_guard.cc b/chrome/browser/chromeos/locale_change_guard.cc index 80108ab..d7e6219 100644 --- a/chrome/browser/chromeos/locale_change_guard.cc +++ b/chrome/browser/chromeos/locale_change_guard.cc @@ -84,8 +84,8 @@ void LocaleChangeGuard::RevertLocaleChange() { profile_->ChangeAppLocale( from_locale_, Profile::APP_LOCALE_CHANGED_VIA_REVERT); - Browser* browser = browser::FindTabbedBrowser(profile_, false, - chrome::HOST_DESKTOP_TYPE_ASH); + Browser* browser = chrome::FindTabbedBrowser(profile_, false, + chrome::HOST_DESKTOP_TYPE_ASH); if (browser) chrome::ExecuteCommand(browser, IDC_EXIT); } diff --git a/chrome/browser/chromeos/options/network_config_view.cc b/chrome/browser/chromeos/options/network_config_view.cc index be0fb37..7a2ce90 100644 --- a/chrome/browser/chromeos/options/network_config_view.cc +++ b/chrome/browser/chromeos/options/network_config_view.cc @@ -38,7 +38,7 @@ gfx::NativeWindow GetDialogParent() { if (chromeos::BaseLoginDisplayHost::default_host()) { return chromeos::BaseLoginDisplayHost::default_host()->GetNativeWindow(); } else { - Browser* browser = browser::FindTabbedBrowser( + Browser* browser = chrome::FindTabbedBrowser( ProfileManager::GetDefaultProfileOrOffTheRecord(), true, chrome::HOST_DESKTOP_TYPE_ASH); diff --git a/chrome/browser/extensions/api/tabs/tabs.cc b/chrome/browser/extensions/api/tabs/tabs.cc index 70c976d..342b630 100644 --- a/chrome/browser/extensions/api/tabs/tabs.cc +++ b/chrome/browser/extensions/api/tabs/tabs.cc @@ -237,8 +237,8 @@ Browser* CreateBrowserWindow(const Browser::CreateParams& params, if (use_existing_browser_window) // The false parameter passed below is to ensure that we find a browser // object matching the profile passed in, instead of the original profile - new_window = browser::FindTabbedBrowser( - profile, false, params.host_desktop_type); + new_window = chrome::FindTabbedBrowser(profile, false, + params.host_desktop_type); if (!new_window) new_window = new Browser(params); @@ -999,8 +999,8 @@ bool CreateTabFunction::RunImpl() { // Ensure the selected browser is tabbed. if (!browser->is_type_tabbed() && browser->IsAttemptingToCloseBrowser()) - browser = browser::FindTabbedBrowser(profile(), include_incognito(), - browser->host_desktop_type()); + browser = chrome::FindTabbedBrowser(profile(), include_incognito(), + browser->host_desktop_type()); if (!browser || !browser->window()) return false; @@ -1068,7 +1068,7 @@ bool CreateTabFunction::RunImpl() { Profile* profile = browser->profile()->GetOriginalProfile(); chrome::HostDesktopType desktop_type = browser->host_desktop_type(); - browser = browser::FindTabbedBrowser(profile, false, desktop_type); + browser = chrome::FindTabbedBrowser(profile, false, desktop_type); if (!browser) { browser = new Browser(Browser::CreateParams(Browser::TYPE_TABBED, profile, desktop_type)); diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc index 1ebe3af..c654bf1 100644 --- a/chrome/browser/extensions/extension_tab_util.cc +++ b/chrome/browser/extensions/extension_tab_util.cc @@ -231,9 +231,7 @@ void ExtensionTabUtil::CreateTab(WebContents* web_contents, Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); chrome::HostDesktopType active_desktop = chrome::GetActiveDesktop(); - Browser* browser = browser::FindTabbedBrowser(profile, - false, - active_desktop); + Browser* browser = chrome::FindTabbedBrowser(profile, false, active_desktop); const bool browser_created = !browser; if (!browser) browser = new Browser(Browser::CreateParams(profile, active_desktop)); diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.cc b/chrome/browser/extensions/theme_installed_infobar_delegate.cc index b91f6ba..81bbc39 100644 --- a/chrome/browser/extensions/theme_installed_infobar_delegate.cc +++ b/chrome/browser/extensions/theme_installed_infobar_delegate.cc @@ -33,9 +33,9 @@ void ThemeInstalledInfoBarDelegate::Create( return; // Get last active tabbed browser of profile. - Browser* browser = browser::FindTabbedBrowser(profile, - true, - chrome::GetActiveDesktop()); + Browser* browser = chrome::FindTabbedBrowser(profile, + true, + chrome::GetActiveDesktop()); if (!browser) return; diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index a9e14b6..a082956 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc @@ -507,7 +507,7 @@ void ProfileManager::FindOrCreateNewWindowForProfile( DCHECK(profile); if (!always_create) { - Browser* browser = browser::FindTabbedBrowser(profile, false, desktop_type); + Browser* browser = chrome::FindTabbedBrowser(profile, false, desktop_type); if (browser) { browser->window()->Activate(); return; diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.cc index 17d5bc6..7f868f5 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.cc @@ -745,7 +745,7 @@ void ChromeLauncherControllerPerApp::OnBrowserShortcutClicked( return; } - Browser* last_browser = browser::FindTabbedBrowser( + Browser* last_browser = chrome::FindTabbedBrowser( GetProfileForNewWindows(), true, chrome::HOST_DESKTOP_TYPE_ASH); if (!last_browser) { diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.cc index 03b26bb..bb908a2 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.cc @@ -768,7 +768,7 @@ void ChromeLauncherControllerPerBrowser::OnBrowserShortcutClicked( return; } - Browser* last_browser = browser::FindTabbedBrowser( + Browser* last_browser = chrome::FindTabbedBrowser( GetProfileForNewWindows(), true, chrome::HOST_DESKTOP_TYPE_ASH); if (!last_browser) { diff --git a/chrome/browser/ui/browser_finder.cc b/chrome/browser/ui/browser_finder.cc index ef14ef0..399b8c0 100644 --- a/chrome/browser/ui/browser_finder.cc +++ b/chrome/browser/ui/browser_finder.cc @@ -124,23 +124,19 @@ size_t GetBrowserCountImpl(Profile* profile, } // namespace -namespace browser { +namespace chrome { Browser* FindTabbedBrowser(Profile* profile, bool match_original_profiles, - chrome::HostDesktopType type) { + HostDesktopType type) { return FindBrowserWithTabbedOrAnyType(profile, type, true, match_original_profiles); } -} // namespace browser - -namespace chrome { - Browser* FindOrCreateTabbedBrowser(Profile* profile, HostDesktopType type) { - Browser* browser = browser::FindTabbedBrowser(profile, false, type); + Browser* browser = FindTabbedBrowser(profile, false, type); if (!browser) browser = new Browser(Browser::CreateParams(profile, type)); return browser; diff --git a/chrome/browser/ui/browser_finder.h b/chrome/browser/ui/browser_finder.h index 76e9d2d..494e76e 100644 --- a/chrome/browser/ui/browser_finder.h +++ b/chrome/browser/ui/browser_finder.h @@ -17,7 +17,7 @@ class WebContents; // Collection of functions to find Browsers based on various criteria. -namespace browser { +namespace chrome { // Retrieve the last active tabbed browser with a profile matching |profile|. // If |match_original_profiles| is true, matching is done based on the @@ -28,11 +28,7 @@ namespace browser { // |type| refers to the host desktop the returned browser should belong to. Browser* FindTabbedBrowser(Profile* profile, bool match_original_profiles, - chrome::HostDesktopType type); - -} // namespace browser - -namespace chrome { + HostDesktopType type); // Returns the first tabbed browser matching |profile|. If there is no tabbed // browser a new one is created and returned for the desktop specified by diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index aa3adea..a3ad3eb 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc @@ -67,8 +67,8 @@ bool WindowCanOpenTabs(Browser* browser) { // such Browser is located. Browser* GetOrCreateBrowser(Profile* profile, chrome::HostDesktopType host_desktop_type) { - Browser* browser = - browser::FindTabbedBrowser(profile, false, host_desktop_type); + Browser* browser = chrome::FindTabbedBrowser(profile, false, + host_desktop_type); return browser ? browser : new Browser( Browser::CreateParams(profile, host_desktop_type)); } diff --git a/chrome/browser/ui/browser_win.cc b/chrome/browser/ui/browser_win.cc index 317732f..5c477f9 100644 --- a/chrome/browser/ui/browser_win.cc +++ b/chrome/browser/ui/browser_win.cc @@ -26,8 +26,8 @@ void NewWindowMaybeMetro(Browser* source_browser, Profile* profile) { ::GetProcAddress(base::win::GetMetroModule(), "FlipFrameWindows")); DCHECK(flip_window_fn); - Browser* browser = - browser::FindTabbedBrowser(profile, false, host_desktop_type); + Browser* browser = chrome::FindTabbedBrowser(profile, false, + host_desktop_type); if (!browser) { chrome::OpenEmptyWindow(profile); 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 68da741..9f3c8fd 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm @@ -89,9 +89,9 @@ const NSUInteger kMaximumMenuPixelsWide = 300; // Open the URL of the given BookmarkNode in the current tab. - (void)openURLForNode:(const BookmarkNode*)node { Browser* browser = - browser::FindTabbedBrowser(bridge_->GetProfile(), - true, - chrome::HOST_DESKTOP_TYPE_NATIVE); + chrome::FindTabbedBrowser(bridge_->GetProfile(), + true, + chrome::HOST_DESKTOP_TYPE_NATIVE); if (!browser) browser = new Browser(Browser::CreateParams(bridge_->GetProfile())); WindowOpenDisposition disposition = @@ -111,9 +111,9 @@ const NSUInteger kMaximumMenuPixelsWide = 300; DCHECK(node); Browser* browser = - browser::FindTabbedBrowser(bridge_->GetProfile(), - true, - chrome::HOST_DESKTOP_TYPE_NATIVE); + chrome::FindTabbedBrowser(bridge_->GetProfile(), + true, + chrome::HOST_DESKTOP_TYPE_NATIVE); if (!browser) browser = new Browser(Browser::CreateParams(bridge_->GetProfile())); DCHECK(browser); diff --git a/chrome/browser/ui/extensions/application_launch.cc b/chrome/browser/ui/extensions/application_launch.cc index 4549ed2..2d84db4 100644 --- a/chrome/browser/ui/extensions/application_launch.cc +++ b/chrome/browser/ui/extensions/application_launch.cc @@ -142,9 +142,9 @@ WebContents* OpenApplicationTab(Profile* profile, const Extension* extension, const GURL& override_url, WindowOpenDisposition disposition) { - Browser* browser = browser::FindTabbedBrowser(profile, - false, - chrome::GetActiveDesktop()); + Browser* browser = chrome::FindTabbedBrowser(profile, + false, + chrome::GetActiveDesktop()); WebContents* contents = NULL; if (!browser) { // No browser for this profile, need to open a new one. diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc index 523df9b..01c0823 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc @@ -598,8 +598,8 @@ void StartupBrowserCreatorImpl::ProcessLaunchURLs( return; } else if (!command_line_.HasSwitch(switches::kOpenInNewWindow)) { // Always open a list of urls in a window on the native desktop. - browser = browser::FindTabbedBrowser(profile_, false, - chrome::HOST_DESKTOP_TYPE_NATIVE); + browser = chrome::FindTabbedBrowser(profile_, false, + chrome::HOST_DESKTOP_TYPE_NATIVE); } // This will launch a browser; prevent session restore. StartupBrowserCreator::in_synchronous_profile_launch_ = true; diff --git a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views_win.cc b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views_win.cc index b7912f8..04a986e 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views_win.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views_win.cc @@ -124,9 +124,9 @@ void BookmarkContextMenuControllerViewsWin::ExecuteCommand(int id) { // TODO(robertshield): FTB - Switch this to HOST_DESKTOP_TYPE_ASH when // we make that the default for metro. Browser* browser = - browser::FindTabbedBrowser(profile_to_use, - false, - chrome::HOST_DESKTOP_TYPE_NATIVE); + chrome::FindTabbedBrowser(profile_to_use, + false, + chrome::HOST_DESKTOP_TYPE_NATIVE); content::PageNavigator* navigator = NULL; if (!browser || !chrome::GetActiveWebContents(browser)) { navigator = &navigator_impl; diff --git a/chrome/browser/ui/views/frame/browser_frame_win.cc b/chrome/browser/ui/views/frame/browser_frame_win.cc index 4103d57..2c26453 100644 --- a/chrome/browser/ui/views/frame/browser_frame_win.cc +++ b/chrome/browser/ui/views/frame/browser_frame_win.cc @@ -408,7 +408,7 @@ void BrowserFrameWin::ButtonPressed(views::Button* sender, DCHECK(profile_to_switch_to); - Browser* browser_to_switch_to = browser::FindTabbedBrowser( + Browser* browser_to_switch_to = chrome::FindTabbedBrowser( profile_to_switch_to, false, chrome::HOST_DESKTOP_TYPE_NATIVE); DCHECK(browser_to_switch_to); diff --git a/chrome/browser/ui/views/tab_contents/render_view_context_menu_win.cc b/chrome/browser/ui/views/tab_contents/render_view_context_menu_win.cc index 43fdc0c..115e103 100644 --- a/chrome/browser/ui/views/tab_contents/render_view_context_menu_win.cc +++ b/chrome/browser/ui/views/tab_contents/render_view_context_menu_win.cc @@ -59,9 +59,9 @@ void RenderViewContextMenuWin::ExecuteCommand(int command_id, // TODO(robertshield): FTB - Switch this to HOST_DESKTOP_TYPE_ASH when // we make that the default for metro. Browser* browser = - browser::FindTabbedBrowser(profile_->GetOriginalProfile(), - false, - chrome::HOST_DESKTOP_TYPE_NATIVE); + chrome::FindTabbedBrowser(profile_->GetOriginalProfile(), + false, + chrome::HOST_DESKTOP_TYPE_NATIVE); if (browser) { content::OpenURLParams url_params( params_.link_url, diff --git a/chrome/browser/ui/webui/chrome_web_contents_handler.cc b/chrome/browser/ui/webui/chrome_web_contents_handler.cc index dd857dd..36c632b 100644 --- a/chrome/browser/ui/webui/chrome_web_contents_handler.cc +++ b/chrome/browser/ui/webui/chrome_web_contents_handler.cc @@ -44,7 +44,7 @@ WebContents* ChromeWebContentsHandler::OpenURLFromTab( desktop_type = source_browser->host_desktop_type(); } - Browser* browser = browser::FindTabbedBrowser(profile, false, desktop_type); + Browser* browser = chrome::FindTabbedBrowser(profile, false, desktop_type); const bool browser_created = !browser; if (!browser) browser = new Browser( @@ -94,7 +94,7 @@ void ChromeWebContentsHandler::AddNewContents( desktop_type = source_browser->host_desktop_type(); } - Browser* browser = browser::FindTabbedBrowser(profile, false, desktop_type); + Browser* browser = chrome::FindTabbedBrowser(profile, false, desktop_type); const bool browser_created = !browser; if (!browser) browser = new Browser( diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index 745da50..e2dc14d 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc @@ -220,7 +220,7 @@ Browser* WaitForBrowserNotInSet(std::set<Browser*> excluded_browsers) { Browser* OpenURLOffTheRecord(Profile* profile, const GURL& url) { chrome::OpenURLOffTheRecord(profile, url, chrome::HOST_DESKTOP_TYPE_NATIVE); - Browser* browser = browser::FindTabbedBrowser( + Browser* browser = chrome::FindTabbedBrowser( profile->GetOffTheRecordProfile(), false, chrome::HOST_DESKTOP_TYPE_NATIVE); |