| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "chrome/browser/browser_shutdown.h" |
| 13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
| 15 | 16 |
| 16 class TabContents; | 17 class TabContents; |
| 17 | 18 |
| 18 // Stores a list of all Browser objects. | 19 // Stores a list of all Browser objects. |
| 19 class BrowserList { | 20 class BrowserList { |
| 20 public: | 21 public: |
| 21 typedef std::vector<Browser*> BrowserVector; | 22 typedef std::vector<Browser*> BrowserVector; |
| 22 typedef BrowserVector::iterator iterator; | 23 typedef BrowserVector::iterator iterator; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 #endif | 144 #endif |
| 144 | 145 |
| 145 // Closes all browsers. If the session is ending the windows are closed | 146 // Closes all browsers. If the session is ending the windows are closed |
| 146 // directly. Otherwise the windows are closed by way of posting a WM_CLOSE | 147 // directly. Otherwise the windows are closed by way of posting a WM_CLOSE |
| 147 // message. | 148 // message. |
| 148 static void CloseAllBrowsers(); | 149 static void CloseAllBrowsers(); |
| 149 | 150 |
| 150 // Closes all browsers for |profile|. | 151 // Closes all browsers for |profile|. |
| 151 static void CloseAllBrowsersWithProfile(Profile* profile); | 152 static void CloseAllBrowsersWithProfile(Profile* profile); |
| 152 | 153 |
| 153 // Begins shutdown of the application when the desktop session is ending. | 154 // Begins force shutdown. |type| can be one of POWER_OFF (when |
| 154 static void SessionEnding(); | 155 // user is logging of/OS is powering off), or SHUTDOWN_WITHOUT_CLOSE |
| 156 // (when X11 is gonoe). |
| 157 static void ForceShutdown(browser_shutdown::ShutdowType type); |
| 155 | 158 |
| 156 // Returns true if there is at least one Browser with the specified profile. | 159 // Returns true if there is at least one Browser with the specified profile. |
| 157 static bool HasBrowserWithProfile(Profile* profile); | 160 static bool HasBrowserWithProfile(Profile* profile); |
| 158 | 161 |
| 159 // Tells the BrowserList to keep the application alive after the last Browser | 162 // Tells the BrowserList to keep the application alive after the last Browser |
| 160 // closes. This is implemented as a count, so callers should pair their calls | 163 // closes. This is implemented as a count, so callers should pair their calls |
| 161 // to StartKeepAlive() with matching calls to EndKeepAlive() when they no | 164 // to StartKeepAlive() with matching calls to EndKeepAlive() when they no |
| 162 // longer need to keep the application running. | 165 // longer need to keep the application running. |
| 163 static void StartKeepAlive(); | 166 static void StartKeepAlive(); |
| 164 | 167 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 // iterator over the TabContentsWrappers doing background printing. | 294 // iterator over the TabContentsWrappers doing background printing. |
| 292 std::set<TabContentsWrapper*>::const_iterator bg_printing_iterator_; | 295 std::set<TabContentsWrapper*>::const_iterator bg_printing_iterator_; |
| 293 | 296 |
| 294 // Current TabContents, or NULL if we're at the end of the list. This can | 297 // Current TabContents, or NULL if we're at the end of the list. This can |
| 295 // be extracted given the browser iterator and index, but it's nice to cache | 298 // be extracted given the browser iterator and index, but it's nice to cache |
| 296 // this since the caller may access the current host many times. | 299 // this since the caller may access the current host many times. |
| 297 TabContentsWrapper* cur_; | 300 TabContentsWrapper* cur_; |
| 298 }; | 301 }; |
| 299 | 302 |
| 300 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_ | 303 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_ |
| OLD | NEW |