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 #ifndef CHROME_BROWSER_UI_BROWSER_FINDER_H_ | 5 #ifndef CHROME_BROWSER_UI_BROWSER_FINDER_H_ |
6 #define CHROME_BROWSER_UI_BROWSER_FINDER_H_ | 6 #define CHROME_BROWSER_UI_BROWSER_FINDER_H_ |
7 | 7 |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/host_desktop.h" | 9 #include "chrome/browser/ui/host_desktop.h" |
10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
11 | 11 |
12 class Profile; | 12 class Profile; |
13 | 13 |
14 namespace contents { | 14 namespace contents { |
15 class WebContents; | 15 class WebContents; |
16 } | 16 } |
17 | 17 |
18 // Collection of functions to find Browsers based on various criteria. | 18 // Collection of functions to find Browsers based on various criteria. |
19 | 19 |
20 namespace browser { | 20 namespace chrome { |
21 | 21 |
22 // Retrieve the last active tabbed browser with a profile matching |profile|. | 22 // Retrieve the last active tabbed browser with a profile matching |profile|. |
23 // If |match_original_profiles| is true, matching is done based on the | 23 // If |match_original_profiles| is true, matching is done based on the |
24 // original profile, eg profile->GetOriginalProfile() == | 24 // original profile, eg profile->GetOriginalProfile() == |
25 // browser->profile()->GetOriginalProfile(). This has the effect of matching | 25 // browser->profile()->GetOriginalProfile(). This has the effect of matching |
26 // against both non-incognito and incognito profiles. If | 26 // against both non-incognito and incognito profiles. If |
27 // |match_original_profiles| is false, only an exact match may be returned. | 27 // |match_original_profiles| is false, only an exact match may be returned. |
28 // |type| refers to the host desktop the returned browser should belong to. | 28 // |type| refers to the host desktop the returned browser should belong to. |
29 Browser* FindTabbedBrowser(Profile* profile, | 29 Browser* FindTabbedBrowser(Profile* profile, |
30 bool match_original_profiles, | 30 bool match_original_profiles, |
31 chrome::HostDesktopType type); | 31 HostDesktopType type); |
32 | |
33 } // namespace browser | |
34 | |
35 namespace chrome { | |
36 | 32 |
37 // Returns the first tabbed browser matching |profile|. If there is no tabbed | 33 // Returns the first tabbed browser matching |profile|. If there is no tabbed |
38 // browser a new one is created and returned for the desktop specified by | 34 // browser a new one is created and returned for the desktop specified by |
39 // |type|. If a new browser is created it is not made visible. | 35 // |type|. If a new browser is created it is not made visible. |
40 Browser* FindOrCreateTabbedBrowser(Profile* profile, HostDesktopType type); | 36 Browser* FindOrCreateTabbedBrowser(Profile* profile, HostDesktopType type); |
41 | 37 |
42 // Finds an existing browser window of any kind. | 38 // Finds an existing browser window of any kind. |
43 // |type| refers to the host desktop the returned browser should belong to. | 39 // |type| refers to the host desktop the returned browser should belong to. |
44 Browser* FindAnyBrowser(Profile* profile, | 40 Browser* FindAnyBrowser(Profile* profile, |
45 bool match_original_profiles, | 41 bool match_original_profiles, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 85 |
90 // Returns the number of browsers with the Profile |profile|. | 86 // Returns the number of browsers with the Profile |profile|. |
91 size_t GetBrowserCount(Profile* profile); | 87 size_t GetBrowserCount(Profile* profile); |
92 | 88 |
93 // Returns the number of tabbed browsers with the Profile |profile|. | 89 // Returns the number of tabbed browsers with the Profile |profile|. |
94 size_t GetTabbedBrowserCount(Profile* profile); | 90 size_t GetTabbedBrowserCount(Profile* profile); |
95 | 91 |
96 } // namespace chrome | 92 } // namespace chrome |
97 | 93 |
98 #endif // CHROME_BROWSER_UI_BROWSER_FINDER_H_ | 94 #endif // CHROME_BROWSER_UI_BROWSER_FINDER_H_ |
OLD | NEW |