Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2707)

Unified Diff: chrome/browser/ui/browser_finder.cc

Issue 10870014: Revert 152788 - Give access to browsers by Profile/HostDesktopType. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser_finder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_finder.cc
===================================================================
--- chrome/browser/ui/browser_finder.cc (revision 152789)
+++ chrome/browser/ui/browser_finder.cc (working copy)
@@ -19,15 +19,6 @@
namespace {
-// TODO(mad) eventually move this to host_desktop_type.h.
-#if defined(OS_CHROMEOS)
-chrome::HostDesktopType kDefaultHostDesktopType = chrome::HOST_DESKTOP_TYPE_ASH;
-#else
-chrome::HostDesktopType kDefaultHostDesktopType =
- chrome::HOST_DESKTOP_TYPE_NATIVE;
-#endif
-
-
// Type used to indicate to match anything.
const int kMatchAny = 0;
@@ -84,43 +75,28 @@
}
Browser* FindBrowserWithTabbedOrAnyType(Profile* profile,
- chrome::HostDesktopType desktop_type,
bool match_tabbed,
bool match_original_profiles) {
- chrome::BrowserListImpl* browser_list_impl =
- chrome::BrowserListImpl::GetInstance(desktop_type);
- if (!browser_list_impl)
- return NULL;
uint32 match_types = kMatchAny;
if (match_tabbed)
match_types |= kMatchTabbed;
if (match_original_profiles)
match_types |= kMatchOriginalProfile;
- Browser* browser = FindBrowserMatching(browser_list_impl->begin_last_active(),
- browser_list_impl->end_last_active(),
- profile,
- Browser::FEATURE_NONE,
- match_types);
+ Browser* browser = FindBrowserMatching(
+ BrowserList::begin_last_active(), BrowserList::end_last_active(),
+ profile, Browser::FEATURE_NONE, match_types);
// Fall back to a forward scan of all Browsers if no active one was found.
- return browser ? browser : FindBrowserMatching(browser_list_impl->begin(),
- browser_list_impl->end(),
- profile,
- Browser::FEATURE_NONE,
- match_types);
+ return browser ? browser :
+ FindBrowserMatching(BrowserList::begin(), BrowserList::end(), profile,
+ Browser::FEATURE_NONE, match_types);
}
-size_t GetBrowserCountImpl(Profile* profile,
- chrome::HostDesktopType desktop_type,
- uint32 match_types) {
- chrome::BrowserListImpl* browser_list_impl =
- chrome::BrowserListImpl::GetInstance(desktop_type);
+size_t GetBrowserCountImpl(Profile* profile, uint32 match_types) {
size_t count = 0;
- if (browser_list_impl) {
- for (BrowserList::const_iterator i = browser_list_impl->begin();
- i != browser_list_impl->end(); ++i) {
- if (BrowserMatches(*i, profile, Browser::FEATURE_NONE, match_types))
- count++;
- }
+ for (BrowserList::const_iterator i = BrowserList::begin();
+ i != BrowserList::end(); ++i) {
+ if (BrowserMatches(*i, profile, Browser::FEATURE_NONE, match_types))
+ count++;
}
return count;
}
@@ -129,7 +105,6 @@
Browser* FindTabbedBrowser(Profile* profile, bool match_original_profiles) {
return FindBrowserWithTabbedOrAnyType(profile,
- kDefaultHostDesktopType,
true,
match_original_profiles);
}
@@ -143,14 +118,12 @@
Browser* FindAnyBrowser(Profile* profile, bool match_original_profiles) {
return FindBrowserWithTabbedOrAnyType(profile,
- kDefaultHostDesktopType,
false,
match_original_profiles);
}
-Browser* FindBrowserWithProfile(Profile* profile,
- chrome::HostDesktopType desktop_type) {
- return FindBrowserWithTabbedOrAnyType(profile, desktop_type, false, false);
+Browser* FindBrowserWithProfile(Profile* profile) {
+ return FindAnyBrowser(profile, false);
}
Browser* FindBrowserWithID(SessionID::id_type desired_id) {
@@ -198,11 +171,11 @@
}
size_t GetBrowserCount(Profile* profile) {
- return GetBrowserCountImpl(profile, kDefaultHostDesktopType, kMatchAny);
+ return GetBrowserCountImpl(profile, kMatchAny);
}
size_t GetTabbedBrowserCount(Profile* profile) {
- return GetBrowserCountImpl(profile, kDefaultHostDesktopType, kMatchTabbed);
+ return GetBrowserCountImpl(profile, kMatchTabbed);
}
} // namespace browser
« no previous file with comments | « chrome/browser/ui/browser_finder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698