| 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_iterator.h" | 8 #include "chrome/browser/ui/browser_iterator.h" |
| 9 #include "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| 11 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 11 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
| 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 13 #include "content/public/browser/navigation_controller.h" | 13 #include "content/public/browser/navigation_controller.h" |
| 14 | 14 |
| 15 using content::WebContents; | 15 using content::WebContents; |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // TODO(mad) eventually move this to host_desktop_type.h. | |
| 20 #if defined(OS_CHROMEOS) | |
| 21 chrome::HostDesktopType kDefaultHostDesktopType = chrome::HOST_DESKTOP_TYPE_ASH; | |
| 22 #else | |
| 23 chrome::HostDesktopType kDefaultHostDesktopType = | |
| 24 chrome::HOST_DESKTOP_TYPE_NATIVE; | |
| 25 #endif | |
| 26 | |
| 27 | 19 |
| 28 // Type used to indicate to match anything. | 20 // Type used to indicate to match anything. |
| 29 const int kMatchAny = 0; | 21 const int kMatchAny = 0; |
| 30 | 22 |
| 31 // See BrowserMatches for details. | 23 // See BrowserMatches for details. |
| 32 const int kMatchOriginalProfile = 1 << 0; | 24 const int kMatchOriginalProfile = 1 << 0; |
| 33 const int kMatchCanSupportWindowFeature = 1 << 1; | 25 const int kMatchCanSupportWindowFeature = 1 << 1; |
| 34 const int kMatchTabbed = 1 << 2; | 26 const int kMatchTabbed = 1 << 2; |
| 35 | 27 |
| 36 // Returns true if the specified |browser| matches the specified arguments. | 28 // Returns true if the specified |browser| matches the specified arguments. |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 189 |
| 198 size_t GetTotalBrowserCount() { | 190 size_t GetTotalBrowserCount() { |
| 199 size_t count = 0; | 191 size_t count = 0; |
| 200 for (HostDesktopType t = HOST_DESKTOP_TYPE_FIRST; t < HOST_DESKTOP_TYPE_COUNT; | 192 for (HostDesktopType t = HOST_DESKTOP_TYPE_FIRST; t < HOST_DESKTOP_TYPE_COUNT; |
| 201 t = static_cast<HostDesktopType>(t + 1)) { | 193 t = static_cast<HostDesktopType>(t + 1)) { |
| 202 count += BrowserList::GetInstance(t)->size(); | 194 count += BrowserList::GetInstance(t)->size(); |
| 203 } | 195 } |
| 204 return count; | 196 return count; |
| 205 } | 197 } |
| 206 | 198 |
| 207 size_t GetBrowserCount(Profile* profile) { | 199 size_t GetTotalBrowserCountForProfile(Profile* profile) { |
| 208 return GetBrowserCountImpl(profile, kDefaultHostDesktopType, kMatchAny); | 200 size_t count = 0; |
| 201 for (HostDesktopType t = HOST_DESKTOP_TYPE_FIRST; t < HOST_DESKTOP_TYPE_COUNT; |
| 202 t = static_cast<HostDesktopType>(t + 1)) { |
| 203 count += GetBrowserCount(profile, t); |
| 204 } |
| 205 return count; |
| 209 } | 206 } |
| 210 | 207 |
| 211 size_t GetTabbedBrowserCount(Profile* profile) { | 208 size_t GetBrowserCount(Profile* profile, HostDesktopType type) { |
| 212 return GetBrowserCountImpl(profile, kDefaultHostDesktopType, kMatchTabbed); | 209 return GetBrowserCountImpl(profile, type, kMatchAny); |
| 210 } |
| 211 |
| 212 size_t GetTabbedBrowserCount(Profile* profile, HostDesktopType type) { |
| 213 return GetBrowserCountImpl(profile, type, kMatchTabbed); |
| 213 } | 214 } |
| 214 | 215 |
| 215 } // namespace chrome | 216 } // namespace chrome |
| OLD | NEW |