| 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_LIST_H_ | 5 #ifndef CHROME_BROWSER_UI_BROWSER_LIST_H_ |
| 6 #define CHROME_BROWSER_UI_BROWSER_LIST_H_ | 6 #define CHROME_BROWSER_UI_BROWSER_LIST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 13 | 13 |
| 14 class Browser; | 14 class Browser; |
| 15 class Profile; | 15 class Profile; |
| 16 | 16 |
| 17 namespace content { | |
| 18 class WebContents; | |
| 19 } | |
| 20 | |
| 21 namespace browser { | 17 namespace browser { |
| 22 class BrowserActivityObserver; | 18 class BrowserActivityObserver; |
| 23 #if defined(OS_MACOSX) | 19 #if defined(OS_MACOSX) |
| 24 Browser* GetLastActiveBrowser(); | 20 Browser* GetLastActiveBrowser(); |
| 25 #endif | 21 #endif |
| 26 #if defined(TOOLKIT_GTK) | 22 #if defined(TOOLKIT_GTK) |
| 27 class ExtensionInstallDialog; | 23 class ExtensionInstallDialog; |
| 28 #endif | 24 #endif |
| 25 } |
| 26 |
| 27 namespace chrome { |
| 29 namespace internal { | 28 namespace internal { |
| 30 void NotifyNotDefaultBrowserCallback(); | 29 void NotifyNotDefaultBrowserCallback(); |
| 31 } | 30 } |
| 32 } | 31 } |
| 33 | 32 |
| 34 #if defined(OS_CHROMEOS) | 33 #if defined(OS_CHROMEOS) |
| 35 namespace chromeos { | 34 namespace chromeos { |
| 36 class ScreenLocker; | 35 class ScreenLocker; |
| 37 } | 36 } |
| 38 #endif | 37 #endif |
| 39 | 38 |
| 39 namespace content { |
| 40 class WebContents; |
| 41 } |
| 42 |
| 40 #if defined(USE_ASH) | 43 #if defined(USE_ASH) |
| 41 content::WebContents* GetActiveWebContents(); | 44 content::WebContents* GetActiveWebContents(); |
| 42 #endif | 45 #endif |
| 43 | 46 |
| 44 // Stores a list of all Browser objects. | 47 // Stores a list of all Browser objects. |
| 45 class BrowserList { | 48 class BrowserList { |
| 46 public: | 49 public: |
| 47 typedef std::vector<Browser*> BrowserVector; | 50 typedef std::vector<Browser*> BrowserVector; |
| 48 typedef BrowserVector::iterator iterator; | 51 typedef BrowserVector::iterator iterator; |
| 49 typedef BrowserVector::const_iterator const_iterator; | 52 typedef BrowserVector::const_iterator const_iterator; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 friend class browser::BrowserActivityObserver; | 121 friend class browser::BrowserActivityObserver; |
| 119 #if defined(OS_CHROMEOS) | 122 #if defined(OS_CHROMEOS) |
| 120 friend class chromeos::ScreenLocker; | 123 friend class chromeos::ScreenLocker; |
| 121 #endif | 124 #endif |
| 122 #if defined(OS_MACOSX) | 125 #if defined(OS_MACOSX) |
| 123 friend Browser* browser::GetLastActiveBrowser(); | 126 friend Browser* browser::GetLastActiveBrowser(); |
| 124 #endif | 127 #endif |
| 125 #if defined(USE_ASH) | 128 #if defined(USE_ASH) |
| 126 friend content::WebContents* GetActiveWebContents(); | 129 friend content::WebContents* GetActiveWebContents(); |
| 127 #endif | 130 #endif |
| 128 friend void browser::internal::NotifyNotDefaultBrowserCallback(); | 131 friend void chrome::internal::NotifyNotDefaultBrowserCallback(); |
| 129 // DO NOT ADD MORE FRIENDS TO THIS LIST. | 132 // DO NOT ADD MORE FRIENDS TO THIS LIST. |
| 130 | 133 |
| 131 // Returns the Browser object whose window was most recently active. If the | 134 // Returns the Browser object whose window was most recently active. If the |
| 132 // most recently open Browser's window was closed, returns the first Browser | 135 // most recently open Browser's window was closed, returns the first Browser |
| 133 // in the list. If no Browsers exist, returns NULL. | 136 // in the list. If no Browsers exist, returns NULL. |
| 134 // | 137 // |
| 135 // WARNING: this is NULL until a browser becomes active. If during startup | 138 // WARNING: this is NULL until a browser becomes active. If during startup |
| 136 // a browser does not become active (perhaps the user launches Chrome, then | 139 // a browser does not become active (perhaps the user launches Chrome, then |
| 137 // clicks on another app before the first browser window appears) then this | 140 // clicks on another app before the first browser window appears) then this |
| 138 // returns NULL. | 141 // returns NULL. |
| 139 // WARNING #2: this will always be NULL in unit tests run on the bots. | 142 // WARNING #2: this will always be NULL in unit tests run on the bots. |
| 140 // THIS FUNCTION IS PRIVATE AND NOT TO BE USED AS A REPLACEMENT FOR RELEVANT | 143 // THIS FUNCTION IS PRIVATE AND NOT TO BE USED AS A REPLACEMENT FOR RELEVANT |
| 141 // CONTEXT. | 144 // CONTEXT. |
| 142 static Browser* GetLastActive(); | 145 static Browser* GetLastActive(); |
| 143 | 146 |
| 144 // Helper method to remove a browser instance from a list of browsers | 147 // Helper method to remove a browser instance from a list of browsers |
| 145 static void RemoveBrowserFrom(Browser* browser, BrowserVector* browser_list); | 148 static void RemoveBrowserFrom(Browser* browser, BrowserVector* browser_list); |
| 146 }; | 149 }; |
| 147 | 150 |
| 148 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_ | 151 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_ |
| OLD | NEW |