| 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/display/types/display_constants.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 // If |display_id| is not equal to display::kInvalidDisplayId, only the browsers |
| 34 // in the corresponding display may be returned. |
| 35 Browser* FindTabbedBrowser(Profile* profile, |
| 36 bool match_original_profiles, |
| 37 int64_t display_id = display::kInvalidDisplayId); |
| 33 | 38 |
| 34 // Finds an existing browser window of any kind. | 39 // Finds an existing browser window of any kind. |
| 35 Browser* FindAnyBrowser(Profile* profile, | 40 Browser* FindAnyBrowser(Profile* profile, |
| 36 bool match_original_profiles); | 41 bool match_original_profiles); |
| 37 | 42 |
| 38 // Find an existing browser window with the provided profile. Searches in the | 43 // 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 | 44 // order of last activation. Only browsers that have been active can be |
| 40 // returned. Returns NULL if no such browser currently exists. | 45 // returned. Returns NULL if no such browser currently exists. |
| 41 Browser* FindBrowserWithProfile(Profile* profile); | 46 Browser* FindBrowserWithProfile(Profile* profile); |
| 42 | 47 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 81 |
| 77 // Returns the number of browsers with the Profile |profile|. | 82 // Returns the number of browsers with the Profile |profile|. |
| 78 size_t GetBrowserCount(Profile* profile); | 83 size_t GetBrowserCount(Profile* profile); |
| 79 | 84 |
| 80 // Returns the number of tabbed browsers with the Profile |profile|. | 85 // Returns the number of tabbed browsers with the Profile |profile|. |
| 81 size_t GetTabbedBrowserCount(Profile* profile); | 86 size_t GetTabbedBrowserCount(Profile* profile); |
| 82 | 87 |
| 83 } // namespace chrome | 88 } // namespace chrome |
| 84 | 89 |
| 85 #endif // CHROME_BROWSER_UI_BROWSER_FINDER_H_ | 90 #endif // CHROME_BROWSER_UI_BROWSER_FINDER_H_ |
| OLD | NEW |