| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 i != browser_list_impl->end(); ++i) { | 120 i != browser_list_impl->end(); ++i) { |
| 121 if (BrowserMatches(*i, profile, Browser::FEATURE_NONE, match_types)) | 121 if (BrowserMatches(*i, profile, Browser::FEATURE_NONE, match_types)) |
| 122 count++; | 122 count++; |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 return count; | 125 return count; |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace | 128 } // namespace |
| 129 | 129 |
| 130 Browser* FindTabbedBrowser(Profile* profile, bool match_original_profiles) { | 130 Browser* FindTabbedBrowser(Profile* profile, |
| 131 bool match_original_profiles) { |
| 132 return FindTabbedBrowser(profile, match_original_profiles, |
| 133 chrome::HOST_DESKTOP_TYPE_NATIVE); |
| 134 } |
| 135 |
| 136 Browser* FindTabbedBrowser(Profile* profile, |
| 137 bool match_original_profiles, |
| 138 chrome::HostDesktopType type) { |
| 131 return FindBrowserWithTabbedOrAnyType(profile, | 139 return FindBrowserWithTabbedOrAnyType(profile, |
| 132 kDefaultHostDesktopType, | 140 type, |
| 133 true, | 141 true, |
| 134 match_original_profiles); | 142 match_original_profiles); |
| 135 } | 143 } |
| 136 | 144 |
| 137 Browser* FindOrCreateTabbedBrowser(Profile* profile) { | 145 Browser* FindOrCreateTabbedBrowser(Profile* profile) { |
| 138 Browser* browser = FindTabbedBrowser(profile, false); | 146 return FindOrCreateTabbedBrowser(profile, chrome::HOST_DESKTOP_TYPE_NATIVE); |
| 147 } |
| 148 |
| 149 Browser* FindOrCreateTabbedBrowser(Profile* profile, |
| 150 chrome::HostDesktopType type) { |
| 151 Browser* browser = FindTabbedBrowser(profile, false, type); |
| 139 if (!browser) | 152 if (!browser) |
| 140 browser = new Browser(Browser::CreateParams(profile)); | 153 browser = new Browser(Browser::CreateParams(profile)); |
| 141 return browser; | 154 return browser; |
| 142 } | 155 } |
| 143 | 156 |
| 144 Browser* FindAnyBrowser(Profile* profile, bool match_original_profiles) { | 157 Browser* FindAnyBrowser(Profile* profile, bool match_original_profiles) { |
| 145 return FindBrowserWithTabbedOrAnyType(profile, | 158 return FindBrowserWithTabbedOrAnyType(profile, |
| 146 kDefaultHostDesktopType, | 159 kDefaultHostDesktopType, |
| 147 false, | 160 false, |
| 148 match_original_profiles); | 161 match_original_profiles); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 212 |
| 200 size_t GetBrowserCount(Profile* profile) { | 213 size_t GetBrowserCount(Profile* profile) { |
| 201 return GetBrowserCountImpl(profile, kDefaultHostDesktopType, kMatchAny); | 214 return GetBrowserCountImpl(profile, kDefaultHostDesktopType, kMatchAny); |
| 202 } | 215 } |
| 203 | 216 |
| 204 size_t GetTabbedBrowserCount(Profile* profile) { | 217 size_t GetTabbedBrowserCount(Profile* profile) { |
| 205 return GetBrowserCountImpl(profile, kDefaultHostDesktopType, kMatchTabbed); | 218 return GetBrowserCountImpl(profile, kDefaultHostDesktopType, kMatchTabbed); |
| 206 } | 219 } |
| 207 | 220 |
| 208 } // namespace browser | 221 } // namespace browser |
| OLD | NEW |