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 "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 | 10 |
11 class Profile; | 11 class Profile; |
12 | 12 |
13 namespace contents { | 13 namespace contents { |
14 class NavigationController; | 14 class NavigationController; |
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 browser { |
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 Browser* FindTabbedBrowser(Profile* profile, bool match_original_profiles); | 28 Browser* FindTabbedBrowser(Profile* profile, bool match_original_profiles); |
29 // Same as above, but for a specific host desktop type. | |
30 Browser* FindDesktopTabbedBrowser(Profile* profile, | |
31 chrome::HostDesktopType type, | |
32 bool match_original_profiles); | |
29 | 33 |
30 // Returns the first tabbed browser matching |profile|. If there is no tabbed | 34 // Returns the first tabbed browser matching |profile|. If there is no tabbed |
31 // browser a new one is created and returned. If a new browser is created it is | 35 // browser a new one is created and returned. If a new browser is created it is |
32 // not made visible. | 36 // not made visible. |
33 Browser* FindOrCreateTabbedBrowser(Profile* profile); | 37 Browser* FindOrCreateTabbedBrowser(Profile* profile); |
38 // Same as above, but for a specific host desktop type. | |
39 Browser* FindOrCreateDesktopTabbedBrowser(Profile* profile, | |
40 chrome::HostDesktopType type); | |
34 | 41 |
35 // Find an existing browser window with any type. See comment above for | 42 // Find an existing browser window with any type. See comment above for |
36 // additional information. | 43 // additional information. |
37 Browser* FindAnyBrowser(Profile* profile, bool match_original_profiles); | 44 Browser* FindAnyBrowser(Profile* profile, bool match_original_profiles); |
45 // Same as above, but for a specific host desktop type. | |
46 Browser* FindDesktopBrowser(Profile* profile, | |
47 chrome::HostDesktopType type, | |
48 bool match_original_profiles); | |
38 | 49 |
39 // Find an existing browser window with the provided profile. Searches in the | 50 // Find an existing browser window with the provided profile. Searches in the |
40 // order of last activation. Only browsers that have been active can be | 51 // order of last activation. Only browsers that have been active can be |
41 // returned. Returns NULL if no such browser currently exists. | 52 // returned. Returns NULL if no such browser currently exists. |
42 Browser* FindBrowserWithProfile(Profile* profile); | 53 Browser* FindBrowserWithProfile(Profile* profile); |
54 // Same as above, but for a specific host desktop type. | |
55 Browser* FindDesktopBrowserWithProfile(Profile* profile, | |
56 chrome::HostDesktopType type); | |
57 | |
58 // Find an existing browser window with the provided profile and of the provided | |
59 // host desktop type. Searches in the order of last activation. Only browsers | |
60 // that have been active can be returned. Returns NULL if no such browser | |
61 // currently exists. | |
62 Browser* FindDesktopBrowserWithProfile(Profile* profile, | |
63 chrome::HostDesktopType type); | |
robertshield
2012/08/16 21:05:16
this looks duplicated from line 55
MAD
2012/08/17 12:45:51
Oupsss... :-)
Done.
| |
43 | 64 |
44 // Find an existing browser with the provided ID. Returns NULL if no such | 65 // Find an existing browser with the provided ID. Returns NULL if no such |
45 // browser currently exists. | 66 // browser currently exists. |
46 Browser* FindBrowserWithID(SessionID::id_type desired_id); | 67 Browser* FindBrowserWithID(SessionID::id_type desired_id); |
47 | 68 |
48 // Find the browser represented by |window| or NULL if not found. | 69 // Find the browser represented by |window| or NULL if not found. |
49 Browser* FindBrowserWithWindow(gfx::NativeWindow window); | 70 Browser* FindBrowserWithWindow(gfx::NativeWindow window); |
50 | 71 |
51 // Find the browser containing |web_contents| or NULL if none is found. | 72 // Find the browser containing |web_contents| or NULL if none is found. |
52 // |web_contents| must not be NULL. | 73 // |web_contents| must not be NULL. |
(...skipping 12 matching lines...) Expand all Loading... | |
65 | 86 |
66 // Returns the number of browsers with the Profile |profile|. | 87 // Returns the number of browsers with the Profile |profile|. |
67 size_t GetBrowserCount(Profile* profile); | 88 size_t GetBrowserCount(Profile* profile); |
68 | 89 |
69 // Returns the number of tabbed browsers with the Profile |profile|. | 90 // Returns the number of tabbed browsers with the Profile |profile|. |
70 size_t GetTabbedBrowserCount(Profile* profile); | 91 size_t GetTabbedBrowserCount(Profile* profile); |
71 | 92 |
72 } // namespace browser | 93 } // namespace browser |
73 | 94 |
74 #endif // CHROME_BROWSER_UI_BROWSER_FINDER_H_ | 95 #endif // CHROME_BROWSER_UI_BROWSER_FINDER_H_ |
OLD | NEW |