summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/app_controller_mac.mm6
-rw-r--r--chrome/browser/background/background_contents_service.cc4
-rw-r--r--chrome/browser/background/background_mode_manager.cc3
-rw-r--r--chrome/browser/download/download_crx_util.cc3
-rw-r--r--chrome/browser/download/download_ui_controller.cc6
-rw-r--r--chrome/browser/extensions/api/extension_action/extension_action_api.cc7
-rw-r--r--chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc6
-rw-r--r--chrome/browser/extensions/bundle_installer.cc3
-rw-r--r--chrome/browser/extensions/bundle_installer.h4
-rw-r--r--chrome/browser/extensions/extension_error_ui_default.cc3
-rw-r--r--chrome/browser/extensions/webstore_inline_installer_browsertest.cc4
-rw-r--r--chrome/browser/printing/print_error_dialog.cc3
-rw-r--r--chrome/browser/renderer_context_menu/render_view_context_menu.cc14
-rw-r--r--chrome/browser/safe_browsing/srt_fetcher_win.cc5
-rw-r--r--chrome/browser/safe_browsing/srt_global_error_win.cc3
-rw-r--r--chrome/browser/translate/chrome_translate_client.cc4
-rw-r--r--chrome/browser/ui/ash/system_tray_delegate_chromeos.cc3
-rw-r--r--chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc17
-rw-r--r--chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.cc3
-rw-r--r--chrome/browser/ui/browser_finder.cc4
-rw-r--r--chrome/browser/ui/browser_finder.h4
-rw-r--r--chrome/browser/ui/cocoa/browser_window_cocoa.mm4
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.mm4
-rw-r--r--chrome/browser/ui/cocoa/handoff_active_url_observer.cc6
-rw-r--r--chrome/browser/ui/cocoa/last_active_browser_cocoa.cc2
-rw-r--r--chrome/browser/ui/content_settings/content_setting_bubble_model_browsertest.cc3
-rw-r--r--chrome/browser/ui/extensions/extension_install_ui_default.cc6
-rw-r--r--chrome/browser/ui/network_profile_bubble.cc3
-rw-r--r--chrome/browser/ui/startup/default_browser_prompt.cc2
-rw-r--r--chrome/browser/ui/sync/one_click_signin_sync_starter.cc2
-rw-r--r--chrome/browser/ui/views/frame/browser_view.cc4
-rw-r--r--chrome/browser/ui/views/profiles/user_manager_view.cc3
-rw-r--r--chrome/browser/ui/views/select_file_dialog_extension.cc6
-rw-r--r--chrome/browser/ui/webui/signin/inline_login_handler_impl.cc12
-rw-r--r--chrome/browser/ui/webui/signin/sync_confirmation_handler.cc6
-rw-r--r--chrome/browser/ui/webui/signin/user_manager_screen_handler.cc2
-rw-r--r--chrome/browser/ui/window_sizer/window_sizer.h4
-rw-r--r--chrome/browser/ui/window_sizer/window_sizer_aura.cc5
-rw-r--r--chrome/browser/ui/window_sizer/window_sizer_mac.mm6
39 files changed, 65 insertions, 124 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index b8fac08..ba43ca5 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -128,8 +128,7 @@ bool g_is_opening_new_window = false;
// there are only minimized windows), it will unminimize it.
Browser* ActivateBrowser(Profile* profile) {
Browser* browser = chrome::FindLastActiveWithProfile(
- profile->IsGuestSession() ? profile->GetOffTheRecordProfile() : profile,
- chrome::HOST_DESKTOP_TYPE_NATIVE);
+ profile->IsGuestSession() ? profile->GetOffTheRecordProfile() : profile);
if (browser)
browser->window()->Activate();
return browser;
@@ -777,8 +776,7 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
startupComplete_ = YES;
- Browser* browser =
- FindLastActiveWithHostDesktopType(chrome::HOST_DESKTOP_TYPE_NATIVE);
+ Browser* browser = chrome::FindLastActive();
content::WebContents* activeWebContents = nullptr;
if (browser)
activeWebContents = browser->tab_strip_model()->GetActiveWebContents();
diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc
index e35ff4d..aaae063 100644
--- a/chrome/browser/background/background_contents_service.cc
+++ b/chrome/browser/background/background_contents_service.cc
@@ -30,7 +30,6 @@
#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/extension_constants.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
@@ -784,8 +783,7 @@ void BackgroundContentsService::AddWebContents(
bool user_gesture,
bool* was_blocked) {
Browser* browser = chrome::FindLastActiveWithProfile(
- Profile::FromBrowserContext(new_contents->GetBrowserContext()),
- chrome::GetActiveDesktop());
+ Profile::FromBrowserContext(new_contents->GetBrowserContext()));
if (browser) {
chrome::AddWebContents(browser, NULL, new_contents, disposition,
initial_rect, user_gesture, was_blocked);
diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc
index 987c19c..235a3ce 100644
--- a/chrome/browser/background/background_mode_manager.cc
+++ b/chrome/browser/background/background_mode_manager.cc
@@ -400,8 +400,7 @@ void BackgroundModeManager::LaunchBackgroundApplication(
// static
Browser* BackgroundModeManager::GetBrowserWindowForProfile(Profile* profile) {
chrome::HostDesktopType host_desktop_type = chrome::GetActiveDesktop();
- Browser* browser =
- chrome::FindLastActiveWithProfile(profile, host_desktop_type);
+ Browser* browser = chrome::FindLastActiveWithProfile(profile);
return browser ? browser
: chrome::OpenEmptyWindow(profile, host_desktop_type);
}
diff --git a/chrome/browser/download/download_crx_util.cc b/chrome/browser/download/download_crx_util.cc
index 6a2ed63..584ce0d 100644
--- a/chrome/browser/download/download_crx_util.cc
+++ b/chrome/browser/download/download_crx_util.cc
@@ -48,8 +48,7 @@ scoped_ptr<ExtensionInstallPrompt> CreateExtensionInstallPrompt(
content::WebContents* web_contents = download_item.GetWebContents();
if (!web_contents) {
chrome::HostDesktopType active_desktop = chrome::GetActiveDesktop();
- Browser* browser = chrome::FindLastActiveWithProfile(profile,
- active_desktop);
+ Browser* browser = chrome::FindLastActiveWithProfile(profile);
if (!browser)
browser = new Browser(Browser::CreateParams(Browser::TYPE_TABBED,
profile, active_desktop));
diff --git a/chrome/browser/download/download_ui_controller.cc b/chrome/browser/download/download_ui_controller.cc
index 5b45568..e0bb05b 100644
--- a/chrome/browser/download/download_ui_controller.cc
+++ b/chrome/browser/download/download_ui_controller.cc
@@ -87,10 +87,8 @@ void DownloadShelfUIControllerDelegate::OnNewDownloadReady(
// As a last resort, use the last active browser for this profile. Not ideal,
// but better than not showing the download at all.
- if (browser == NULL) {
- browser = chrome::FindLastActiveWithProfile(profile_,
- chrome::GetActiveDesktop());
- }
+ if (browser == nullptr)
+ browser = chrome::FindLastActiveWithProfile(profile_);
if (browser && browser->window() &&
DownloadItemModel(item).ShouldShowInShelf()) {
diff --git a/chrome/browser/extensions/api/extension_action/extension_action_api.cc b/chrome/browser/extensions/api/extension_action/extension_action_api.cc
index fcca921..1af27cb 100644
--- a/chrome/browser/extensions/api/extension_action/extension_action_api.cc
+++ b/chrome/browser/extensions/api/extension_action/extension_action_api.cc
@@ -616,8 +616,7 @@ BrowserActionOpenPopupFunction::BrowserActionOpenPopupFunction()
bool BrowserActionOpenPopupFunction::RunAsync() {
// We only allow the popup in the active window.
Profile* profile = GetProfile();
- Browser* browser = chrome::FindLastActiveWithProfile(
- profile, chrome::GetActiveDesktop());
+ Browser* browser = chrome::FindLastActiveWithProfile(profile);
// It's possible that the last active browser actually corresponds to the
// associated incognito profile, and this won't be returned by
// FindLastActiveWithProfile. If the browser we found isn't active and the
@@ -625,8 +624,8 @@ bool BrowserActionOpenPopupFunction::RunAsync() {
if ((!browser || !browser->window()->IsActive()) &&
util::IsIncognitoEnabled(extension()->id(), profile) &&
profile->HasOffTheRecordProfile()) {
- browser = chrome::FindLastActiveWithProfile(
- profile->GetOffTheRecordProfile(), chrome::GetActiveDesktop());
+ browser =
+ chrome::FindLastActiveWithProfile(profile->GetOffTheRecordProfile());
}
// If there's no active browser, or the Toolbar isn't visible, abort.
diff --git a/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc b/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc
index 0bab646..08231f6 100644
--- a/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc
+++ b/chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc
@@ -169,8 +169,7 @@ bool ChromeRuntimeAPIDelegate::CheckForUpdates(
void ChromeRuntimeAPIDelegate::OpenURL(const GURL& uninstall_url) {
Profile* profile = Profile::FromBrowserContext(browser_context_);
- Browser* browser =
- chrome::FindLastActiveWithProfile(profile, chrome::GetActiveDesktop());
+ Browser* browser = chrome::FindLastActiveWithProfile(profile);
if (!browser)
browser =
new Browser(Browser::CreateParams(profile, chrome::GetActiveDesktop()));
@@ -241,8 +240,7 @@ bool ChromeRuntimeAPIDelegate::RestartDevice(std::string* error_message) {
bool ChromeRuntimeAPIDelegate::OpenOptionsPage(const Extension* extension) {
Profile* profile = Profile::FromBrowserContext(browser_context_);
- Browser* browser =
- chrome::FindLastActiveWithProfile(profile, chrome::GetActiveDesktop());
+ Browser* browser = chrome::FindLastActiveWithProfile(profile);
if (!browser)
return false;
return extensions::ExtensionTabUtil::OpenOptionsPage(extension, browser);
diff --git a/chrome/browser/extensions/bundle_installer.cc b/chrome/browser/extensions/bundle_installer.cc
index c710559..a0762a7 100644
--- a/chrome/browser/extensions/bundle_installer.cc
+++ b/chrome/browser/extensions/bundle_installer.cc
@@ -112,7 +112,6 @@ BundleInstaller::BundleInstaller(Browser* browser,
icon_(icon),
authuser_(authuser),
delegated_username_(delegated_username),
- host_desktop_type_(browser->host_desktop_type()),
profile_(browser->profile()),
weak_factory_(this) {
BrowserList::AddObserver(this);
@@ -279,7 +278,7 @@ void BundleInstaller::ShowPrompt() {
if (!browser) {
// The browser that we got initially could have gone away during our
// thread hopping.
- browser = chrome::FindLastActiveWithProfile(profile_, host_desktop_type_);
+ browser = chrome::FindLastActiveWithProfile(profile_);
}
content::WebContents* web_contents = NULL;
if (browser)
diff --git a/chrome/browser/extensions/bundle_installer.h b/chrome/browser/extensions/bundle_installer.h
index cd8fe90..96a2129 100644
--- a/chrome/browser/extensions/bundle_installer.h
+++ b/chrome/browser/extensions/bundle_installer.h
@@ -20,7 +20,6 @@
#include "chrome/browser/extensions/webstore_install_helper.h"
#include "chrome/browser/extensions/webstore_installer.h"
#include "chrome/browser/ui/browser_list_observer.h"
-#include "chrome/browser/ui/host_desktop.h"
#include "extensions/common/extension.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "url/gurl.h"
@@ -199,9 +198,6 @@ class BundleInstaller : public WebstoreInstallHelper::Delegate,
// of delegated installs. Empty for regular installs.
std::string delegated_username_;
- // The desktop type of the browser.
- chrome::HostDesktopType host_desktop_type_;
-
// The profile that the bundle should be installed in.
Profile* profile_;
diff --git a/chrome/browser/extensions/extension_error_ui_default.cc b/chrome/browser/extensions/extension_error_ui_default.cc
index eec4a43..38f774e 100644
--- a/chrome/browser/extensions/extension_error_ui_default.cc
+++ b/chrome/browser/extensions/extension_error_ui_default.cc
@@ -27,8 +27,7 @@ ExtensionErrorUIDefault::~ExtensionErrorUIDefault() {
}
bool ExtensionErrorUIDefault::ShowErrorInBubbleView() {
- Browser* browser =
- chrome::FindLastActiveWithProfile(profile_, chrome::GetActiveDesktop());
+ Browser* browser = chrome::FindLastActiveWithProfile(profile_);
if (!browser)
return false;
diff --git a/chrome/browser/extensions/webstore_inline_installer_browsertest.cc b/chrome/browser/extensions/webstore_inline_installer_browsertest.cc
index 8c53765..adc4f57 100644
--- a/chrome/browser/extensions/webstore_inline_installer_browsertest.cc
+++ b/chrome/browser/extensions/webstore_inline_installer_browsertest.cc
@@ -248,8 +248,8 @@ IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest,
CONTENT_SETTING_ALLOW);
ui_test_utils::NavigateToURL(browser(), install_url);
// The test page opens a popup which is a new |browser| window.
- Browser* popup_browser = chrome::FindLastActiveWithProfile(
- browser()->profile(), chrome::GetActiveDesktop());
+ Browser* popup_browser =
+ chrome::FindLastActiveWithProfile(browser()->profile());
WebContents* popup_contents =
popup_browser->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(base::ASCIIToUTF16("POPUP"), popup_contents->GetTitle());
diff --git a/chrome/browser/printing/print_error_dialog.cc b/chrome/browser/printing/print_error_dialog.cc
index 43abe64..39fab57 100644
--- a/chrome/browser/printing/print_error_dialog.cc
+++ b/chrome/browser/printing/print_error_dialog.cc
@@ -16,8 +16,7 @@ namespace chrome {
namespace {
void ShowPrintErrorDialogTask() {
- Browser* browser = chrome::FindLastActiveWithHostDesktopType(
- chrome::GetActiveDesktop());
+ Browser* browser = chrome::FindLastActive();
ShowMessageBox(browser ? browser->window()->GetNativeWindow() : NULL,
l10n_util::GetStringUTF16(IDS_PRINT_SPOOL_FAILED_TITLE_TEXT),
l10n_util::GetStringUTF16(IDS_PRINT_SPOOL_FAILED_ERROR_TEXT),
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
index 0b79bda..013d1bf 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -425,13 +425,12 @@ void AddIconToLastMenuItem(gfx::Image icon, ui::SimpleMenuModel* menu) {
}
#endif // !defined(OS_CHROMEOS)
-void OnProfileCreated(chrome::HostDesktopType desktop_type,
- const GURL& link_url,
+void OnProfileCreated(const GURL& link_url,
const content::Referrer& referrer,
Profile* profile,
Profile::CreateStatus status) {
if (status == Profile::CREATE_STATUS_INITIALIZED) {
- Browser* browser = chrome::FindLastActiveWithProfile(profile, desktop_type);
+ Browser* browser = chrome::FindLastActiveWithProfile(profile);
chrome::NavigateParams nav_params(browser, link_url,
ui::PAGE_TRANSITION_LINK);
nav_params.disposition = NEW_FOREGROUND_TAB;
@@ -898,9 +897,6 @@ void RenderViewContextMenu::AppendLinkItems() {
ProfileManager* profile_manager = g_browser_process->profile_manager();
const ProfileInfoCache& profile_info_cache =
profile_manager->GetProfileInfoCache();
- chrome::HostDesktopType desktop_type =
- chrome::GetHostDesktopTypeForNativeView(
- source_web_contents_->GetNativeView());
// Find all regular profiles other than the current one which have at
// least one open window.
@@ -915,7 +911,7 @@ void RenderViewContextMenu::AppendLinkItems() {
!profile_info_cache.IsOmittedProfileAtIndex(profile_index) &&
!profile_info_cache.ProfileIsSigninRequiredAtIndex(profile_index)) {
target_profiles.push_back(profile_index);
- if (chrome::FindLastActiveWithProfile(profile, desktop_type))
+ if (chrome::FindLastActiveWithProfile(profile))
multiple_profiles_open_ = true;
}
}
@@ -1668,7 +1664,7 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) {
Profile* profile = profile_manager->GetProfileByPath(profile_path);
UmaEnumOpenLinkAsUser profile_state;
- if (chrome::FindLastActiveWithProfile(profile, desktop_type)) {
+ if (chrome::FindLastActiveWithProfile(profile)) {
profile_state = OPEN_LINK_AS_USER_ACTIVE_PROFILE_ENUM_ID;
} else if (multiple_profiles_open_) {
profile_state =
@@ -1682,7 +1678,7 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) {
profiles::SwitchToProfile(
profile_path, desktop_type, false,
- base::Bind(OnProfileCreated, desktop_type, params_.link_url,
+ base::Bind(OnProfileCreated, params_.link_url,
CreateReferrer(params_.link_url, params_)),
ProfileMetrics::SWITCH_PROFILE_CONTEXT_MENU);
return;
diff --git a/chrome/browser/safe_browsing/srt_fetcher_win.cc b/chrome/browser/safe_browsing/srt_fetcher_win.cc
index 5e376d7..6d86c0a 100644
--- a/chrome/browser/safe_browsing/srt_fetcher_win.cc
+++ b/chrome/browser/safe_browsing/srt_fetcher_win.cc
@@ -96,7 +96,7 @@ void DisplaySRTPrompt(const base::FilePath& download_path) {
// reporter. We can't use other ways of finding a browser because we don't
// have a profile.
chrome::HostDesktopType desktop_type = chrome::GetActiveDesktop();
- Browser* browser = chrome::FindLastActiveWithHostDesktopType(desktop_type);
+ Browser* browser = chrome::FindLastActive();
if (!browser)
return;
@@ -526,8 +526,7 @@ class ReporterRunner : public chrome::BrowserListObserver {
// a profile, which we need, to tell whether we should prompt or not.
// TODO(mad): crbug.com/503269, investigate whether we should change how we
// decide when it's time to download the SRT and when to display the prompt.
- chrome::HostDesktopType desktop_type = chrome::GetActiveDesktop();
- Browser* browser = chrome::FindLastActiveWithHostDesktopType(desktop_type);
+ Browser* browser = chrome::FindLastActive();
if (!browser) {
RecordReporterStepHistogram(SW_REPORTER_NO_BROWSER);
BrowserList::AddObserver(this);
diff --git a/chrome/browser/safe_browsing/srt_global_error_win.cc b/chrome/browser/safe_browsing/srt_global_error_win.cc
index f3d1f51..69f40626 100644
--- a/chrome/browser/safe_browsing/srt_global_error_win.cc
+++ b/chrome/browser/safe_browsing/srt_global_error_win.cc
@@ -198,8 +198,7 @@ void SRTGlobalError::MaybeExecuteSRT() {
void SRTGlobalError::FallbackToDownloadPage() {
RecordSRTPromptHistogram(SRT_PROMPT_FALLBACK);
- chrome::HostDesktopType desktop_type = chrome::GetActiveDesktop();
- Browser* browser = chrome::FindLastActiveWithHostDesktopType(desktop_type);
+ Browser* browser = chrome::FindLastActive();
if (browser) {
browser->OpenURL(content::OpenURLParams(
GURL(kSRTDownloadURL), content::Referrer(), NEW_FOREGROUND_TAB,
diff --git a/chrome/browser/translate/chrome_translate_client.cc b/chrome/browser/translate/chrome_translate_client.cc
index 5cbebe2..76496a4 100644
--- a/chrome/browser/translate/chrome_translate_client.cc
+++ b/chrome/browser/translate/chrome_translate_client.cc
@@ -331,10 +331,8 @@ void ChromeTranslateClient::ShowBubble(
// because the bubble takes the focus from the other widgets including the
// browser windows. So it is checked that |browser| is the last activated
// browser, not is now activated.
- if (browser !=
- chrome::FindLastActiveWithHostDesktopType(browser->host_desktop_type())) {
+ if (browser != chrome::FindLastActive())
return;
- }
// During auto-translating, the bubble should not be shown.
if (step == translate::TRANSLATE_STEP_TRANSLATING ||
diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
index 818a165..d20b66a 100644
--- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
@@ -493,8 +493,7 @@ bool SystemTrayDelegateChromeOS::ShouldShowDisplayNotification() {
// Packaged app is not counted as 'last active', so if a browser opening the
// display settings is in background of a packaged app, it will return true.
// TODO(mukai): fix this.
- Browser* active_browser =
- chrome::FindLastActiveWithHostDesktopType(chrome::HOST_DESKTOP_TYPE_ASH);
+ Browser* active_browser = chrome::FindLastActive();
if (!active_browser)
return true;
diff --git a/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc b/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc
index a14af17..e7bda79 100644
--- a/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc
+++ b/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc
@@ -107,9 +107,8 @@ class CloseObserver : public content::WebContentsObserver {
class BrowserActivationObserver : public chrome::BrowserListObserver {
public:
- explicit BrowserActivationObserver(chrome::HostDesktopType desktop_type)
- : browser_(chrome::FindLastActiveWithHostDesktopType(desktop_type)),
- observed_(false) {
+ BrowserActivationObserver()
+ : browser_(chrome::FindLastActive()), observed_(false) {
BrowserList::AddObserver(this);
}
~BrowserActivationObserver() override { BrowserList::RemoveObserver(this); }
@@ -580,8 +579,7 @@ IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, ModalPopUnder) {
NavigateAndCheckPopupShown(url, ExpectPopup);
- Browser* popup_browser =
- chrome::FindLastActiveWithHostDesktopType(browser()->host_desktop_type());
+ Browser* popup_browser = chrome::FindLastActive();
ASSERT_NE(popup_browser, browser());
// Showing an alert will raise the tab over the popup.
@@ -593,15 +591,12 @@ IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, ModalPopUnder) {
app_modal::JavaScriptAppModalDialog* js_dialog =
static_cast<app_modal::JavaScriptAppModalDialog*>(dialog);
- BrowserActivationObserver activation_observer(browser()->host_desktop_type());
+ BrowserActivationObserver activation_observer;
js_dialog->native_dialog()->AcceptAppModalDialog();
- if (popup_browser != chrome::FindLastActiveWithHostDesktopType(
- popup_browser->host_desktop_type())) {
+ if (popup_browser != chrome::FindLastActive())
activation_observer.WaitForActivation();
- }
- ASSERT_EQ(popup_browser, chrome::FindLastActiveWithHostDesktopType(
- popup_browser->host_desktop_type()));
+ ASSERT_EQ(popup_browser, chrome::FindLastActive());
}
void BuildSimpleWebKeyEvent(blink::WebInputEvent::Type type,
diff --git a/chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.cc b/chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.cc
index b78d631..f64655b 100644
--- a/chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.cc
+++ b/chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.cc
@@ -37,8 +37,7 @@ void BookmarkBubbleSignInDelegate::OnBrowserRemoved(Browser* browser) {
void BookmarkBubbleSignInDelegate::EnsureBrowser() {
if (!browser_) {
Profile* original_profile = profile_->GetOriginalProfile();
- browser_ = chrome::FindLastActiveWithProfile(original_profile,
- desktop_type_);
+ browser_ = chrome::FindLastActiveWithProfile(original_profile);
if (!browser_) {
browser_ = new Browser(Browser::CreateParams(original_profile,
desktop_type_));
diff --git a/chrome/browser/ui/browser_finder.cc b/chrome/browser/ui/browser_finder.cc
index e79cae3..159e1eb 100644
--- a/chrome/browser/ui/browser_finder.cc
+++ b/chrome/browser/ui/browser_finder.cc
@@ -201,7 +201,7 @@ Browser* FindBrowserWithWebContents(const WebContents* web_contents) {
return NULL;
}
-Browser* FindLastActiveWithProfile(Profile* profile, HostDesktopType type) {
+Browser* FindLastActiveWithProfile(Profile* profile) {
BrowserList* list = BrowserList::GetInstance();
// We are only interested in last active browsers, so we don't fall back to
// all browsers like FindBrowserWith* do.
@@ -209,7 +209,7 @@ Browser* FindLastActiveWithProfile(Profile* profile, HostDesktopType type) {
profile, Browser::FEATURE_NONE, kMatchAny);
}
-Browser* FindLastActiveWithHostDesktopType(HostDesktopType type) {
+Browser* FindLastActive() {
BrowserList* browser_list_impl = BrowserList::GetInstance();
if (browser_list_impl)
return browser_list_impl->GetLastActive();
diff --git a/chrome/browser/ui/browser_finder.h b/chrome/browser/ui/browser_finder.h
index 8425c9f..0daeaab 100644
--- a/chrome/browser/ui/browser_finder.h
+++ b/chrome/browser/ui/browser_finder.h
@@ -67,7 +67,7 @@ Browser* FindBrowserWithWebContents(const content::WebContents* web_contents);
// clicks on another app before the first browser window appears) then this
// returns NULL.
// WARNING #2: this will always be NULL in unit tests run on the bots.
-Browser* FindLastActiveWithProfile(Profile* profile, HostDesktopType type);
+Browser* FindLastActiveWithProfile(Profile* profile);
// Returns the Browser object on the given desktop type whose window was most
// recently active. If no such Browsers exist, returns NULL.
@@ -77,7 +77,7 @@ Browser* FindLastActiveWithProfile(Profile* profile, HostDesktopType type);
// clicks on another app before the first browser window appears) then this
// returns NULL.
// WARNING #2: this will always be NULL in unit tests run on the bots.
-Browser* FindLastActiveWithHostDesktopType(HostDesktopType type);
+Browser* FindLastActive();
// Returns the number of browsers across all profiles and desktops.
size_t GetTotalBrowserCount();
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
index dadf9ad..8955416 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
@@ -153,8 +153,8 @@ void BrowserWindowCocoa::Show() {
// browser at the time |Show()| is called. This is the natural behaviour under
// Windows, but |-makeKeyAndOrderFront:| won't send |-windowDidBecomeMain:|
// until we return to the runloop. Therefore any calls to
- // |chrome::FindLastActiveWithHostDesktopType| will return the previous
- // browser instead if we don't explicitly set it here.
+ // |chrome::FindLastActive| will return the previous browser instead if we
+ // don't explicitly set it here.
BrowserList::SetLastActive(browser_);
bool is_session_restore = browser_->is_session_restore();
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index 0299daa..d8a1f67 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -295,9 +295,7 @@ void SetUpBrowserWindowCommandHandler(NSWindow* window) {
if (browser_->is_type_popup() &&
windowRect.x() == 0 && windowRect.y() == 0) {
gfx::Size size = windowRect.size();
- windowRect.set_origin(
- WindowSizer::GetDefaultPopupOrigin(size,
- browser_->host_desktop_type()));
+ windowRect.set_origin(WindowSizer::GetDefaultPopupOrigin(size));
}
// Size and position the window. Note that it is not yet onscreen. Popup
diff --git a/chrome/browser/ui/cocoa/handoff_active_url_observer.cc b/chrome/browser/ui/cocoa/handoff_active_url_observer.cc
index a2862e4..ba154b2 100644
--- a/chrome/browser/ui/cocoa/handoff_active_url_observer.cc
+++ b/chrome/browser/ui/cocoa/handoff_active_url_observer.cc
@@ -18,8 +18,7 @@ HandoffActiveURLObserver::HandoffActiveURLObserver(
DCHECK(delegate_);
BrowserList::AddObserver(this);
- SetActiveBrowser(chrome::FindLastActiveWithHostDesktopType(
- chrome::HOST_DESKTOP_TYPE_NATIVE));
+ SetActiveBrowser(chrome::FindLastActive());
}
HandoffActiveURLObserver::~HandoffActiveURLObserver() {
@@ -36,8 +35,7 @@ void HandoffActiveURLObserver::OnBrowserRemoved(Browser* removed_browser) {
if (active_browser_ != removed_browser)
return;
- SetActiveBrowser(chrome::FindLastActiveWithHostDesktopType(
- chrome::HOST_DESKTOP_TYPE_NATIVE));
+ SetActiveBrowser(chrome::FindLastActive());
delegate_->HandoffActiveURLChanged(GetActiveWebContents());
}
diff --git a/chrome/browser/ui/cocoa/last_active_browser_cocoa.cc b/chrome/browser/ui/cocoa/last_active_browser_cocoa.cc
index d0cd335..3bece9d 100644
--- a/chrome/browser/ui/cocoa/last_active_browser_cocoa.cc
+++ b/chrome/browser/ui/cocoa/last_active_browser_cocoa.cc
@@ -9,7 +9,7 @@
namespace chrome {
Browser* GetLastActiveBrowser() {
- return FindLastActiveWithHostDesktopType(HOST_DESKTOP_TYPE_NATIVE);
+ return FindLastActive();
}
} // namespace chrome
diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model_browsertest.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model_browsertest.cc
index 6303502..2a54f7f 100644
--- a/chrome/browser/ui/content_settings/content_setting_bubble_model_browsertest.cc
+++ b/chrome/browser/ui/content_settings/content_setting_bubble_model_browsertest.cc
@@ -119,8 +119,7 @@ class ContentSettingBubbleModelMediaStreamTest : public InProcessBrowserTest {
content::WebContents* GetActiveTab() {
// First, we need to find the active browser window. It should be at
// the same desktop as the browser in which we invoked the bubble.
- Browser* active_browser = chrome::FindLastActiveWithHostDesktopType(
- browser()->host_desktop_type());
+ Browser* active_browser = chrome::FindLastActive();
return active_browser->tab_strip_model()->GetActiveWebContents();
}
};
diff --git a/chrome/browser/ui/extensions/extension_install_ui_default.cc b/chrome/browser/ui/extensions/extension_install_ui_default.cc
index b954ca4..1848168 100644
--- a/chrome/browser/ui/extensions/extension_install_ui_default.cc
+++ b/chrome/browser/ui/extensions/extension_install_ui_default.cc
@@ -211,8 +211,7 @@ void ExtensionInstallUIDefault::OnInstallFailure(
if (disable_failure_ui_for_tests() || skip_post_install_ui_)
return;
- Browser* browser =
- chrome::FindLastActiveWithProfile(profile_, chrome::GetActiveDesktop());
+ Browser* browser = chrome::FindLastActiveWithProfile(profile_);
if (!browser) // Can be NULL in unittests.
return;
WebContents* web_contents =
@@ -256,8 +255,7 @@ void ExtensionInstallUIDefault::SetSkipPostInstallUI(bool skip_ui) {
}
gfx::NativeWindow ExtensionInstallUIDefault::GetDefaultInstallDialogParent() {
- Browser* browser =
- chrome::FindLastActiveWithProfile(profile_, chrome::GetActiveDesktop());
+ Browser* browser = chrome::FindLastActiveWithProfile(profile_);
if (browser) {
content::WebContents* contents =
browser->tab_strip_model()->GetActiveWebContents();
diff --git a/chrome/browser/ui/network_profile_bubble.cc b/chrome/browser/ui/network_profile_bubble.cc
index 3ac8ae4..d6fb3d9 100644
--- a/chrome/browser/ui/network_profile_bubble.cc
+++ b/chrome/browser/ui/network_profile_bubble.cc
@@ -174,8 +174,7 @@ void NetworkProfileBubble::RecordUmaEvent(MetricNetworkedProfileCheck event) {
// static
void NetworkProfileBubble::NotifyNetworkProfileDetected() {
- Browser* browser = chrome::FindLastActiveWithHostDesktopType(
- chrome::GetActiveDesktop());
+ Browser* browser = chrome::FindLastActive();
if (browser)
ShowNotification(browser);
diff --git a/chrome/browser/ui/startup/default_browser_prompt.cc b/chrome/browser/ui/startup/default_browser_prompt.cc
index a6efe4c..2357af0 100644
--- a/chrome/browser/ui/startup/default_browser_prompt.cc
+++ b/chrome/browser/ui/startup/default_browser_prompt.cc
@@ -260,7 +260,7 @@ void CheckDefaultBrowserObserver::ResetCheckDefaultBrowserPref() {
}
void CheckDefaultBrowserObserver::ShowPrompt() {
- Browser* browser = chrome::FindLastActiveWithHostDesktopType(desktop_type_);
+ Browser* browser = chrome::FindLastActive();
if (!browser)
return; // Reached during ui tests.
diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
index 47d5793..4061c1c 100644
--- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
+++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
@@ -545,7 +545,7 @@ Browser* OneClickSigninSyncStarter::EnsureBrowser(
// The user just created a new profile or has closed the browser that
// we used previously. Grab the most recently active browser or else
// create a new one.
- browser = chrome::FindLastActiveWithProfile(profile, desktop_type);
+ browser = chrome::FindLastActiveWithProfile(profile);
if (!browser) {
browser = new Browser(Browser::CreateParams(profile,
desktop_type));
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 964b105..6c31812 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -1842,9 +1842,7 @@ bool BrowserView::GetSavedWindowPlacement(
// assume none were given by the window.open() command.
if (window_rect.x() == 0 && window_rect.y() == 0) {
gfx::Size size = window_rect.size();
- window_rect.set_origin(
- WindowSizer::GetDefaultPopupOrigin(size,
- browser_->host_desktop_type()));
+ window_rect.set_origin(WindowSizer::GetDefaultPopupOrigin(size));
}
*bounds = window_rect;
diff --git a/chrome/browser/ui/views/profiles/user_manager_view.cc b/chrome/browser/ui/views/profiles/user_manager_view.cc
index 34e67ec..cd9ce66 100644
--- a/chrome/browser/ui/views/profiles/user_manager_view.cc
+++ b/chrome/browser/ui/views/profiles/user_manager_view.cc
@@ -285,8 +285,7 @@ void UserManagerView::Init(Profile* system_profile, const GURL& url) {
profile_manager->GetLastUsedProfileDir(profile_manager->user_data_dir());
Profile* profile = profile_manager->GetProfileByPath(last_used_profile_path);
if (profile) {
- Browser* browser = chrome::FindLastActiveWithProfile(profile,
- chrome::GetActiveDesktop());
+ Browser* browser = chrome::FindLastActiveWithProfile(profile);
if (browser) {
gfx::NativeView native_view =
views::Widget::GetWidgetForNativeWindow(
diff --git a/chrome/browser/ui/views/select_file_dialog_extension.cc b/chrome/browser/ui/views/select_file_dialog_extension.cc
index 61c50f0..9784d6a 100644
--- a/chrome/browser/ui/views/select_file_dialog_extension.cc
+++ b/chrome/browser/ui/views/select_file_dialog_extension.cc
@@ -123,10 +123,8 @@ void FindRuntimeContext(gfx::NativeWindow owner_window,
} else {
// If the owning window is still unknown, this could be a background page or
// and extension popup. Use the last active browser.
- if (!owner_browser) {
- owner_browser =
- chrome::FindLastActiveWithHostDesktopType(chrome::GetActiveDesktop());
- }
+ if (!owner_browser)
+ owner_browser = chrome::FindLastActive();
if (owner_browser) {
*base_window = owner_browser->window();
*web_contents = owner_browser->tab_strip_model()->GetActiveWebContents();
diff --git a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
index ab68868..c97de48 100644
--- a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
+++ b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
@@ -386,8 +386,7 @@ bool InlineSigninHelper::HandleCrossAccountError(
return false;
}
- Browser* browser = chrome::FindLastActiveWithProfile(
- profile_, chrome::GetActiveDesktop());
+ Browser* browser = chrome::FindLastActiveWithProfile(profile_);
content::WebContents* web_contents =
browser->tab_strip_model()->GetActiveWebContents();
@@ -410,8 +409,7 @@ void InlineSigninHelper::ConfirmEmailAction(
OneClickSigninSyncStarter::ConfirmationRequired confirmation_required,
OneClickSigninSyncStarter::StartSyncMode start_mode,
InlineSigninHelper::Action action) {
- Browser* browser = chrome::FindLastActiveWithProfile(
- profile_, chrome::GetActiveDesktop());
+ Browser* browser = chrome::FindLastActiveWithProfile(profile_);
switch (action) {
case InlineSigninHelper::CREATE_NEW_USER:
content::RecordAction(
@@ -859,10 +857,8 @@ void InlineLoginHandlerImpl::HandleLoginError(const std::string& error_msg) {
Browser* InlineLoginHandlerImpl::GetDesktopBrowser() {
Browser* browser = chrome::FindBrowserWithWebContents(
web_ui()->GetWebContents());
- if (!browser) {
- browser = chrome::FindLastActiveWithProfile(
- Profile::FromWebUI(web_ui()), chrome::GetActiveDesktop());
- }
+ if (!browser)
+ browser = chrome::FindLastActiveWithProfile(Profile::FromWebUI(web_ui()));
return browser;
}
diff --git a/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc b/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
index 4c07b75..b5194fe 100644
--- a/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
+++ b/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
@@ -96,10 +96,8 @@ void SyncConfirmationHandler::OnAccountUpdated(const AccountInfo& info) {
Browser* SyncConfirmationHandler::GetDesktopBrowser() {
Browser* browser = chrome::FindBrowserWithWebContents(
web_ui()->GetWebContents());
- if (!browser) {
- browser = chrome::FindLastActiveWithProfile(
- Profile::FromWebUI(web_ui()), chrome::GetActiveDesktop());
- }
+ if (!browser)
+ browser = chrome::FindLastActiveWithProfile(Profile::FromWebUI(web_ui()));
DCHECK(browser);
return browser;
}
diff --git a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
index 26df800..fe0fafa 100644
--- a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
+++ b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
@@ -207,7 +207,7 @@ void UrlHashHelper::ExecuteUrlHash() {
Browser* target_browser = browser_;
if (!target_browser) {
- target_browser = chrome::FindLastActiveWithProfile(profile_, desktop_type_);
+ target_browser = chrome::FindLastActiveWithProfile(profile_);
if (!target_browser)
return;
}
diff --git a/chrome/browser/ui/window_sizer/window_sizer.h b/chrome/browser/ui/window_sizer/window_sizer.h
index 5d74b00..8408392 100644
--- a/chrome/browser/ui/window_sizer/window_sizer.h
+++ b/chrome/browser/ui/window_sizer/window_sizer.h
@@ -7,7 +7,6 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/ui/host_desktop.h"
#include "ui/base/ui_base_types.h"
#include "ui/gfx/geometry/rect.h"
@@ -108,8 +107,7 @@ class WindowSizer {
ui::WindowShowState* show_state);
// Returns the default origin for popups of the given size.
- static gfx::Point GetDefaultPopupOrigin(const gfx::Size& size,
- chrome::HostDesktopType type);
+ static gfx::Point GetDefaultPopupOrigin(const gfx::Size& size);
// How much horizontal and vertical offset there is between newly
// opened windows. This value may be different on each platform.
diff --git a/chrome/browser/ui/window_sizer/window_sizer_aura.cc b/chrome/browser/ui/window_sizer/window_sizer_aura.cc
index 358bd4b..0406ef5 100644
--- a/chrome/browser/ui/window_sizer/window_sizer_aura.cc
+++ b/chrome/browser/ui/window_sizer/window_sizer_aura.cc
@@ -4,15 +4,12 @@
#include "chrome/browser/ui/window_sizer/window_sizer.h"
-#include "chrome/browser/ui/host_desktop.h"
-
// This doesn't matter for aura, which has different tiling.
// static
const int WindowSizer::kWindowTilePixels = 10;
// static
-gfx::Point WindowSizer::GetDefaultPopupOrigin(const gfx::Size& size,
- chrome::HostDesktopType type) {
+gfx::Point WindowSizer::GetDefaultPopupOrigin(const gfx::Size& size) {
// TODO(skuhne): Check if this isn't needed anymore (since it is implemented
// in WindowPositioner) and remove it.
return gfx::Point();
diff --git a/chrome/browser/ui/window_sizer/window_sizer_mac.mm b/chrome/browser/ui/window_sizer/window_sizer_mac.mm
index 64d049f..0254641 100644
--- a/chrome/browser/ui/window_sizer/window_sizer_mac.mm
+++ b/chrome/browser/ui/window_sizer/window_sizer_mac.mm
@@ -9,20 +9,18 @@
#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"
// How much horizontal and vertical offset there is between newly
// opened windows.
const int WindowSizer::kWindowTilePixels = 22;
// static
-gfx::Point WindowSizer::GetDefaultPopupOrigin(const gfx::Size& size,
- chrome::HostDesktopType type) {
+gfx::Point WindowSizer::GetDefaultPopupOrigin(const gfx::Size& size) {
NSRect work_area = [[NSScreen mainScreen] visibleFrame];
NSRect main_area = [[[NSScreen screens] firstObject] frame];
NSPoint corner = NSMakePoint(NSMinX(work_area), NSMaxY(work_area));
- if (Browser* browser = chrome::FindLastActiveWithHostDesktopType(type)) {
+ if (Browser* browser = chrome::FindLastActive()) {
NSWindow* window = browser->window()->GetNativeWindow();
NSRect window_frame = [window frame];