summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-04 01:29:09 +0000
committerrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-04 01:29:09 +0000
commit3b14b7f2ed2cb6d613dc900c22eaf20d9ee1cec4 (patch)
tree882491cfc91da9b58125812096cc5ac98fb291e6
parent4bea86d44d7ada7ecc43695df42010c59e28b32a (diff)
downloadchromium_src-3b14b7f2ed2cb6d613dc900c22eaf20d9ee1cec4.zip
chromium_src-3b14b7f2ed2cb6d613dc900c22eaf20d9ee1cec4.tar.gz
chromium_src-3b14b7f2ed2cb6d613dc900c22eaf20d9ee1cec4.tar.bz2
Add desktop type context to most existing instances of FindTabbedBrowser.
BUG=129187 TEST=NONE Review URL: https://codereview.chromium.org/10967003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160039 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc7
-rw-r--r--chrome/browser/bookmarks/DEPS1
-rw-r--r--chrome/browser/bookmarks/bookmark_browsertest.cc4
-rw-r--r--chrome/browser/captive_portal/captive_portal_browsertest.cc6
-rw-r--r--chrome/browser/captive_portal/captive_portal_tab_helper.cc4
-rw-r--r--chrome/browser/captive_portal/captive_portal_tab_helper.h6
-rw-r--r--chrome/browser/chromeos/enrollment_dialog_view.cc9
-rw-r--r--chrome/browser/chromeos/extensions/file_handler_util.cc4
-rw-r--r--chrome/browser/chromeos/extensions/file_manager_util.cc8
-rw-r--r--chrome/browser/chromeos/extensions/wallpaper_manager_util.cc4
-rw-r--r--chrome/browser/chromeos/locale_change_guard.cc4
-rw-r--r--chrome/browser/chromeos/network_message_observer.cc4
-rw-r--r--chrome/browser/chromeos/options/network_config_view.cc5
-rw-r--r--chrome/browser/chromeos/status/network_menu.cc7
-rw-r--r--chrome/browser/chromeos/system/ash_system_tray_delegate.cc4
-rw-r--r--chrome/browser/download/download_browsertest.cc4
-rw-r--r--chrome/browser/extensions/api/test/test_api.cc3
-rw-r--r--chrome/browser/platform_util_chromeos.cc4
-rw-r--r--chrome/browser/profiles/avatar_menu_model.cc19
-rw-r--r--chrome/browser/profiles/profile_manager.cc36
-rw-r--r--chrome/browser/profiles/profile_manager.h13
-rw-r--r--chrome/browser/profiles/profile_manager_browsertest.cc10
-rw-r--r--chrome/browser/protector/protector_service.cc13
-rw-r--r--chrome/browser/protector/settings_change_global_error.cc19
-rw-r--r--chrome/browser/protector/settings_change_global_error.h13
-rw-r--r--chrome/browser/task_manager/task_manager.cc1
-rw-r--r--chrome/browser/ui/ash/chrome_shell_delegate.cc7
-rw-r--r--chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc2
-rw-r--r--chrome/browser/ui/browser_commands.cc10
-rw-r--r--chrome/browser/ui/browser_commands.h11
-rw-r--r--chrome/browser/ui/browser_finder.cc19
-rw-r--r--chrome/browser/ui/browser_finder.h19
-rw-r--r--chrome/browser/ui/browser_navigator.cc33
-rw-r--r--chrome/browser/ui/browser_navigator.h5
-rw-r--r--chrome/browser/ui/browser_win.cc6
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm10
-rw-r--r--chrome/browser/ui/cocoa/history_menu_cocoa_controller.mm5
-rw-r--r--chrome/browser/ui/views/ash/balloon_collection_impl_ash.cc4
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views_win.cc8
-rw-r--r--chrome/browser/ui/views/tab_contents/render_view_context_menu_win.cc8
-rw-r--r--chrome/browser/ui/webui/chrome_web_contents_handler.cc27
-rw-r--r--chrome/browser/ui/webui/options/browser_options_handler.cc16
-rw-r--r--chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc4
-rw-r--r--chrome/browser/ui/webui/options/manage_profile_handler.cc9
-rw-r--r--chrome/test/base/ui_test_utils.cc7
45 files changed, 323 insertions, 99 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index b16f73f..8943336a 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -103,6 +103,7 @@
#include "chrome/browser/ui/find_bar/find_bar_controller.h"
#include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
#include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/login/login_prompt.h"
#include "chrome/browser/ui/media_stream_infobar_delegate.h"
#include "chrome/browser/ui/omnibox/location_bar.h"
@@ -1090,7 +1091,8 @@ void TestingAutomationProvider::OpenNewBrowserWindowWithNewProfile(
ProfileManager* profile_manager = g_browser_process->profile_manager();
new BrowserOpenedWithNewProfileNotificationObserver(this, reply_message);
profile_manager->CreateMultiProfileAsync(
- string16(), string16(), ProfileManager::CreateCallback());
+ string16(), string16(), ProfileManager::CreateCallback(),
+ chrome::HOST_DESKTOP_TYPE_NATIVE);
}
// Sample json input: { "command": "GetMultiProfileInfo" }
@@ -1195,7 +1197,8 @@ void TestingAutomationProvider::OpenProfileWindow(
profile,
chrome::startup::IS_NOT_PROCESS_STARTUP,
chrome::startup::IS_NOT_FIRST_RUN,
- 0);
+ chrome::HOST_DESKTOP_TYPE_NATIVE,
+ false);
}
void TestingAutomationProvider::GetWindowForBrowser(int browser_handle,
diff --git a/chrome/browser/bookmarks/DEPS b/chrome/browser/bookmarks/DEPS
index d17afcd1..0d127cf 100644
--- a/chrome/browser/bookmarks/DEPS
+++ b/chrome/browser/bookmarks/DEPS
@@ -58,5 +58,6 @@ specific_include_rules = {
"!chrome/browser/importer/firefox2_importer.h",
"!chrome/browser/profiles/profile_manager.h",
"!chrome/browser/ui/browser_commands.h",
+ "!chrome/browser/ui/host_desktop.h",
]
}
diff --git a/chrome/browser/bookmarks/bookmark_browsertest.cc b/chrome/browser/bookmarks/bookmark_browsertest.cc
index 1260d3c..e162600 100644
--- a/chrome/browser/bookmarks/bookmark_browsertest.cc
+++ b/chrome/browser/bookmarks/bookmark_browsertest.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -110,7 +111,8 @@ IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, MultiProfile) {
ui_test_utils::BrowserAddedObserver observer;
g_browser_process->profile_manager()->CreateMultiProfileAsync(
- string16(), string16(), ProfileManager::CreateCallback());
+ string16(), string16(), ProfileManager::CreateCallback(),
+ chrome::HOST_DESKTOP_TYPE_NATIVE);
Browser* browser2 = observer.WaitForSingleNewBrowser();
BookmarkModel* bookmark_model2 = WaitForBookmarkModel(browser2->profile());
diff --git a/chrome/browser/captive_portal/captive_portal_browsertest.cc b/chrome/browser/captive_portal/captive_portal_browsertest.cc
index f002f6c..ba36a60 100644
--- a/chrome/browser/captive_portal/captive_portal_browsertest.cc
+++ b/chrome/browser/captive_portal/captive_portal_browsertest.cc
@@ -2057,7 +2057,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::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
@@ -2086,7 +2087,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::FindTabbedBrowser(browser()->profile(), true,
+ browser()->host_desktop_type()));
ASSERT_EQ(1, active_browser->active_index());
// Check that the only two navigated tabs were the new error tab in the
diff --git a/chrome/browser/captive_portal/captive_portal_tab_helper.cc b/chrome/browser/captive_portal/captive_portal_tab_helper.cc
index 797ab24..2937a22 100644
--- a/chrome/browser/captive_portal/captive_portal_tab_helper.cc
+++ b/chrome/browser/captive_portal/captive_portal_tab_helper.cc
@@ -43,6 +43,7 @@ CaptivePortalTabHelper::CaptivePortalTabHelper(
base::Bind(&CaptivePortalTabHelper::OpenLoginTab,
base::Unretained(this)))),
login_detector_(new CaptivePortalLoginDetector(profile_)),
+ web_contents_(web_contents),
pending_error_code_(net::OK),
provisional_render_view_host_(NULL) {
registrar_.Add(this,
@@ -238,7 +239,8 @@ CaptivePortalTabReloader* CaptivePortalTabHelper::GetTabReloaderForTest() {
}
void CaptivePortalTabHelper::OpenLoginTab() {
- Browser* browser = browser::FindTabbedBrowser(profile_, true);
+ Browser* browser = browser::FindBrowserWithWebContents(web_contents_);
+
// If the Profile doesn't have a tabbed browser window open, do nothing.
if (!browser)
return;
diff --git a/chrome/browser/captive_portal/captive_portal_tab_helper.h b/chrome/browser/captive_portal/captive_portal_tab_helper.h
index c515874..0527afa 100644
--- a/chrome/browser/captive_portal/captive_portal_tab_helper.h
+++ b/chrome/browser/captive_portal/captive_portal_tab_helper.h
@@ -19,6 +19,10 @@
class GURL;
class Profile;
+namespace content {
+ class WebContents;
+}
+
namespace net {
class SSLInfo;
}
@@ -138,6 +142,8 @@ class CaptivePortalTabHelper
scoped_ptr<CaptivePortalTabReloader> tab_reloader_;
scoped_ptr<CaptivePortalLoginDetector> login_detector_;
+ content::WebContents* web_contents_;
+
// If a provisional load has failed, and the tab is loading an error page, the
// error code associated with the error page we're loading.
// net::OK, otherwise.
diff --git a/chrome/browser/chromeos/enrollment_dialog_view.cc b/chrome/browser/chromeos/enrollment_dialog_view.cc
index ea41927..7b15796 100644
--- a/chrome/browser/chromeos/enrollment_dialog_view.cc
+++ b/chrome/browser/chromeos/enrollment_dialog_view.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_tabstrip.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/common/url_constants.h"
#include "content/public/common/page_transition_types.h"
#include "grit/generated_resources.h"
@@ -110,10 +111,14 @@ 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);
+ Browser* browser = browser::FindTabbedBrowser(profile_, false,
+ chrome::HOST_DESKTOP_TYPE_ASH);
if (!browser) {
// Couldn't find a tabbed browser: create one.
- browser = new Browser(Browser::CreateParams(profile_));
+ browser = new Browser(
+ Browser::CreateParams(Browser::TYPE_TABBED,
+ profile_,
+ chrome::HOST_DESKTOP_TYPE_ASH));
}
DCHECK(browser);
chrome::AddSelectedTabWithURL(browser, target_uri_,
diff --git a/chrome/browser/chromeos/extensions/file_handler_util.cc b/chrome/browser/chromeos/extensions/file_handler_util.cc
index 18058dc..7a505c6 100644
--- a/chrome/browser/chromeos/extensions/file_handler_util.cc
+++ b/chrome/browser/chromeos/extensions/file_handler_util.cc
@@ -27,6 +27,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_tabstrip.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/common/extensions/file_browser_handler.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h"
@@ -603,7 +604,8 @@ bool FileTaskExecutor::Execute(const std::vector<GURL>& file_urls) {
Browser* FileTaskExecutor::GetBrowser() const {
return browser::FindOrCreateTabbedBrowser(
- profile_ ? profile_ : ProfileManager::GetDefaultProfileOrOffTheRecord());
+ profile_ ? profile_ : ProfileManager::GetDefaultProfileOrOffTheRecord(),
+ chrome::HOST_DESKTOP_TYPE_ASH);
}
const Extension* FileTaskExecutor::GetExtension() {
diff --git a/chrome/browser/chromeos/extensions/file_manager_util.cc b/chrome/browser/chromeos/extensions/file_manager_util.cc
index 0355a45..d444856 100644
--- a/chrome/browser/chromeos/extensions/file_manager_util.cc
+++ b/chrome/browser/chromeos/extensions/file_manager_util.cc
@@ -32,6 +32,7 @@
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/extensions/application_launch.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/simple_message_box.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
@@ -206,7 +207,8 @@ DictionaryValue* ProgessStatusToDictionaryValue(
void OpenNewTab(const GURL& url, Profile* profile) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
Browser* browser = browser::FindOrCreateTabbedBrowser(
- profile ? profile : ProfileManager::GetDefaultProfileOrOffTheRecord());
+ profile ? profile : ProfileManager::GetDefaultProfileOrOffTheRecord(),
+ chrome::HOST_DESKTOP_TYPE_ASH);
chrome::AddSelectedTabWithURL(browser, url, content::PAGE_TRANSITION_LINK);
// If the current browser is not tabbed then the new tab will be created
// in a different browser. Make sure it is visible.
@@ -217,7 +219,9 @@ void OpenNewTab(const GURL& url, Profile* profile) {
void ShowWarningMessageBox(Profile* profile, const FilePath& path) {
// TODO: if FindOrCreateTabbedBrowser creates a new browser the returned
// browser is leaked.
- Browser* browser = browser::FindOrCreateTabbedBrowser(profile);
+ Browser* browser =
+ browser::FindOrCreateTabbedBrowser(profile,
+ chrome::HOST_DESKTOP_TYPE_ASH);
chrome::ShowMessageBox(
browser->window()->GetNativeWindow(),
l10n_util::GetStringFUTF16(
diff --git a/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc b/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc
index b639b17..01b92b0 100644
--- a/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc
+++ b/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_pages.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
@@ -82,7 +83,8 @@ void OpenWallpaperManager() {
browser->window()->Show();
} else {
Browser* browser = browser::FindOrCreateTabbedBrowser(
- ProfileManager::GetDefaultProfileOrOffTheRecord());
+ ProfileManager::GetDefaultProfileOrOffTheRecord(),
+ chrome::HOST_DESKTOP_TYPE_ASH);
chrome::ShowSettingsSubPage(browser, "setWallpaper");
}
}
diff --git a/chrome/browser/chromeos/locale_change_guard.cc b/chrome/browser/chromeos/locale_change_guard.cc
index b0d4856..7c4dc78 100644
--- a/chrome/browser/chromeos/locale_change_guard.cc
+++ b/chrome/browser/chromeos/locale_change_guard.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/notification_service.h"
@@ -82,7 +83,8 @@ void LocaleChangeGuard::RevertLocaleChange() {
profile_->ChangeAppLocale(
from_locale_, Profile::APP_LOCALE_CHANGED_VIA_REVERT);
- Browser* browser = browser::FindTabbedBrowser(profile_, false);
+ Browser* browser = browser::FindTabbedBrowser(profile_, false,
+ chrome::HOST_DESKTOP_TYPE_ASH);
if (browser)
chrome::ExecuteCommand(browser, IDC_EXIT);
}
diff --git a/chrome/browser/chromeos/network_message_observer.cc b/chrome/browser/chromeos/network_message_observer.cc
index fce775b..c63cf39 100644
--- a/chrome/browser/chromeos/network_message_observer.cc
+++ b/chrome/browser/chromeos/network_message_observer.cc
@@ -21,6 +21,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/time_format.h"
@@ -153,7 +154,8 @@ void NetworkMessageObserver::OpenMobileSetupPage(
void NetworkMessageObserver::OpenMoreInfoPage(const ListValue* args) {
Browser* browser = browser::FindOrCreateTabbedBrowser(
- ProfileManager::GetDefaultProfileOrOffTheRecord());
+ ProfileManager::GetDefaultProfileOrOffTheRecord(),
+ chrome::HOST_DESKTOP_TYPE_ASH);
chromeos::NetworkLibrary* lib =
chromeos::CrosLibrary::Get()->GetNetworkLibrary();
const chromeos::CellularNetwork* cellular = lib->cellular_network();
diff --git a/chrome/browser/chromeos/options/network_config_view.cc b/chrome/browser/chromeos/options/network_config_view.cc
index 5a9a576..a7d368a 100644
--- a/chrome/browser/chromeos/options/network_config_view.cc
+++ b/chrome/browser/chromeos/options/network_config_view.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
@@ -38,7 +39,9 @@ gfx::NativeWindow GetDialogParent() {
return chromeos::BaseLoginDisplayHost::default_host()->GetNativeWindow();
} else {
Browser* browser = browser::FindTabbedBrowser(
- ProfileManager::GetDefaultProfileOrOffTheRecord(), true);
+ ProfileManager::GetDefaultProfileOrOffTheRecord(),
+ true,
+ chrome::HOST_DESKTOP_TYPE_ASH);
if (browser)
return browser->window()->GetNativeWindow();
}
diff --git a/chrome/browser/chromeos/status/network_menu.cc b/chrome/browser/chromeos/status/network_menu.cc
index 2fde2c7..eeaac09 100644
--- a/chrome/browser/chromeos/status/network_menu.cc
+++ b/chrome/browser/chromeos/status/network_menu.cc
@@ -26,6 +26,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/chrome_pages.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
@@ -82,7 +83,8 @@ bool ShouldHighlightNetwork(const chromeos::Network* network) {
Browser* GetAppropriateBrowser() {
DCHECK(chromeos::UserManager::Get()->IsSessionStarted());
return browser::FindOrCreateTabbedBrowser(
- ProfileManager::GetDefaultProfileOrOffTheRecord());
+ ProfileManager::GetDefaultProfileOrOffTheRecord(),
+ chrome::HOST_DESKTOP_TYPE_ASH);
}
} // namespace
@@ -440,7 +442,8 @@ void NetworkMenuModel::ActivatedAt(int index) {
cros->DisconnectFromNetwork(active_vpn);
} else if (flags & FLAG_VIEW_ACCOUNT) {
Browser* browser = browser::FindOrCreateTabbedBrowser(
- ProfileManager::GetDefaultProfileOrOffTheRecord());
+ ProfileManager::GetDefaultProfileOrOffTheRecord(),
+ chrome::HOST_DESKTOP_TYPE_ASH);
chrome::ShowSingletonTab(browser, GURL(top_up_url_));
}
}
diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
index 42e58ee..8bf40b3 100644
--- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
+++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
@@ -61,6 +61,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/chrome_pages.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/browser/upgrade_detector.h"
#include "chrome/common/chrome_notification_types.h"
@@ -703,7 +704,8 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
// browser window with an empty tab and returns it.
Browser* GetAppropriateBrowser() {
return browser::FindOrCreateTabbedBrowser(
- ProfileManager::GetDefaultProfileOrOffTheRecord());
+ ProfileManager::GetDefaultProfileOrOffTheRecord(),
+ chrome::HOST_DESKTOP_TYPE_ASH);
}
void SetProfile(Profile* profile) {
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc
index b0f7552..a855886 100644
--- a/chrome/browser/download/download_browsertest.cc
+++ b/chrome/browser/download/download_browsertest.cc
@@ -40,6 +40,7 @@
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_pages.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension_switch_utils.h"
@@ -143,7 +144,8 @@ class DownloadsHistoryDataCollector {
// extensions tests. Find a common place for this class.
class MockAbortExtensionInstallPrompt : public ExtensionInstallPrompt {
public:
- MockAbortExtensionInstallPrompt() : ExtensionInstallPrompt(NULL, NULL, NULL) {
+ MockAbortExtensionInstallPrompt() :
+ ExtensionInstallPrompt(NULL, NULL, NULL) {
}
// Simulate a user abort on an extension installation.
diff --git a/chrome/browser/extensions/api/test/test_api.cc b/chrome/browser/extensions/api/test/test_api.cc
index 0468115..019d38f 100644
--- a/chrome/browser/extensions/api/test/test_api.cc
+++ b/chrome/browser/extensions/api/test/test_api.cc
@@ -90,7 +90,8 @@ TestCreateIncognitoTabFunction::
bool TestCreateIncognitoTabFunction::RunImpl() {
std::string url;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url));
- chrome::OpenURLOffTheRecord(profile(), GURL(url));
+ chrome::OpenURLOffTheRecord(profile(), GURL(url),
+ chrome::HOST_DESKTOP_TYPE_NATIVE);
return true;
}
diff --git a/chrome/browser/platform_util_chromeos.cc b/chrome/browser/platform_util_chromeos.cc
index 87c8faa..6b53020 100644
--- a/chrome/browser/platform_util_chromeos.cc
+++ b/chrome/browser/platform_util_chromeos.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_navigator.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "content/public/browser/browser_thread.h"
#include "googleurl/src/gurl.h"
@@ -38,7 +39,8 @@ void OpenItemOnFileThread(const FilePath& full_path) {
void OpenURL(const std::string& url) {
// TODO(beng): improve this to locate context from call stack.
Browser* browser = browser::FindOrCreateTabbedBrowser(
- ProfileManager::GetDefaultProfileOrOffTheRecord());
+ ProfileManager::GetDefaultProfileOrOffTheRecord(),
+ chrome::HOST_DESKTOP_TYPE_ASH);
chrome::NavigateParams params(
browser, GURL(url), content::PAGE_TRANSITION_LINK);
params.disposition = NEW_FOREGROUND_TAB;
diff --git a/chrome/browser/profiles/avatar_menu_model.cc b/chrome/browser/profiles/avatar_menu_model.cc
index 9c5c5c8..fdec4a3 100644
--- a/chrome/browser/profiles/avatar_menu_model.cc
+++ b/chrome/browser/profiles/avatar_menu_model.cc
@@ -31,6 +31,7 @@ using content::BrowserThread;
namespace {
void OnProfileCreated(bool always_create,
+ chrome::HostDesktopType desktop_type,
Profile* profile,
Profile::CreateStatus status) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -40,6 +41,7 @@ void OnProfileCreated(bool always_create,
profile,
chrome::startup::IS_NOT_PROCESS_STARTUP,
chrome::startup::IS_NOT_FIRST_RUN,
+ desktop_type,
always_create);
}
}
@@ -82,8 +84,17 @@ void AvatarMenuModel::SwitchToProfile(size_t index, bool always_create) {
index == GetActiveProfileIndex());
const Item& item = GetItemAt(index);
FilePath path = profile_info_->GetPathOfProfileAtIndex(item.model_index);
+
+ chrome::HostDesktopType desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE;
+ if (browser_)
+ desktop_type = browser_->host_desktop_type();
+
g_browser_process->profile_manager()->CreateProfileAsync(
- path, base::Bind(&OnProfileCreated, always_create), string16(),
+ path,
+ base::Bind(&OnProfileCreated,
+ always_create,
+ desktop_type),
+ string16(),
string16());
ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_ICON);
@@ -103,8 +114,12 @@ void AvatarMenuModel::EditProfile(size_t index) {
}
void AvatarMenuModel::AddNewProfile() {
+ chrome::HostDesktopType desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE;
+ if (browser_)
+ desktop_type = browser_->host_desktop_type();
+
ProfileManager::CreateMultiProfileAsync(
- string16(), string16(), ProfileManager::CreateCallback());
+ string16(), string16(), ProfileManager::CreateCallback(), desktop_type);
ProfileMetrics::LogProfileAddNewUser(ProfileMetrics::ADD_NEW_USER_ICON);
}
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index e20fe5d..3939da1 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -153,14 +153,17 @@ void QueueProfileDirectoryForDeletion(const FilePath& path) {
// launching a new browser window and signing the user in to their Google
// account.
void OnOpenWindowForNewProfile(
+ chrome::HostDesktopType desktop_type,
const ProfileManager::CreateCallback& callback,
Profile* profile,
Profile::CreateStatus status) {
if (status == Profile::CREATE_STATUS_INITIALIZED) {
+
ProfileManager::FindOrCreateNewWindowForProfile(
profile,
chrome::startup::IS_PROCESS_STARTUP,
chrome::startup::IS_FIRST_RUN,
+ desktop_type,
false);
}
if (!callback.is_null())
@@ -274,7 +277,7 @@ ProfileManager::ProfileManager(const FilePath& user_data_dir)
if (ProfileShortcutManager::IsFeatureEnabled() && !user_data_dir.empty())
profile_shortcut_manager_.reset(ProfileShortcutManager::Create(
- this));
+ this));
}
ProfileManager::~ProfileManager() {
@@ -512,11 +515,12 @@ void ProfileManager::FindOrCreateNewWindowForProfile(
Profile* profile,
chrome::startup::IsProcessStartup process_startup,
chrome::startup::IsFirstRun is_first_run,
+ chrome::HostDesktopType desktop_type,
bool always_create) {
DCHECK(profile);
if (!always_create) {
- Browser* browser = browser::FindTabbedBrowser(profile, false);
+ Browser* browser = browser::FindTabbedBrowser(profile, false, desktop_type);
if (browser) {
browser->window()->Activate();
return;
@@ -798,11 +802,14 @@ FilePath ProfileManager::GenerateNextProfileDirectoryPath() {
return new_path;
}
+// TODO(robertshield): ProfileManager should not be opening windows and should
+// not have to care about HostDesktopType. See http://crbug.com/153864
// static
void ProfileManager::CreateMultiProfileAsync(
const string16& name,
const string16& icon_url,
- const CreateCallback& callback) {
+ const CreateCallback& callback,
+ chrome::HostDesktopType desktop_type) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
ProfileManager* profile_manager = g_browser_process->profile_manager();
@@ -811,8 +818,10 @@ void ProfileManager::CreateMultiProfileAsync(
profile_manager->CreateProfileAsync(new_path,
base::Bind(&OnOpenWindowForNewProfile,
- callback),
- name, icon_url);
+ desktop_type,
+ callback),
+ name,
+ icon_url);
}
// static
@@ -921,7 +930,11 @@ bool ProfileManager::ShouldGoOffTheRecord() {
return go_off_the_record;
}
-void ProfileManager::ScheduleProfileForDeletion(const FilePath& profile_dir) {
+// TODO(robertshield): ProfileManager should not be opening windows and should
+// not have to care about HostDesktopType. See http://crbug.com/153864
+void ProfileManager::ScheduleProfileForDeletion(
+ const FilePath& profile_dir,
+ chrome::HostDesktopType desktop_type) {
DCHECK(IsMultipleProfilesEnabled());
// If we're deleting the last profile, then create a new profile in its
@@ -930,8 +943,15 @@ void ProfileManager::ScheduleProfileForDeletion(const FilePath& profile_dir) {
if (cache.GetNumberOfProfiles() == 1) {
FilePath new_path = GenerateNextProfileDirectoryPath();
- CreateProfileAsync(new_path, base::Bind(&OnOpenWindowForNewProfile,
- CreateCallback()), string16(), string16());
+ // TODO(robertshield): This desktop type needs to come from the invoker,
+ // currently that involves plumbing this through web UI.
+ chrome::HostDesktopType desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE;
+ CreateProfileAsync(new_path,
+ base::Bind(&OnOpenWindowForNewProfile,
+ desktop_type,
+ CreateCallback()),
+ string16(),
+ string16());
}
// Update the last used profile pref before closing browser windows. This way
diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h
index 203c932..51c2ccf 100644
--- a/chrome/browser/profiles/profile_manager.h
+++ b/chrome/browser/profiles/profile_manager.h
@@ -21,6 +21,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_shortcut_manager.h"
#include "chrome/browser/ui/browser_list_observer.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/startup/startup_types.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -138,8 +139,9 @@ class ProfileManager : public base::NonThreadSafe,
// otherwise return NULL.
Profile* GetProfileByPath(const FilePath& path) const;
- // Activates a window for |profile|. If no such window yet exists, or if
- // |always_create| is true, this first creates a new window, then activates
+ // Activates a window for |profile| on the desktop specified by
+ // |desktop_type|. If no such window yet exists, or if |always_create| is
+ // true, this first creates a new window, then activates
// that. If activating an exiting window and multiple windows exists then the
// window that was most recently active is activated. This is used for
// creation of a window from the multi-profile dropdown menu.
@@ -147,6 +149,7 @@ class ProfileManager : public base::NonThreadSafe,
Profile* profile,
chrome::startup::IsProcessStartup process_startup,
chrome::startup::IsFirstRun is_first_run,
+ chrome::HostDesktopType desktop_type,
bool always_create);
// Profile::Delegate implementation:
@@ -166,7 +169,8 @@ class ProfileManager : public base::NonThreadSafe,
static void CreateMultiProfileAsync(
const string16& name,
const string16& icon_url,
- const CreateCallback& callback);
+ const CreateCallback& callback,
+ chrome::HostDesktopType desktop_type);
// Register multi-profile related preferences in Local State.
static void RegisterPrefs(PrefService* prefs);
@@ -180,7 +184,8 @@ class ProfileManager : public base::NonThreadSafe,
ProfileShortcutManager* profile_shortcut_manager();
// Schedules the profile at the given path to be deleted on shutdown.
- void ScheduleProfileForDeletion(const FilePath& profile_dir);
+ void ScheduleProfileForDeletion(const FilePath& profile_dir,
+ chrome::HostDesktopType desktop_type);
// Checks if multiple profiles is enabled.
static bool IsMultipleProfilesEnabled();
diff --git a/chrome/browser/profiles/profile_manager_browsertest.cc b/chrome/browser/profiles/profile_manager_browsertest.cc
index a5293ad..c3f411e7 100644
--- a/chrome/browser/profiles/profile_manager_browsertest.cc
+++ b/chrome/browser/profiles/profile_manager_browsertest.cc
@@ -5,6 +5,7 @@
#include "base/bind.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -41,7 +42,8 @@ IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, DeleteSingletonProfile) {
// Delete singleton profile.
FilePath singleton_profile_path = cache.GetPathOfProfileAtIndex(0);
EXPECT_FALSE(singleton_profile_path.empty());
- profile_manager->ScheduleProfileForDeletion(singleton_profile_path);
+ profile_manager->ScheduleProfileForDeletion(singleton_profile_path,
+ chrome::HOST_DESKTOP_TYPE_NATIVE);
// Spin things till profile is actually deleted.
content::RunAllPendingInMessageLoop();
@@ -87,8 +89,10 @@ IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, MAYBE_DeleteAllProfiles) {
FilePath profile_path2 = cache.GetPathOfProfileAtIndex(1);
EXPECT_FALSE(profile_path1.empty());
EXPECT_FALSE(profile_path2.empty());
- profile_manager->ScheduleProfileForDeletion(profile_path1);
- profile_manager->ScheduleProfileForDeletion(profile_path2);
+ profile_manager->ScheduleProfileForDeletion(profile_path1,
+ chrome::HOST_DESKTOP_TYPE_NATIVE);
+ profile_manager->ScheduleProfileForDeletion(profile_path2,
+ chrome::HOST_DESKTOP_TYPE_NATIVE);
// Spin things so deletion can take place.
content::RunAllPendingInMessageLoop();
diff --git a/chrome/browser/protector/protector_service.cc b/chrome/browser/protector/protector_service.cc
index d57344e..2a44230 100644
--- a/chrome/browser/protector/protector_service.cc
+++ b/chrome/browser/protector/protector_service.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/protector/protector_utils.h"
#include "chrome/browser/protector/settings_change_global_error.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
@@ -84,7 +85,9 @@ void ProtectorService::ShowChange(BaseSettingChange* change) {
new_item.change.reset(change_ptr.release());
items_.push_back(new_item);
// Do not show the bubble immediately if another one is active.
- error->AddToProfile(profile_, !has_active_change_);
+ // TODO(robertshield): Add desktop context to protector, crbug.com/153771
+ error->AddToProfile(profile_, !has_active_change_,
+ chrome::HOST_DESKTOP_TYPE_NATIVE);
has_active_change_ = true;
} else {
VLOG(1) << "Not showing a change because it's not user-visible.";
@@ -176,7 +179,9 @@ void ProtectorService::OnRemovedFromProfile(SettingsChangeGlobalError* error) {
// Item was merged with another change instance and error has been removed,
// create a new one for the composite change.
item->error.reset(new SettingsChangeGlobalError(item->change.get(), this));
- item->error->AddToProfile(profile_, show_new_error);
+ // TODO(robertshield): Add desktop context to protector, crbug.com/153771
+ item->error->AddToProfile(profile_, show_new_error,
+ chrome::HOST_DESKTOP_TYPE_NATIVE);
has_active_change_ = true;
return;
}
@@ -188,7 +193,9 @@ void ProtectorService::OnRemovedFromProfile(SettingsChangeGlobalError* error) {
if (!has_active_change_) {
for (item = items_.begin(); item != items_.end(); ++item) {
if (!item->error->HasShownBubbleView()) {
- item->error->ShowBubble();
+ // TODO(robertshield): Add desktop context to protector,
+ // crbug.com/153771
+ item->error->ShowBubble(chrome::HOST_DESKTOP_TYPE_NATIVE);
has_active_change_ = true;
return;
}
diff --git a/chrome/browser/protector/settings_change_global_error.cc b/chrome/browser/protector/settings_change_global_error.cc
index 68b6ae4..9ccf558 100644
--- a/chrome/browser/protector/settings_change_global_error.cc
+++ b/chrome/browser/protector/settings_change_global_error.cc
@@ -69,14 +69,16 @@ SettingsChangeGlobalError::~SettingsChangeGlobalError() {
menu_ids.Get().reset(menu_id_ - IDC_SHOW_SETTINGS_CHANGE_FIRST);
}
-void SettingsChangeGlobalError::AddToProfile(Profile* profile,
- bool show_bubble) {
+void SettingsChangeGlobalError::AddToProfile(
+ Profile* profile,
+ bool show_bubble,
+ chrome::HostDesktopType desktop_type) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
profile_ = profile;
GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError(this);
BrowserList::AddObserver(this);
if (show_bubble) {
- ShowBubble();
+ ShowBubble(desktop_type);
} else {
// Start inactivity timer.
BrowserThread::PostDelayedTask(
@@ -98,13 +100,11 @@ void SettingsChangeGlobalError::RemoveFromProfile() {
delegate_->OnRemovedFromProfile(this);
}
-void SettingsChangeGlobalError::ShowBubble() {
+void SettingsChangeGlobalError::ShowBubble(
+ chrome::HostDesktopType desktop_type) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(profile_);
- Browser* browser = browser::FindTabbedBrowser(
- profile_,
- // match incognito
- true);
+ Browser* browser = browser::FindTabbedBrowser(profile_, true, desktop_type);
if (browser)
ShowBubbleInBrowser(browser);
}
@@ -217,7 +217,8 @@ void SettingsChangeGlobalError::OnBrowserSetLastActive(
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&SettingsChangeGlobalError::ShowBubble,
- weak_factory_.GetWeakPtr()));
+ weak_factory_.GetWeakPtr(),
+ browser->host_desktop_type()));
}
}
diff --git a/chrome/browser/protector/settings_change_global_error.h b/chrome/browser/protector/settings_change_global_error.h
index ebab480..7f537c1 100644
--- a/chrome/browser/protector/settings_change_global_error.h
+++ b/chrome/browser/protector/settings_change_global_error.h
@@ -12,6 +12,7 @@
#include "chrome/browser/protector/base_setting_change.h"
#include "chrome/browser/ui/browser_list_observer.h"
#include "chrome/browser/ui/global_error/global_error.h"
+#include "chrome/browser/ui/host_desktop.h"
class Browser;
class Profile;
@@ -33,14 +34,18 @@ class SettingsChangeGlobalError : public GlobalError,
virtual ~SettingsChangeGlobalError();
// Adds a global error to the given browser profile and shows a bubble
- // immediately if |show_bubble| is |true|.
- void AddToProfile(Profile* profile, bool show_bubble);
+ // immediately on the desktop specified by |desktop_type| if |show_bubble| is
+ // |true|.
+ void AddToProfile(Profile* profile,
+ bool show_bubble,
+ chrome::HostDesktopType desktop_type);
// Removes global error from its profile.
void RemoveFromProfile();
- // Displays the bubble in the last active tabbed browser.
- void ShowBubble();
+ // Displays the bubble in the last active tabbed browser on the desktop
+ // specified by |desktop_type|.
+ void ShowBubble(chrome::HostDesktopType desktop_type);
// Returns the change instance to which this error refers.
BaseSettingChange* change() { return change_; }
diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc
index 9b6ee0d..996fdc2 100644
--- a/chrome/browser/task_manager/task_manager.cc
+++ b/chrome/browser/task_manager/task_manager.cc
@@ -1263,6 +1263,7 @@ TaskManager* TaskManager::GetInstance() {
}
void TaskManager::OpenAboutMemory() {
+ // TODO(robertshield): FTB - Merge MAD's TaskManager change.
Browser* browser = browser::FindOrCreateTabbedBrowser(
ProfileManager::GetDefaultProfileOrOffTheRecord());
chrome::NavigateParams params(browser, GURL(chrome::kChromeUIMemoryURL),
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc
index f9ca572..7c8b3af 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/webui/chrome_web_contents_handler.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
@@ -65,7 +66,8 @@ Browser* GetTargetBrowser() {
if (browser)
return browser;
return browser::FindOrCreateTabbedBrowser(
- ProfileManager::GetDefaultProfileOrOffTheRecord());
+ ProfileManager::GetDefaultProfileOrOffTheRecord(),
+ chrome::HOST_DESKTOP_TYPE_ASH);
}
} // namespace
@@ -277,7 +279,8 @@ void ChromeShellDelegate::ShowKeyboardOverlay() {
void ChromeShellDelegate::ShowTaskManager() {
Browser* browser = browser::FindOrCreateTabbedBrowser(
- ProfileManager::GetDefaultProfileOrOffTheRecord());
+ ProfileManager::GetDefaultProfileOrOffTheRecord(),
+ chrome::HOST_DESKTOP_TYPE_ASH);
chrome::OpenTaskManager(browser, false);
}
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
index f43cbb8..e232ead 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
@@ -559,7 +559,7 @@ void ChromeLauncherController::UpdateAppState(TabContents* tab,
void ChromeLauncherController::CreateNewTab() {
Browser* last_browser = browser::FindTabbedBrowser(
- GetProfileForNewWindows(), true);
+ GetProfileForNewWindows(), true, chrome::HOST_DESKTOP_TYPE_ASH);
if (!last_browser) {
CreateNewWindow();
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index 95d9cdc..bab9d2e 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -283,9 +283,11 @@ void OpenWindowWithRestoredTabs(Profile* profile) {
service->RestoreMostRecentEntry(NULL);
}
-void OpenURLOffTheRecord(Profile* profile, const GURL& url) {
+void OpenURLOffTheRecord(Profile* profile,
+ const GURL& url,
+ chrome::HostDesktopType desktop_type) {
Browser* browser = browser::FindOrCreateTabbedBrowser(
- profile->GetOffTheRecordProfile());
+ profile->GetOffTheRecordProfile(), desktop_type);
AddSelectedTabWithURL(browser, url, content::PAGE_TRANSITION_LINK);
browser->window()->Show();
}
@@ -434,7 +436,9 @@ void NewTab(Browser* browser) {
AddBlankTab(browser, true);
GetActiveWebContents(browser)->GetView()->RestoreFocus();
} else {
- Browser* b = browser::FindOrCreateTabbedBrowser(browser->profile());
+ Browser* b =
+ browser::FindOrCreateTabbedBrowser(browser->profile(),
+ browser->host_desktop_type());
AddBlankTab(b, true);
b->window()->Show();
// The call to AddBlankTab above did not set the focus to the tab as its
diff --git a/chrome/browser/ui/browser_commands.h b/chrome/browser/ui/browser_commands.h
index ef35eec..c36661b 100644
--- a/chrome/browser/ui/browser_commands.h
+++ b/chrome/browser/ui/browser_commands.h
@@ -8,6 +8,7 @@
#include <string>
#include "chrome/browser/debugger/devtools_toggle_action.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "content/public/common/page_zoom.h"
#include "webkit/glue/window_open_disposition.h"
@@ -48,10 +49,12 @@ Browser* OpenEmptyWindow(Profile* profile);
// Opens a new window with the tabs from |profile|'s TabRestoreService.
void OpenWindowWithRestoredTabs(Profile* profile);
-// Opens the specified URL in a new browser window in an incognito session.
-// If there is already an existing active incognito session for the specified
-// |profile|, that session is re-used.
-void OpenURLOffTheRecord(Profile* profile, const GURL& url);
+// Opens the specified URL in a new browser window in an incognito session on
+// the desktop specified by |desktop_type|. If there is already an existing
+// active incognito session for the specified |profile|, that session is re-
+// used.
+void OpenURLOffTheRecord(Profile* profile, const GURL& url,
+ chrome::HostDesktopType desktop_type);
bool CanGoBack(const Browser* browser);
void GoBack(Browser* browser, WindowOpenDisposition disposition);
diff --git a/chrome/browser/ui/browser_finder.cc b/chrome/browser/ui/browser_finder.cc
index 4d1fb36..3e650a6 100644
--- a/chrome/browser/ui/browser_finder.cc
+++ b/chrome/browser/ui/browser_finder.cc
@@ -127,15 +127,28 @@ size_t GetBrowserCountImpl(Profile* profile,
} // namespace
-Browser* FindTabbedBrowser(Profile* profile, bool match_original_profiles) {
+Browser* FindTabbedBrowser(Profile* profile,
+ bool match_original_profiles) {
+ return FindTabbedBrowser(profile, match_original_profiles,
+ chrome::HOST_DESKTOP_TYPE_NATIVE);
+}
+
+Browser* FindTabbedBrowser(Profile* profile,
+ bool match_original_profiles,
+ chrome::HostDesktopType type) {
return FindBrowserWithTabbedOrAnyType(profile,
- kDefaultHostDesktopType,
+ type,
true,
match_original_profiles);
}
Browser* FindOrCreateTabbedBrowser(Profile* profile) {
- Browser* browser = FindTabbedBrowser(profile, false);
+ return FindOrCreateTabbedBrowser(profile, chrome::HOST_DESKTOP_TYPE_NATIVE);
+}
+
+Browser* FindOrCreateTabbedBrowser(Profile* profile,
+ chrome::HostDesktopType type) {
+ Browser* browser = FindTabbedBrowser(profile, false, type);
if (!browser)
browser = new Browser(Browser::CreateParams(profile));
return browser;
diff --git a/chrome/browser/ui/browser_finder.h b/chrome/browser/ui/browser_finder.h
index 15e1128..87718c1 100644
--- a/chrome/browser/ui/browser_finder.h
+++ b/chrome/browser/ui/browser_finder.h
@@ -19,19 +19,30 @@ class WebContents;
namespace browser {
+// Deprecated:
+Browser* FindTabbedBrowser(Profile* profile,
+ bool match_original_profiles);
+
// 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);
+// |type| refers to the host desktop the returned browser should belong to.
+Browser* FindTabbedBrowser(Profile* profile,
+ bool match_original_profiles,
+ chrome::HostDesktopType type);
-// 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.
+// Deprecated
Browser* FindOrCreateTabbedBrowser(Profile* profile);
+// 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
+// |type|. If a new browser is created it is not made visible.
+Browser* FindOrCreateTabbedBrowser(Profile* profile,
+ chrome::HostDesktopType type);
+
// Find an existing browser window with any type. See comment above for
// additional information.
Browser* FindAnyBrowser(Profile* profile, bool match_original_profiles);
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc
index 2a8d667..0aa7a51 100644
--- a/chrome/browser/ui/browser_navigator.cc
+++ b/chrome/browser/ui/browser_navigator.cc
@@ -53,8 +53,10 @@ 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 = browser::FindTabbedBrowser(profile, false);
+Browser* GetOrCreateBrowser(Profile* profile,
+ chrome::HostDesktopType host_desktop_type) {
+ Browser* browser =
+ browser::FindTabbedBrowser(profile, false, host_desktop_type);
return browser ? browser : new Browser(Browser::CreateParams(profile));
}
@@ -84,7 +86,8 @@ bool AdjustNavigateParamsForURL(chrome::NavigateParams* params) {
}
params->disposition = SINGLETON_TAB;
- params->browser = browser::FindOrCreateTabbedBrowser(profile);
+ params->browser =
+ browser::FindOrCreateTabbedBrowser(profile, params->host_desktop_type);
params->window_action = chrome::NavigateParams::SHOW_WINDOW;
}
@@ -110,7 +113,7 @@ Browser* GetBrowserForDisposition(chrome::NavigateParams* params) {
return params->browser;
// Find a compatible window and re-execute this command in it. Otherwise
// re-run with NEW_WINDOW.
- return GetOrCreateBrowser(profile);
+ return GetOrCreateBrowser(profile, params->host_desktop_type);
case SINGLETON_TAB:
case NEW_FOREGROUND_TAB:
case NEW_BACKGROUND_TAB:
@@ -119,7 +122,7 @@ Browser* GetBrowserForDisposition(chrome::NavigateParams* params) {
return params->browser;
// Find a compatible window and re-execute this command in it. Otherwise
// re-run with NEW_WINDOW.
- return GetOrCreateBrowser(profile);
+ return GetOrCreateBrowser(profile, params->host_desktop_type);
case NEW_POPUP: {
// Make a new popup window.
// Coerce app-style if |source| represents an app.
@@ -153,7 +156,8 @@ Browser* GetBrowserForDisposition(chrome::NavigateParams* params) {
}
case OFF_THE_RECORD:
// Make or find an incognito window.
- return GetOrCreateBrowser(profile->GetOffTheRecordProfile());
+ return GetOrCreateBrowser(profile->GetOffTheRecordProfile(),
+ params->host_desktop_type);
// The following types all result in no navigation.
case SUPPRESS_OPEN:
case SAVE_TO_DISK:
@@ -316,7 +320,12 @@ NavigateParams::NavigateParams(Browser* a_browser,
path_behavior(RESPECT),
ref_behavior(IGNORE_REF),
browser(a_browser),
- initiating_profile(NULL) {}
+ initiating_profile(NULL) {
+ if (a_browser)
+ host_desktop_type = a_browser->host_desktop_type();
+ else
+ host_desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE;
+ }
NavigateParams::NavigateParams(Browser* a_browser,
TabContents* a_target_contents)
@@ -332,7 +341,12 @@ NavigateParams::NavigateParams(Browser* a_browser,
path_behavior(RESPECT),
ref_behavior(IGNORE_REF),
browser(a_browser),
- initiating_profile(NULL) {}
+ initiating_profile(NULL) {
+ if (a_browser)
+ host_desktop_type = a_browser->host_desktop_type();
+ else
+ host_desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE;
+ }
NavigateParams::NavigateParams(Profile* a_profile,
const GURL& a_url,
@@ -350,7 +364,8 @@ NavigateParams::NavigateParams(Profile* a_profile,
path_behavior(RESPECT),
ref_behavior(IGNORE_REF),
browser(NULL),
- initiating_profile(a_profile) {}
+ initiating_profile(a_profile),
+ host_desktop_type(chrome::HOST_DESKTOP_TYPE_NATIVE) {}
NavigateParams::~NavigateParams() {}
diff --git a/chrome/browser/ui/browser_navigator.h b/chrome/browser/ui/browser_navigator.h
index 4efd06d..a91457c 100644
--- a/chrome/browser/ui/browser_navigator.h
+++ b/chrome/browser/ui/browser_navigator.h
@@ -7,6 +7,7 @@
#include <string>
+#include "chrome/browser/ui/host_desktop.h"
#include "content/public/browser/global_request_id.h"
#include "content/public/common/page_transition_types.h"
#include "content/public/common/referrer.h"
@@ -197,6 +198,10 @@ struct NavigateParams {
// to a different site that created a new RVH.
content::GlobalRequestID transferred_global_request_id;
+ // Refers to which desktop this navigation should occur on. May be passed
+ // explicitly or inferred from an existing Browser instance.
+ chrome::HostDesktopType host_desktop_type;
+
private:
NavigateParams();
};
diff --git a/chrome/browser/ui/browser_win.cc b/chrome/browser/ui/browser_win.cc
index b4498b0..da1d46c 100644
--- a/chrome/browser/ui/browser_win.cc
+++ b/chrome/browser/ui/browser_win.cc
@@ -23,7 +23,11 @@ void NewMetroWindow(Browser* source_browser, Profile* profile) {
::GetProcAddress(base::win::GetMetroModule(), "FlipFrameWindows"));
DCHECK(flip_window_fn);
- Browser* browser = browser::FindTabbedBrowser(profile, false);
+ chrome::HostDesktopType host_desktop_type =
+ source_browser->host_desktop_type();
+ Browser* browser =
+ browser::FindTabbedBrowser(profile, false, host_desktop_type);
+
if (!browser) {
chrome::OpenEmptyWindow(profile);
return;
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 12bc617..fb6f6eb 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm
@@ -93,7 +93,10 @@ 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);
+ Browser* browser =
+ browser::FindTabbedBrowser(bridge_->GetProfile(),
+ true,
+ chrome::HOST_DESKTOP_TYPE_NATIVE);
if (!browser)
browser = new Browser(Browser::CreateParams(bridge_->GetProfile()));
WindowOpenDisposition disposition =
@@ -112,7 +115,10 @@ const NSUInteger kMaximumMenuPixelsWide = 300;
const BookmarkNode* node = [self nodeForIdentifier:identifier];
DCHECK(node);
- Browser* browser = browser::FindTabbedBrowser(bridge_->GetProfile(), true);
+ Browser* browser =
+ browser::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/cocoa/history_menu_cocoa_controller.mm b/chrome/browser/ui/cocoa/history_menu_cocoa_controller.mm
index ca9600d..4a31cb1 100644
--- a/chrome/browser/ui/cocoa/history_menu_cocoa_controller.mm
+++ b/chrome/browser/ui/cocoa/history_menu_cocoa_controller.mm
@@ -16,6 +16,7 @@
#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 "chrome/browser/ui/host_desktop.h"
#include "webkit/glue/window_open_disposition.h"
using content::OpenURLParams;
@@ -38,7 +39,9 @@ using content::Referrer;
// Open the URL of the given history item in the current tab.
- (void)openURLForItem:(const HistoryMenuBridge::HistoryItem*)node {
- Browser* browser = browser::FindOrCreateTabbedBrowser(bridge_->profile());
+ Browser* browser =
+ browser::FindOrCreateTabbedBrowser(bridge_->profile(),
+ chrome::HOST_DESKTOP_TYPE_NATIVE);
WindowOpenDisposition disposition =
event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]);
diff --git a/chrome/browser/ui/views/ash/balloon_collection_impl_ash.cc b/chrome/browser/ui/views/ash/balloon_collection_impl_ash.cc
index 4f259f6..504b680 100644
--- a/chrome/browser/ui/views/ash/balloon_collection_impl_ash.cc
+++ b/chrome/browser/ui/views/ash/balloon_collection_impl_ash.cc
@@ -68,7 +68,9 @@ void BalloonCollectionImplAsh::ShowSettings(const std::string& notifcation_id) {
Balloon* balloon = base().FindBalloonById(notifcation_id);
Profile* profile =
balloon ? balloon->profile() : ProfileManager::GetDefaultProfile();
- Browser* browser = browser::FindOrCreateTabbedBrowser(profile);
+ Browser* browser =
+ browser::FindOrCreateTabbedBrowser(profile,
+ chrome::HOST_DESKTOP_TYPE_ASH);
if (GetBalloonExtension(balloon))
chrome::ShowExtensions(browser);
else
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 c3c69f1..ffe7106 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
@@ -118,7 +118,13 @@ void BookmarkContextMenuControllerViewsWin::ExecuteCommand(int id) {
}
NewBrowserPageNavigator navigator_impl(profile_to_use);
- Browser* browser = browser::FindTabbedBrowser(profile_to_use, false);
+
+ // 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);
content::PageNavigator* navigator = NULL;
if (!browser || !chrome::GetActiveWebContents(browser)) {
navigator = &navigator_impl;
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 9b70ba1..5948003 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
@@ -56,8 +56,12 @@ void RenderViewContextMenuWin::ExecuteCommand(int command_id,
// implements the delegate for the context menu. This would break if there
// are other delegates for the context menu. This is ok for now as this
// code only executes for Windows 8 metro mode.
- Browser* browser = browser::FindTabbedBrowser(
- profile_->GetOriginalProfile(), false);
+ // 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);
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 42375be..a52383a 100644
--- a/chrome/browser/ui/webui/chrome_web_contents_handler.cc
+++ b/chrome/browser/ui/webui/chrome_web_contents_handler.cc
@@ -9,6 +9,7 @@
#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/host_desktop.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "content/public/browser/web_contents.h"
@@ -36,10 +37,19 @@ WebContents* ChromeWebContentsHandler::OpenURLFromTab(
return NULL;
Profile* profile = Profile::FromBrowserContext(context);
- Browser* browser = browser::FindTabbedBrowser(profile, false);
+
+ chrome::HostDesktopType desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE;
+ if (source) {
+ Browser* source_browser = browser::FindBrowserWithWebContents(source);
+ if (source_browser)
+ desktop_type = source_browser->host_desktop_type();
+ }
+
+ Browser* browser = browser::FindTabbedBrowser(profile, false, desktop_type);
const bool browser_created = !browser;
if (!browser)
- browser = new Browser(Browser::CreateParams(profile));
+ browser = new Browser(
+ Browser::CreateParams(Browser::TYPE_TABBED, profile, desktop_type));
chrome::NavigateParams nav_params(browser, params.url, params.transition);
nav_params.referrer = params.referrer;
if (source && source->IsCrashed() &&
@@ -78,10 +88,19 @@ void ChromeWebContentsHandler::AddNewContents(
return;
Profile* profile = Profile::FromBrowserContext(context);
- Browser* browser = browser::FindTabbedBrowser(profile, false);
+
+ chrome::HostDesktopType desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE;
+ if (source) {
+ Browser* source_browser = browser::FindBrowserWithWebContents(source);
+ if (source_browser)
+ desktop_type = source_browser->host_desktop_type();
+ }
+
+ Browser* browser = browser::FindTabbedBrowser(profile, false, desktop_type);
const bool browser_created = !browser;
if (!browser)
- browser = new Browser(Browser::CreateParams(profile));
+ browser = new Browser(
+ Browser::CreateParams(Browser::TYPE_TABBED, profile, desktop_type));
TabContents* tab_contents =
TabContents::Factory::CreateTabContents(new_contents);
chrome::NavigateParams params(browser, tab_contents);
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index 2fec385..67e5116 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -45,7 +45,10 @@
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/themes/theme_service_factory.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/chrome_select_file_policy.h"
+#include "chrome/browser/ui/host_desktop.h"
+#include "chrome/browser/ui/options/options_util.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/browser/ui/webui/favicon_source.h"
#include "chrome/browser/ui/webui/web_ui_util.h"
@@ -948,17 +951,24 @@ void BrowserOptionsHandler::CreateProfile(const ListValue* args) {
return;
string16 name, icon;
bool create_box_checked;
+
+ Browser* browser =
+ browser::FindBrowserWithWebContents(web_ui()->GetWebContents());
+ chrome::HostDesktopType desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE;
+ if (browser)
+ desktop_type = browser->host_desktop_type();
+
if (args->GetString(0, &name) && args->GetString(1, &icon)) {
if (args->GetBoolean(2, &create_box_checked) && create_box_checked) {
ProfileManager::CreateMultiProfileAsync(
- name, icon, base::Bind(&CreateDesktopShortcutForProfile));
+ name, icon, base::Bind(&CreateDesktopShortcutForProfile), desktop_type);
} else {
ProfileManager::CreateMultiProfileAsync(
- name, icon, ProfileManager::CreateCallback());
+ name, icon, ProfileManager::CreateCallback(), desktop_type);
}
} else {
ProfileManager::CreateMultiProfileAsync(
- string16(), string16(), ProfileManager::CreateCallback());
+ string16(), string16(), ProfileManager::CreateCallback(), desktop_type);
}
}
diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
index a810643..71fb1ef 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -44,6 +44,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/browser/ui/webui/web_ui_util.h"
#include "chrome/common/chrome_notification_types.h"
@@ -1535,7 +1536,8 @@ gfx::NativeWindow InternetOptionsHandler::GetNativeWindow() const {
Browser* InternetOptionsHandler::GetAppropriateBrowser() {
return browser::FindOrCreateTabbedBrowser(
- ProfileManager::GetDefaultProfileOrOffTheRecord());
+ ProfileManager::GetDefaultProfileOrOffTheRecord(),
+ chrome::HOST_DESKTOP_TYPE_ASH);
}
void InternetOptionsHandler::NetworkCommandCallback(const ListValue* args) {
diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.cc b/chrome/browser/ui/webui/options/manage_profile_handler.cc
index 98f4e7c..3eec24b 100644
--- a/chrome/browser/ui/webui/options/manage_profile_handler.cc
+++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc
@@ -19,6 +19,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/profiles/profile_shortcut_manager.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/webui/web_ui_util.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
@@ -256,8 +257,14 @@ void ManageProfileHandler::DeleteProfile(const ListValue* args) {
!base::GetValueAsFilePath(*file_path_value, &profile_file_path))
return;
+ Browser* browser =
+ browser::FindBrowserWithWebContents(web_ui()->GetWebContents());
+ chrome::HostDesktopType desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE;
+ if (browser)
+ desktop_type = browser->host_desktop_type();
+
g_browser_process->profile_manager()->ScheduleProfileForDeletion(
- profile_file_path);
+ profile_file_path, desktop_type);
}
void ManageProfileHandler::ProfileIconSelectionChanged(
diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc
index 596458d..e651de6 100644
--- a/chrome/test/base/ui_test_utils.cc
+++ b/chrome/test/base/ui_test_utils.cc
@@ -42,6 +42,7 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/find_bar/find_notification_details.h"
#include "chrome/browser/ui/find_bar/find_tab_helper.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/omnibox/location_bar.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
@@ -196,9 +197,11 @@ Browser* WaitForBrowserNotInSet(std::set<Browser*> excluded_browsers) {
}
Browser* OpenURLOffTheRecord(Profile* profile, const GURL& url) {
- chrome::OpenURLOffTheRecord(profile, url);
+ chrome::OpenURLOffTheRecord(profile, url, chrome::HOST_DESKTOP_TYPE_NATIVE);
Browser* browser = browser::FindTabbedBrowser(
- profile->GetOffTheRecordProfile(), false);
+ profile->GetOffTheRecordProfile(),
+ false,
+ chrome::HOST_DESKTOP_TYPE_NATIVE);
WaitForNavigations(&chrome::GetActiveWebContents(browser)->GetController(),
1);
return browser;