OLD | NEW |
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_list_impl.h" | 9 #include "chrome/browser/ui/browser_list_impl.h" |
10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } | 140 } |
141 | 141 |
142 Browser* FindOrCreateTabbedBrowser(Profile* profile, | 142 Browser* FindOrCreateTabbedBrowser(Profile* profile, |
143 chrome::HostDesktopType type) { | 143 chrome::HostDesktopType type) { |
144 Browser* browser = FindTabbedBrowser(profile, false, type); | 144 Browser* browser = FindTabbedBrowser(profile, false, type); |
145 if (!browser) | 145 if (!browser) |
146 browser = new Browser(Browser::CreateParams(profile, type)); | 146 browser = new Browser(Browser::CreateParams(profile, type)); |
147 return browser; | 147 return browser; |
148 } | 148 } |
149 | 149 |
| 150 } // namespace browser |
| 151 |
| 152 namespace chrome { |
| 153 |
150 Browser* FindAnyBrowser(Profile* profile, | 154 Browser* FindAnyBrowser(Profile* profile, |
151 bool match_original_profiles, | 155 bool match_original_profiles, |
152 chrome::HostDesktopType type) { | 156 HostDesktopType type) { |
153 return FindBrowserWithTabbedOrAnyType(profile, | 157 return FindBrowserWithTabbedOrAnyType(profile, |
154 type, | 158 type, |
155 false, | 159 false, |
156 match_original_profiles); | 160 match_original_profiles); |
157 } | 161 } |
158 | 162 |
159 Browser* FindBrowserWithProfile(Profile* profile, | 163 Browser* FindBrowserWithProfile(Profile* profile, |
160 chrome::HostDesktopType desktop_type) { | 164 HostDesktopType desktop_type) { |
161 return FindBrowserWithTabbedOrAnyType(profile, desktop_type, false, false); | 165 return FindBrowserWithTabbedOrAnyType(profile, desktop_type, false, false); |
162 } | 166 } |
163 | 167 |
164 } // namespace browser | |
165 | |
166 namespace chrome { | |
167 | |
168 Browser* FindBrowserWithID(SessionID::id_type desired_id) { | 168 Browser* FindBrowserWithID(SessionID::id_type desired_id) { |
169 for (BrowserList::const_iterator i = BrowserList::begin(); | 169 for (BrowserList::const_iterator i = BrowserList::begin(); |
170 i != BrowserList::end(); ++i) { | 170 i != BrowserList::end(); ++i) { |
171 if ((*i)->session_id().id() == desired_id) | 171 if ((*i)->session_id().id() == desired_id) |
172 return *i; | 172 return *i; |
173 } | 173 } |
174 return NULL; | 174 return NULL; |
175 } | 175 } |
176 | 176 |
177 Browser* FindBrowserWithWindow(gfx::NativeWindow window) { | 177 Browser* FindBrowserWithWindow(gfx::NativeWindow window) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 216 |
217 size_t GetBrowserCount(Profile* profile) { | 217 size_t GetBrowserCount(Profile* profile) { |
218 return GetBrowserCountImpl(profile, kDefaultHostDesktopType, kMatchAny); | 218 return GetBrowserCountImpl(profile, kDefaultHostDesktopType, kMatchAny); |
219 } | 219 } |
220 | 220 |
221 size_t GetTabbedBrowserCount(Profile* profile) { | 221 size_t GetTabbedBrowserCount(Profile* profile) { |
222 return GetBrowserCountImpl(profile, kDefaultHostDesktopType, kMatchTabbed); | 222 return GetBrowserCountImpl(profile, kDefaultHostDesktopType, kMatchTabbed); |
223 } | 223 } |
224 | 224 |
225 } // namespace chrome | 225 } // namespace chrome |
OLD | NEW |