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" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 // Retrieve the last active tabbed browser with a profile matching |profile|. | 25 // Retrieve the last active tabbed browser with a profile matching |profile|. |
26 // If |match_original_profiles| is true, matching is done based on the | 26 // If |match_original_profiles| is true, matching is done based on the |
27 // original profile, eg profile->GetOriginalProfile() == | 27 // original profile, eg profile->GetOriginalProfile() == |
28 // browser->profile()->GetOriginalProfile(). This has the effect of matching | 28 // browser->profile()->GetOriginalProfile(). This has the effect of matching |
29 // against both non-incognito and incognito profiles. If | 29 // against both non-incognito and incognito profiles. If |
30 // |match_original_profiles| is false, only an exact match may be returned. | 30 // |match_original_profiles| is false, only an exact match may be returned. |
31 // |type| refers to the host desktop the returned browser should belong to. | 31 // |type| refers to the host desktop the returned browser should belong to. |
32 Browser* FindTabbedBrowser(Profile* profile, | 32 Browser* FindTabbedBrowser(Profile* profile, |
33 bool match_original_profiles, | 33 bool match_original_profiles, |
34 HostDesktopType type); | 34 ui::HostDesktopType type); |
35 | 35 |
36 // Finds an existing browser window of any kind. | 36 // Finds an existing browser window of any kind. |
37 // |type| refers to the host desktop the returned browser should belong to. | 37 // |type| refers to the host desktop the returned browser should belong to. |
38 Browser* FindAnyBrowser(Profile* profile, | 38 Browser* FindAnyBrowser(Profile* profile, |
39 bool match_original_profiles, | 39 bool match_original_profiles, |
40 HostDesktopType type); | 40 ui::HostDesktopType type); |
41 | 41 |
42 // Find an existing browser window with the provided profile and hosted in the | 42 // Find an existing browser window with the provided profile and hosted in the |
43 // given desktop. Searches in the order of last activation. Only browsers that | 43 // given desktop. Searches in the order of last activation. Only browsers that |
44 // have been active can be returned. Returns NULL if no such browser currently | 44 // have been active can be returned. Returns NULL if no such browser currently |
45 // exists. | 45 // exists. |
46 Browser* FindBrowserWithProfile(Profile* profile, HostDesktopType type); | 46 Browser* FindBrowserWithProfile(Profile* profile, ui::HostDesktopType type); |
47 | 47 |
48 // Find an existing browser with the provided ID. Returns NULL if no such | 48 // Find an existing browser with the provided ID. Returns NULL if no such |
49 // browser currently exists. | 49 // browser currently exists. |
50 Browser* FindBrowserWithID(SessionID::id_type desired_id); | 50 Browser* FindBrowserWithID(SessionID::id_type desired_id); |
51 | 51 |
52 // Find the browser represented by |window| or NULL if not found. | 52 // Find the browser represented by |window| or NULL if not found. |
53 Browser* FindBrowserWithWindow(gfx::NativeWindow window); | 53 Browser* FindBrowserWithWindow(gfx::NativeWindow window); |
54 | 54 |
55 // Find the browser containing |web_contents| or NULL if none is found. | 55 // Find the browser containing |web_contents| or NULL if none is found. |
56 // |web_contents| must not be NULL. | 56 // |web_contents| must not be NULL. |
57 Browser* FindBrowserWithWebContents(const content::WebContents* web_contents); | 57 Browser* FindBrowserWithWebContents(const content::WebContents* web_contents); |
58 | 58 |
59 // Returns the Browser object owned by |profile| on the given desktop type | 59 // Returns the Browser object owned by |profile| on the given desktop type |
60 // whose window was most recently active. If no such Browsers exist, returns | 60 // whose window was most recently active. If no such Browsers exist, returns |
61 // NULL. | 61 // NULL. |
62 // | 62 // |
63 // WARNING: this is NULL until a browser becomes active. If during startup | 63 // WARNING: this is NULL until a browser becomes active. If during startup |
64 // a browser does not become active (perhaps the user launches Chrome, then | 64 // a browser does not become active (perhaps the user launches Chrome, then |
65 // clicks on another app before the first browser window appears) then this | 65 // clicks on another app before the first browser window appears) then this |
66 // returns NULL. | 66 // returns NULL. |
67 // WARNING #2: this will always be NULL in unit tests run on the bots. | 67 // WARNING #2: this will always be NULL in unit tests run on the bots. |
68 Browser* FindLastActiveWithProfile(Profile* profile, HostDesktopType type); | 68 Browser* FindLastActiveWithProfile(Profile* profile, ui::HostDesktopType type); |
69 | 69 |
70 // Returns the Browser object on the given desktop type whose window was most | 70 // Returns the Browser object on the given desktop type whose window was most |
71 // recently active. If no such Browsers exist, returns NULL. | 71 // recently active. If no such Browsers exist, returns NULL. |
72 // | 72 // |
73 // WARNING: this is NULL until a browser becomes active. If during startup | 73 // WARNING: this is NULL until a browser becomes active. If during startup |
74 // a browser does not become active (perhaps the user launches Chrome, then | 74 // a browser does not become active (perhaps the user launches Chrome, then |
75 // clicks on another app before the first browser window appears) then this | 75 // clicks on another app before the first browser window appears) then this |
76 // returns NULL. | 76 // returns NULL. |
77 // WARNING #2: this will always be NULL in unit tests run on the bots. | 77 // WARNING #2: this will always be NULL in unit tests run on the bots. |
78 Browser* FindLastActiveWithHostDesktopType(HostDesktopType type); | 78 Browser* FindLastActiveWithHostDesktopType(ui::HostDesktopType type); |
79 | 79 |
80 // Returns the number of browsers across all profiles and desktops. | 80 // Returns the number of browsers across all profiles and desktops. |
81 size_t GetTotalBrowserCount(); | 81 size_t GetTotalBrowserCount(); |
82 | 82 |
83 // Returns the number of browsers with the Profile |profile| accross all | 83 // Returns the number of browsers with the Profile |profile| accross all |
84 // desktops. | 84 // desktops. |
85 size_t GetTotalBrowserCountForProfile(Profile* profile); | 85 size_t GetTotalBrowserCountForProfile(Profile* profile); |
86 | 86 |
87 // Returns the number of browsers with the Profile |profile| on the desktop | 87 // Returns the number of browsers with the Profile |profile| on the desktop |
88 // defined by |type|. | 88 // defined by |type|. |
89 size_t GetBrowserCount(Profile* profile, HostDesktopType type); | 89 size_t GetBrowserCount(Profile* profile, ui::HostDesktopType type); |
90 | 90 |
91 // Returns the number of tabbed browsers with the Profile |profile| on the | 91 // Returns the number of tabbed browsers with the Profile |profile| on the |
92 // desktop defined by |type|. | 92 // desktop defined by |type|. |
93 size_t GetTabbedBrowserCount(Profile* profile, HostDesktopType type); | 93 size_t GetTabbedBrowserCount(Profile* profile, ui::HostDesktopType type); |
94 | 94 |
95 } // namespace chrome | 95 } // namespace chrome |
96 | 96 |
97 #endif // CHROME_BROWSER_UI_BROWSER_FINDER_H_ | 97 #endif // CHROME_BROWSER_UI_BROWSER_FINDER_H_ |
OLD | NEW |