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

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

Issue 7134085: Make focus-existing-tab-on-open multi-profile-aware. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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
« chrome/browser/tabs/tab_finder.cc ('K') | « chrome/browser/ui/browser_list.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_list.cc
===================================================================
--- chrome/browser/ui/browser_list.cc (revision 88539)
+++ chrome/browser/ui/browser_list.cc (working copy)
@@ -155,6 +155,24 @@
return NULL;
}
+// Returns a vector of all browsers in the specified iterator that return true
+// from |BrowserMatches|, or an empty vector if no browsers match the
+// arguments. See |BrowserMatches| for details about the arguments.
+template <class T>
+std::vector<Browser*> FindAllBrowsersMatching(
+ const T& begin,
+ const T& end,
+ Profile* profile,
+ Browser::WindowFeature window_feature,
+ uint32 match_types) {
+ std::vector<Browser*> browsers;
+ for (T i = begin; i != end; ++i) {
+ if (BrowserMatches(*i, profile, window_feature, match_types))
+ browsers.push_back(*i);
+ }
+ return browsers;
+}
+
Browser* FindBrowserWithTabbedOrAnyType(Profile* profile,
bool match_tabbed,
bool match_incognito) {
@@ -580,6 +598,14 @@
}
// static
+std::vector<Browser*> BrowserList::GetBrowsersWithProfile(Profile* profile) {
+ std::vector<Browser*> browsers = FindAllBrowsersMatching(
+ BrowserList::begin(), BrowserList::end(), profile,
+ Browser::FEATURE_NONE, kMatchAny);
+ return browsers;
+}
+
+// static
size_t BrowserList::GetBrowserCountForType(Profile* profile,
bool match_tabbed) {
size_t result = 0;
« chrome/browser/tabs/tab_finder.cc ('K') | « chrome/browser/ui/browser_list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698