summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-27 16:24:46 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-27 16:24:46 +0000
commitdb9d45a5f52c126f7f414d7531ccd40cd6e2d313 (patch)
tree010a433af09060fde28c6107e472977b6ebe74fd
parent17de2f9b82e9dd71fc88c9b81a52bc204c6efb2f (diff)
downloadchromium_src-db9d45a5f52c126f7f414d7531ccd40cd6e2d313.zip
chromium_src-db9d45a5f52c126f7f414d7531ccd40cd6e2d313.tar.gz
chromium_src-db9d45a5f52c126f7f414d7531ccd40cd6e2d313.tar.bz2
Revert 169654 - FindLastActiveWithProfile now requires a HostDesktopType.
BUG=129187 TEST=none Review URL: https://chromiumcodereview.appspot.com/11365128 Speculative revert to fix Win Aura crash in unit test ExtensionServiceTest.LoadExtensionsWithPlugins. TBR=grt@chromium.org Review URL: https://codereview.chromium.org/11413189 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169664 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--PRESUBMIT.py9
-rw-r--r--chrome/browser/app_controller_mac.mm3
-rw-r--r--chrome/browser/background/background_contents_service.cc4
-rw-r--r--chrome/browser/background/background_mode_manager.cc4
-rw-r--r--chrome/browser/chromeos/drive/drive_file_system_util.cc3
-rw-r--r--chrome/browser/chromeos/extensions/file_manager_util.cc3
-rw-r--r--chrome/browser/download/chrome_download_manager_delegate.cc4
-rw-r--r--chrome/browser/download/download_crx_util.cc8
-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.cc4
-rw-r--r--chrome/browser/extensions/extension_install_ui_default.cc7
-rw-r--r--chrome/browser/notifications/balloon_host.cc4
-rw-r--r--chrome/browser/notifications/notification_options_menu_model.cc4
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc4
-rw-r--r--chrome/browser/ui/browser_finder.cc8
-rw-r--r--chrome/browser/ui/browser_finder.h8
17 files changed, 32 insertions, 52 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 515b48c..abf711e 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -152,6 +152,15 @@ _BANNED_CPP_FUNCTIONS = (
(),
),
(
+ 'chrome::FindLastActiveWithProfile',
+ (
+ 'This function is deprecated and we\'re working on removing it. Pass',
+ 'more context to get a Browser*, like a WebContents, window, or session',
+ 'id. Talk to robertshield@ for more information.',
+ ),
+ True,
+ ),
+ (
'browser::FindAnyBrowser',
(
'This function is deprecated and we\'re working on removing it. Pass',
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 09ca8aa..e10bc19 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -102,8 +102,7 @@ bool g_is_opening_new_window = false;
// not possible. If the last active browser is minimized (in particular, if
// there are only minimized windows), it will unminimize it.
Browser* ActivateBrowser(Profile* profile) {
- Browser* browser = chrome::FindLastActiveWithProfile(profile,
- chrome::HOST_DESKTOP_TYPE_NATIVE);
+ Browser* browser = chrome::FindLastActiveWithProfile(profile);
if (browser)
browser->window()->Activate();
return browser;
diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc
index e2f9fda..3263305 100644
--- a/chrome/browser/background/background_contents_service.cc
+++ b/chrome/browser/background/background_contents_service.cc
@@ -24,7 +24,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/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
@@ -616,8 +615,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_pos, user_gesture, was_blocked);
diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc
index 1dcb1bea..d4df3fa 100644
--- a/chrome/browser/background/background_mode_manager.cc
+++ b/chrome/browser/background/background_mode_manager.cc
@@ -29,7 +29,6 @@
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/extensions/application_launch.h"
-#include "chrome/browser/ui/host_desktop.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
@@ -94,8 +93,7 @@ void BackgroundModeManager::BackgroundModeData::ExecuteCommand(int item) {
}
Browser* BackgroundModeManager::BackgroundModeData::GetBrowserWindow() {
- Browser* browser = chrome::FindLastActiveWithProfile(profile_,
- chrome::GetActiveDesktop());
+ Browser* browser = chrome::FindLastActiveWithProfile(profile_);
return browser ? browser : chrome::OpenEmptyWindow(profile_);
}
diff --git a/chrome/browser/chromeos/drive/drive_file_system_util.cc b/chrome/browser/chromeos/drive/drive_file_system_util.cc
index ba8ff6d..7115b6d 100644
--- a/chrome/browser/chromeos/drive/drive_file_system_util.cc
+++ b/chrome/browser/chromeos/drive/drive_file_system_util.cc
@@ -98,8 +98,7 @@ void GetHostedDocumentURLBlockingThread(const FilePath& drive_cache_path,
}
void OpenEditURLUIThread(Profile* profile, const GURL* edit_url) {
- Browser* browser = chrome::FindLastActiveWithProfile(profile,
- chrome::HOST_DESKTOP_TYPE_ASH);
+ Browser* browser = chrome::FindLastActiveWithProfile(profile);
if (browser) {
browser->OpenURL(content::OpenURLParams(*edit_url, content::Referrer(),
CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false));
diff --git a/chrome/browser/chromeos/extensions/file_manager_util.cc b/chrome/browser/chromeos/extensions/file_manager_util.cc
index 381966f..9ea26b5 100644
--- a/chrome/browser/chromeos/extensions/file_manager_util.cc
+++ b/chrome/browser/chromeos/extensions/file_manager_util.cc
@@ -612,8 +612,7 @@ bool ExecuteDefaultHandler(Profile* profile, const FilePath& path) {
std::string extension_id = handler->extension_id();
std::string action_id = handler->id();
- Browser* browser = chrome::FindLastActiveWithProfile(profile,
- chrome::HOST_DESKTOP_TYPE_ASH);
+ Browser* browser = chrome::FindLastActiveWithProfile(profile);
// If there is no browsers for the profile, bail out. Return true so warning
// about file type not being supported is not displayed.
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc
index 8e1c8e1..a142d12 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -36,7 +36,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/ui/browser_tabstrip.h"
-#include "chrome/browser/ui/host_desktop.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/feature_switch.h"
#include "chrome/common/extensions/user_script.h"
@@ -266,8 +265,7 @@ WebContents* ChromeDownloadManagerDelegate::
#else
// Start the download in the last active browser. This is not ideal but better
// than fully hiding the download from the user.
- Browser* last_active = chrome::FindLastActiveWithProfile(profile_,
- chrome::GetActiveDesktop());
+ Browser* last_active = chrome::FindLastActiveWithProfile(profile_);
return last_active ? chrome::GetActiveWebContents(last_active) : NULL;
#endif
}
diff --git a/chrome/browser/download/download_crx_util.cc b/chrome/browser/download/download_crx_util.cc
index c8a0828..cfe5352 100644
--- a/chrome/browser/download/download_crx_util.cc
+++ b/chrome/browser/download/download_crx_util.cc
@@ -12,7 +12,6 @@
#include "chrome/browser/extensions/webstore_installer.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_notification_types.h"
#include "content/public/browser/download_item.h"
@@ -45,12 +44,9 @@ ExtensionInstallPrompt* CreateExtensionInstallPrompt(
} else {
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));
+ browser = new Browser(Browser::CreateParams(profile));
web_contents = browser->tab_strip_model()->GetActiveWebContents();
}
return new ExtensionInstallPrompt(web_contents);
diff --git a/chrome/browser/extensions/bundle_installer.cc b/chrome/browser/extensions/bundle_installer.cc
index b068680..b9c3f5f 100644
--- a/chrome/browser/extensions/bundle_installer.cc
+++ b/chrome/browser/extensions/bundle_installer.cc
@@ -107,7 +107,6 @@ BundleInstaller::BundleInstaller(Browser* browser,
const BundleInstaller::ItemList& items)
: approved_(false),
browser_(browser),
- host_desktop_type_(browser->host_desktop_type()),
profile_(browser->profile()),
delegate_(NULL) {
BrowserList::AddObserver(this);
@@ -273,7 +272,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 dd549a4..7498710 100644
--- a/chrome/browser/extensions/bundle_installer.h
+++ b/chrome/browser/extensions/bundle_installer.h
@@ -15,7 +15,6 @@
#include "chrome/browser/extensions/webstore_installer.h"
#include "chrome/browser/extensions/webstore_install_helper.h"
#include "chrome/browser/ui/browser_list_observer.h"
-#include "chrome/browser/ui/host_desktop.h"
#include "chrome/common/extensions/extension.h"
namespace base {
@@ -187,9 +186,6 @@ class BundleInstaller : public WebstoreInstallHelper::Delegate,
// The browser to show the confirmation bubble for.
Browser* browser_;
- // 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 905ebeb..9ce25d0 100644
--- a/chrome/browser/extensions/extension_error_ui_default.cc
+++ b/chrome/browser/extensions/extension_error_ui_default.cc
@@ -9,7 +9,6 @@
#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"
ExtensionErrorUIDefault::ExtensionErrorUIDefault(
ExtensionService* extension_service)
@@ -24,8 +23,7 @@ ExtensionErrorUIDefault::~ExtensionErrorUIDefault() {
bool ExtensionErrorUIDefault::ShowErrorInBubbleView() {
Browser* browser =
- chrome::FindLastActiveWithProfile(extension_service()->profile(),
- chrome::GetActiveDesktop());
+ chrome::FindLastActiveWithProfile(extension_service()->profile());
if (!browser)
return false;
diff --git a/chrome/browser/extensions/extension_install_ui_default.cc b/chrome/browser/extensions/extension_install_ui_default.cc
index 7378bdf..6929832 100644
--- a/chrome/browser/extensions/extension_install_ui_default.cc
+++ b/chrome/browser/extensions/extension_install_ui_default.cc
@@ -19,7 +19,6 @@
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/simple_message_box.h"
#include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
@@ -159,8 +158,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_);
WebContents* web_contents = chrome::GetActiveWebContents(browser);
if (!web_contents)
return;
@@ -287,7 +285,6 @@ ExtensionInstallPrompt* ExtensionInstallUI::CreateInstallPromptWithBrowser(
// static
ExtensionInstallPrompt* ExtensionInstallUI::CreateInstallPromptWithProfile(
Profile* profile) {
- Browser* browser = chrome::FindLastActiveWithProfile(profile,
- chrome::GetActiveDesktop());
+ Browser* browser = chrome::FindLastActiveWithProfile(profile);
return CreateInstallPromptWithBrowser(browser);
}
diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc
index c0ac128..5f8d48c 100644
--- a/chrome/browser/notifications/balloon_host.cc
+++ b/chrome/browser/notifications/balloon_host.cc
@@ -12,7 +12,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/browser/ui/webui/chrome_web_ui_controller_factory.h"
#include "chrome/browser/view_type_utils.h"
#include "chrome/common/chrome_notification_types.h"
@@ -85,8 +84,7 @@ void BalloonHost::AddNewContents(WebContents* source,
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_pos, user_gesture, was_blocked);
diff --git a/chrome/browser/notifications/notification_options_menu_model.cc b/chrome/browser/notifications/notification_options_menu_model.cc
index ec840f4..691d112 100644
--- a/chrome/browser/notifications/notification_options_menu_model.cc
+++ b/chrome/browser/notifications/notification_options_menu_model.cc
@@ -21,7 +21,6 @@
#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/common/chrome_switches.h"
#include "chrome/common/content_settings_types.h"
#include "chrome/common/extensions/extension.h"
@@ -251,8 +250,7 @@ void NotificationOptionsMenuModel::ExecuteCommand(int command_id) {
break;
}
case kOpenContentSettingsCommand: {
- Browser* browser = chrome::FindLastActiveWithProfile(
- balloon_->profile(), chrome::GetActiveDesktop());
+ Browser* browser = chrome::FindLastActiveWithProfile(balloon_->profile());
if (!browser) {
// It is possible that there is no browser window (e.g. when there are
// background pages, or for a chrome frame process on windows).
diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
index 7191321..caa9967 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
+++ b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
@@ -21,7 +21,6 @@
#include "chrome/browser/ui/browser_dialogs.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_url_data_manager.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/service_messages.h"
@@ -63,8 +62,7 @@ CloudPrintSetupFlow* CloudPrintSetupFlow::OpenDialog(
const base::WeakPtr<Delegate>& delegate,
gfx::NativeWindow parent_window) {
DCHECK(profile);
- Browser* browser = chrome::FindLastActiveWithProfile(profile,
- chrome::GetActiveDesktop());
+ Browser* browser = chrome::FindLastActiveWithProfile(profile);
// Set the arguments for showing the gaia login page.
DictionaryValue args;
args.SetString("user", "");
diff --git a/chrome/browser/ui/browser_finder.cc b/chrome/browser/ui/browser_finder.cc
index a881f2c..081d019 100644
--- a/chrome/browser/ui/browser_finder.cc
+++ b/chrome/browser/ui/browser_finder.cc
@@ -198,12 +198,12 @@ Browser* FindBrowserWithWebContents(const WebContents* web_contents) {
namespace chrome {
-Browser* FindLastActiveWithProfile(Profile* profile, HostDesktopType type) {
- BrowserListImpl* list = BrowserListImpl::GetInstance(type);
+Browser* FindLastActiveWithProfile(Profile* profile) {
// We are only interested in last active browsers, so we don't fall back to
// all browsers like FindBrowserWith* do.
- return FindBrowserMatching(list->begin_last_active(), list->end_last_active(),
- profile, Browser::FEATURE_NONE, kMatchAny);
+ return FindBrowserMatching(
+ BrowserList::begin_last_active(), BrowserList::end_last_active(), profile,
+ Browser::FEATURE_NONE, kMatchAny);
}
Browser* FindLastActiveWithHostDesktopType(HostDesktopType type) {
diff --git a/chrome/browser/ui/browser_finder.h b/chrome/browser/ui/browser_finder.h
index 2c55f05..cca758f 100644
--- a/chrome/browser/ui/browser_finder.h
+++ b/chrome/browser/ui/browser_finder.h
@@ -68,16 +68,16 @@ Browser* FindBrowserWithWebContents(const content::WebContents* web_contents);
namespace chrome {
-// Returns the Browser object owned by |profile| on the given desktop type
-// whose window was most recently active. If no such Browsers exist, returns
-// NULL.
+// Returns the Browser object owned by |profile| whose window was most recently
+// active. If no such Browsers exist, returns NULL.
//
// WARNING: this is NULL until a browser becomes active. If during startup
// a browser does not become active (perhaps the user launches Chrome, then
// 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);
+// DEPRECATED: DO NOT USE.
+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.