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> |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 // Attempt to exit by closing all browsers. This is equivalent to | 121 // Attempt to exit by closing all browsers. This is equivalent to |
122 // CloseAllBrowsers() on platforms where the application exits | 122 // CloseAllBrowsers() on platforms where the application exits |
123 // when no more windows are remaining. On other platforms (the Mac), | 123 // when no more windows are remaining. On other platforms (the Mac), |
124 // this will additionally exit the application if all browsers are | 124 // this will additionally exit the application if all browsers are |
125 // successfully closed. | 125 // successfully closed. |
126 // Note that he exit process may be interrupted by download or | 126 // Note that he exit process may be interrupted by download or |
127 // unload handler, and the browser may or may not exit. | 127 // unload handler, and the browser may or may not exit. |
128 static void AttemptExit(); | 128 static void AttemptExit(); |
129 | 129 |
130 #if defined(OS_CHROMEOS) | |
131 // This is equivalent to AttemptUserExit, except that it always set | |
132 // exit cleanly bit. ChroemOS checks if it can exit without user | |
133 // interactions, so it will always exit the browser. This is used to | |
134 // handle SIGTERM on chromeos which is a signal to force shutdown | |
135 // the chrome. | |
136 static void ExitCleanly(); | |
137 #endif | |
138 | |
139 // Closes all browsers. If the session is ending the windows are closed | 130 // Closes all browsers. If the session is ending the windows are closed |
140 // directly. Otherwise the windows are closed by way of posting a WM_CLOSE | 131 // directly. Otherwise the windows are closed by way of posting a WM_CLOSE |
141 // message. | 132 // message. |
142 static void CloseAllBrowsers(); | 133 static void CloseAllBrowsers(); |
143 | 134 |
144 // Begins shutdown of the application when the desktop session is ending. | 135 // Begins shutdown of the application when the desktop session is |
| 136 // ending. This first calls BrowserProcess::EndSession then force |
| 137 // closes browsers, therefore any crashes after EndSession won't be |
| 138 // included in UMA stats. |
145 static void SessionEnding(); | 139 static void SessionEnding(); |
146 | 140 |
147 // Returns true if there is at least one Browser with the specified profile. | 141 // Returns true if there is at least one Browser with the specified profile. |
148 static bool HasBrowserWithProfile(Profile* profile); | 142 static bool HasBrowserWithProfile(Profile* profile); |
149 | 143 |
150 // Tells the BrowserList to keep the application alive after the last Browser | 144 // Tells the BrowserList to keep the application alive after the last Browser |
151 // closes. This is implemented as a count, so callers should pair their calls | 145 // closes. This is implemented as a count, so callers should pair their calls |
152 // to StartKeepAlive() with matching calls to EndKeepAlive() when they no | 146 // to StartKeepAlive() with matching calls to EndKeepAlive() when they no |
153 // longer need to keep the application running. | 147 // longer need to keep the application running. |
154 static void StartKeepAlive(); | 148 static void StartKeepAlive(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // Send out notifications. | 189 // Send out notifications. |
196 // For ChromeOS, also request session manager to end the session. | 190 // For ChromeOS, also request session manager to end the session. |
197 static void NotifyAndTerminate(bool fast_path); | 191 static void NotifyAndTerminate(bool fast_path); |
198 | 192 |
199 // Called once there are no more browsers open and the application is exiting. | 193 // Called once there are no more browsers open and the application is exiting. |
200 static void AllBrowsersClosedAndAppExiting(); | 194 static void AllBrowsersClosedAndAppExiting(); |
201 | 195 |
202 private: | 196 private: |
203 // Helper method to remove a browser instance from a list of browsers | 197 // Helper method to remove a browser instance from a list of browsers |
204 static void RemoveBrowserFrom(Browser* browser, BrowserVector* browser_list); | 198 static void RemoveBrowserFrom(Browser* browser, BrowserVector* browser_list); |
205 static void MarkAsCleanShutdown(); | 199 static void MarkAsCleanShutdownInUserProfiles(); |
206 static void AttemptExitInternal(); | 200 static void AttemptExitInternal(); |
207 | 201 |
208 static BrowserVector browsers_; | 202 static BrowserVector browsers_; |
209 static BrowserVector last_active_browsers_; | 203 static BrowserVector last_active_browsers_; |
210 static ObserverList<Observer> observers_; | 204 static ObserverList<Observer> observers_; |
211 | 205 |
212 // Counter of calls to StartKeepAlive(). If non-zero, the application will | 206 // Counter of calls to StartKeepAlive(). If non-zero, the application will |
213 // continue running after the last browser has exited. | 207 // continue running after the last browser has exited. |
214 static int keep_alive_count_; | 208 static int keep_alive_count_; |
215 }; | 209 }; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 // iterator over the TabContentsWrappers doing background printing. | 273 // iterator over the TabContentsWrappers doing background printing. |
280 std::set<TabContentsWrapper*>::const_iterator bg_printing_iterator_; | 274 std::set<TabContentsWrapper*>::const_iterator bg_printing_iterator_; |
281 | 275 |
282 // Current TabContents, or NULL if we're at the end of the list. This can | 276 // Current TabContents, or NULL if we're at the end of the list. This can |
283 // be extracted given the browser iterator and index, but it's nice to cache | 277 // be extracted given the browser iterator and index, but it's nice to cache |
284 // this since the caller may access the current host many times. | 278 // this since the caller may access the current host many times. |
285 TabContentsWrapper* cur_; | 279 TabContentsWrapper* cur_; |
286 }; | 280 }; |
287 | 281 |
288 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_ | 282 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_ |
OLD | NEW |