| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "ui/aura/window.h" |
| 11 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 12 | 13 |
| 13 class Profile; | 14 class Profile; |
| 14 | 15 |
| 15 namespace contents { | 16 namespace contents { |
| 16 class WebContents; | 17 class WebContents; |
| 17 } | 18 } |
| 18 | 19 |
| 19 // Collection of functions to find Browsers based on various criteria. | 20 // Collection of functions to find Browsers based on various criteria. |
| 20 | 21 |
| 21 namespace chrome { | 22 namespace chrome { |
| 22 | 23 |
| 23 // If you want to find the last active tabbed browser and create a new browser | 24 // If you want to find the last active tabbed browser and create a new browser |
| 24 // if there are no tabbed browsers, use ScopedTabbedBrowserDisplayer. | 25 // if there are no tabbed browsers, use ScopedTabbedBrowserDisplayer. |
| 25 | 26 |
| 26 // Retrieve the last active tabbed browser with a profile matching |profile|. | 27 // Retrieve the last active tabbed browser with a profile matching |profile|. |
| 27 // If |match_original_profiles| is true, matching is done based on the | 28 // If |match_original_profiles| is true, matching is done based on the |
| 28 // original profile, eg profile->GetOriginalProfile() == | 29 // original profile, eg profile->GetOriginalProfile() == |
| 29 // browser->profile()->GetOriginalProfile(). This has the effect of matching | 30 // browser->profile()->GetOriginalProfile(). This has the effect of matching |
| 30 // against both non-incognito and incognito profiles. If | 31 // against both non-incognito and incognito profiles. If |
| 31 // |match_original_profiles| is false, only an exact match may be returned. | 32 // |match_original_profiles| is false, only an exact match may be returned. |
| 32 Browser* FindTabbedBrowser(Profile* profile, bool match_original_profiles); | 33 Browser* FindTabbedBrowser(Profile* profile, bool match_original_profiles); |
| 33 | 34 |
| 35 // Similar to FindTabbedBrowser(), but only retrieves the browser in the |
| 36 // |root_window|. |
| 37 Browser* FindTabbedBrowserInRootWindow(Profile* profile, |
| 38 bool match_original_profiles, |
| 39 const aura::Window* root_window); |
| 40 |
| 34 // Finds an existing browser window of any kind. | 41 // Finds an existing browser window of any kind. |
| 35 Browser* FindAnyBrowser(Profile* profile, | 42 Browser* FindAnyBrowser(Profile* profile, |
| 36 bool match_original_profiles); | 43 bool match_original_profiles); |
| 37 | 44 |
| 38 // Find an existing browser window with the provided profile. Searches in the | 45 // Find an existing browser window with the provided profile. Searches in the |
| 39 // order of last activation. Only browsers that have been active can be | 46 // order of last activation. Only browsers that have been active can be |
| 40 // returned. Returns NULL if no such browser currently exists. | 47 // returned. Returns NULL if no such browser currently exists. |
| 41 Browser* FindBrowserWithProfile(Profile* profile); | 48 Browser* FindBrowserWithProfile(Profile* profile); |
| 42 | 49 |
| 43 // Find an existing browser with the provided ID. Returns NULL if no such | 50 // Find an existing browser with the provided ID. Returns NULL if no such |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 83 |
| 77 // Returns the number of browsers with the Profile |profile|. | 84 // Returns the number of browsers with the Profile |profile|. |
| 78 size_t GetBrowserCount(Profile* profile); | 85 size_t GetBrowserCount(Profile* profile); |
| 79 | 86 |
| 80 // Returns the number of tabbed browsers with the Profile |profile|. | 87 // Returns the number of tabbed browsers with the Profile |profile|. |
| 81 size_t GetTabbedBrowserCount(Profile* profile); | 88 size_t GetTabbedBrowserCount(Profile* profile); |
| 82 | 89 |
| 83 } // namespace chrome | 90 } // namespace chrome |
| 84 | 91 |
| 85 #endif // CHROME_BROWSER_UI_BROWSER_FINDER_H_ | 92 #endif // CHROME_BROWSER_UI_BROWSER_FINDER_H_ |
| OLD | NEW |