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

Side by Side Diff: chrome/browser/ui/browser_finder.cc

Issue 10831308: Revert 151036 - Speculative revert to see if this change introduced a performance regression on Mac… (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/browser_finder.h" 5 #include "chrome/browser/ui/browser_finder.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/browser_list.h" 8 #include "chrome/browser/ui/browser_list.h"
9 #include "chrome/browser/ui/browser_window.h" 9 #include "chrome/browser/ui/browser_window.h"
10 #include "chrome/browser/ui/tab_contents/tab_contents.h" 10 #include "chrome/browser/ui/tab_contents/tab_contents.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 Browser* FindBrowserWithWebContents(const WebContents* web_contents) { 147 Browser* FindBrowserWithWebContents(const WebContents* web_contents) {
148 DCHECK(web_contents); 148 DCHECK(web_contents);
149 for (TabContentsIterator it; !it.done(); ++it) { 149 for (TabContentsIterator it; !it.done(); ++it) {
150 if (it->web_contents() == web_contents) 150 if (it->web_contents() == web_contents)
151 return it.browser(); 151 return it.browser();
152 } 152 }
153 return NULL; 153 return NULL;
154 } 154 }
155 155
156 Browser* FindBrowserForController(
157 const content::NavigationController* controller,
158 int* index_result) {
159 for (BrowserList::const_iterator it = BrowserList::begin();
160 it != BrowserList::end(); ++it) {
161 int index = (*it)->tab_strip_model()->GetIndexOfWebContents(
162 controller->GetWebContents());
163 if (index != TabStripModel::kNoTab) {
164 if (index_result)
165 *index_result = index;
166 return *it;
167 }
168 }
169 return NULL;
170 }
171
172
173 Browser* FindLastActiveWithProfile(Profile* profile) { 156 Browser* FindLastActiveWithProfile(Profile* profile) {
174 // We are only interested in last active browsers, so we don't fall back to 157 // We are only interested in last active browsers, so we don't fall back to
175 // all browsers like FindBrowserWith* do. 158 // all browsers like FindBrowserWith* do.
176 return FindBrowserMatching( 159 return FindBrowserMatching(
177 BrowserList::begin_last_active(), BrowserList::end_last_active(), profile, 160 BrowserList::begin_last_active(), BrowserList::end_last_active(), profile,
178 Browser::FEATURE_NONE, kMatchAny); 161 Browser::FEATURE_NONE, kMatchAny);
179 } 162 }
180 163
181 size_t GetBrowserCount(Profile* profile) { 164 size_t GetBrowserCount(Profile* profile) {
182 return GetBrowserCountImpl(profile, kMatchAny); 165 return GetBrowserCountImpl(profile, kMatchAny);
183 } 166 }
184 167
185 size_t GetTabbedBrowserCount(Profile* profile) { 168 size_t GetTabbedBrowserCount(Profile* profile) {
186 return GetBrowserCountImpl(profile, kMatchTabbed); 169 return GetBrowserCountImpl(profile, kMatchTabbed);
187 } 170 }
188 171
189 } // namespace browser 172 } // namespace browser
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_finder.h ('k') | chrome/browser/ui/browser_tab_restore_service_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698