diff options
Diffstat (limited to 'chrome/browser/ui')
18 files changed, 160 insertions, 43 deletions
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( |