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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 // The browser can be automatically restarted when: | 108 // The browser can be automatically restarted when: |
109 // 1. It's in the background mode (no visible windows). | 109 // 1. It's in the background mode (no visible windows). |
110 // 2. An update exe is present in the install folder. | 110 // 2. An update exe is present in the install folder. |
111 static bool CanRestartForUpdate(); | 111 static bool CanRestartForUpdate(); |
112 | 112 |
113 // Starts a user initiated exit process. Called from Browser::Exit. | 113 // Starts a user initiated exit process. Called from Browser::Exit. |
114 // On platforms other than ChromeOS, this is equivalent to | 114 // On platforms other than ChromeOS, this is equivalent to |
115 // CloseAllBrowsersAndExit. On ChromeOS, this tells session manager | 115 // CloseAllBrowsersAndExit. On ChromeOS, this tells session manager |
116 // that chrome is signing out, which lets session manager send | 116 // that chrome is signing out, which lets session manager send |
117 // SIGTERM to start actual exit process. | 117 // SIGTERM to start actual exit process. |
118 static void AttemptUserExit(); | 118 static void AttemptUserExit(bool restart); |
Finnur
2011/11/30 18:32:04
nit: maybe document the |restart| param (also belo
| |
119 | 119 |
120 // Starts a user initiated restart process. On platforms other than | 120 // Starts a user initiated restart process. On platforms other than |
121 // chromeos, this sets a restart bit in the preference so that | 121 // chromeos, this sets a restart bit in the preference so that |
122 // chrome will be restarted at the end of shutdown process. On | 122 // chrome will be restarted at the end of shutdown process. On |
123 // ChromeOS, this simply exits the chrome, which lets sesssion | 123 // ChromeOS, this simply exits the chrome, which lets sesssion |
124 // manager re-launch the browser with restore last session flag. | 124 // manager re-launch the browser with restore last session flag. |
125 static void AttemptRestart(); | 125 static void AttemptRestart(); |
126 | 126 |
127 // Attempt to exit by closing all browsers. This is equivalent to | 127 // Attempt to exit by closing all browsers. This is equivalent to |
128 // CloseAllBrowsers() on platforms where the application exits | 128 // CloseAllBrowsers() on platforms where the application exits |
129 // when no more windows are remaining. On other platforms (the Mac), | 129 // when no more windows are remaining. On other platforms (the Mac), |
130 // this will additionally exit the application if all browsers are | 130 // this will additionally exit the application if all browsers are |
131 // successfully closed. | 131 // successfully closed. |
132 // Note that he exit process may be interrupted by download or | 132 // Note that he exit process may be interrupted by download or |
Finnur
2011/11/30 18:32:04
nit: extra space at the front.
| |
133 // unload handler, and the browser may or may not exit. | 133 // unload handler, and the browser may or may not exit. |
134 static void AttemptExit(); | 134 static void AttemptExit(bool restart); |
135 | 135 |
136 #if defined(OS_CHROMEOS) | 136 #if defined(OS_CHROMEOS) |
137 // This is equivalent to AttemptUserExit, except that it always set | 137 // This is equivalent to AttemptUserExit, except that it always set |
138 // exit cleanly bit. ChroemOS checks if it can exit without user | 138 // exit cleanly bit. ChroemOS checks if it can exit without user |
139 // interactions, so it will always exit the browser. This is used to | 139 // interactions, so it will always exit the browser. This is used to |
140 // handle SIGTERM on chromeos which is a signal to force shutdown | 140 // handle SIGTERM on chromeos which is a signal to force shutdown |
141 // the chrome. | 141 // the chrome. |
142 static void ExitCleanly(); | 142 static void ExitCleanly(); |
143 #endif | 143 #endif |
144 | 144 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 // For ChromeOS, also request session manager to end the session. | 203 // For ChromeOS, also request session manager to end the session. |
204 static void NotifyAndTerminate(bool fast_path); | 204 static void NotifyAndTerminate(bool fast_path); |
205 | 205 |
206 // Called once there are no more browsers open and the application is exiting. | 206 // Called once there are no more browsers open and the application is exiting. |
207 static void AllBrowsersClosedAndAppExiting(); | 207 static void AllBrowsersClosedAndAppExiting(); |
208 | 208 |
209 private: | 209 private: |
210 // Helper method to remove a browser instance from a list of browsers | 210 // Helper method to remove a browser instance from a list of browsers |
211 static void RemoveBrowserFrom(Browser* browser, BrowserVector* browser_list); | 211 static void RemoveBrowserFrom(Browser* browser, BrowserVector* browser_list); |
212 static void MarkAsCleanShutdown(); | 212 static void MarkAsCleanShutdown(); |
213 static void AttemptExitInternal(); | 213 static void AttemptExitInternal(bool restart); |
214 | 214 |
215 // Counter of calls to StartKeepAlive(). If non-zero, the application will | 215 // Counter of calls to StartKeepAlive(). If non-zero, the application will |
216 // continue running after the last browser has exited. | 216 // continue running after the last browser has exited. |
217 static int keep_alive_count_; | 217 static int keep_alive_count_; |
218 }; | 218 }; |
219 | 219 |
220 class TabContentsWrapper; | 220 class TabContentsWrapper; |
221 | 221 |
222 // Iterates through all web view hosts in all browser windows. Because the | 222 // Iterates through all web view hosts in all browser windows. Because the |
223 // renderers act asynchronously, getting a host through this interface does | 223 // renderers act asynchronously, getting a host through this interface does |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 // iterator over the TabContentsWrappers doing background printing. | 282 // iterator over the TabContentsWrappers doing background printing. |
283 std::set<TabContentsWrapper*>::const_iterator bg_printing_iterator_; | 283 std::set<TabContentsWrapper*>::const_iterator bg_printing_iterator_; |
284 | 284 |
285 // Current TabContents, or NULL if we're at the end of the list. This can | 285 // Current TabContents, or NULL if we're at the end of the list. This can |
286 // be extracted given the browser iterator and index, but it's nice to cache | 286 // be extracted given the browser iterator and index, but it's nice to cache |
287 // this since the caller may access the current host many times. | 287 // this since the caller may access the current host many times. |
288 TabContentsWrapper* cur_; | 288 TabContentsWrapper* cur_; |
289 }; | 289 }; |
290 | 290 |
291 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_ | 291 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_ |
OLD | NEW |