| 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_LIFETIME_APPLICATION_LIFETIME_H_ | 5 #ifndef CHROME_BROWSER_LIFETIME_APPLICATION_LIFETIME_H_ |
| 6 #define CHROME_BROWSER_LIFETIME_APPLICATION_LIFETIME_H_ | 6 #define CHROME_BROWSER_LIFETIME_APPLICATION_LIFETIME_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 | 9 |
| 10 class Browser; | 10 class Browser; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 // Closes all browsers. If the session is ending the windows are closed | 76 // Closes all browsers. If the session is ending the windows are closed |
| 77 // directly. Otherwise the windows are closed by way of posting a WM_CLOSE | 77 // directly. Otherwise the windows are closed by way of posting a WM_CLOSE |
| 78 // message. This will quit the application if there is nothing other than | 78 // message. This will quit the application if there is nothing other than |
| 79 // browser windows keeping it alive or the application is quitting. | 79 // browser windows keeping it alive or the application is quitting. |
| 80 void CloseAllBrowsers(); | 80 void CloseAllBrowsers(); |
| 81 | 81 |
| 82 // Begins shutdown of the application when the desktop session is ending. | 82 // Begins shutdown of the application when the desktop session is ending. |
| 83 void SessionEnding(); | 83 void SessionEnding(); |
| 84 | 84 |
| 85 // Tells the BrowserList to keep the application alive after the last Browser | |
| 86 // closes. This is implemented as a count, so callers should pair their calls | |
| 87 // to IncrementKeepAliveCount() with matching calls to DecrementKeepAliveCount() | |
| 88 // when they no | |
| 89 // longer need to keep the application running. | |
| 90 void IncrementKeepAliveCount(); | |
| 91 | |
| 92 // Stops keeping the application alive after the last Browser is closed. | |
| 93 // Should match a previous call to IncrementKeepAliveCount(). | |
| 94 void DecrementKeepAliveCount(); | |
| 95 | |
| 96 // Returns true if application will continue running after the last Browser | |
| 97 // closes. | |
| 98 bool WillKeepAlive(); | |
| 99 | |
| 100 // Emits APP_TERMINATING notification. It is guaranteed that the | 85 // Emits APP_TERMINATING notification. It is guaranteed that the |
| 101 // notification is sent only once. | 86 // notification is sent only once. |
| 102 void NotifyAppTerminating(); | 87 void NotifyAppTerminating(); |
| 103 | 88 |
| 104 // Send out notifications. | 89 // Send out notifications. |
| 105 // For ChromeOS, also request session manager to end the session. | 90 // For ChromeOS, also request session manager to end the session. |
| 106 void NotifyAndTerminate(bool fast_path); | 91 void NotifyAndTerminate(bool fast_path); |
| 107 | 92 |
| 108 // Called once the application is exiting. | 93 // Called once the application is exiting. |
| 109 void OnAppExiting(); | 94 void OnAppExiting(); |
| 110 | 95 |
| 111 // Called once the application is exiting to do any platform specific | 96 // Called once the application is exiting to do any platform specific |
| 112 // processing required. | 97 // processing required. |
| 113 void HandleAppExitingForPlatform(); | 98 void HandleAppExitingForPlatform(); |
| 114 | 99 |
| 115 // Returns true if we can start the shutdown sequence for the browser, i.e. the | 100 // Returns true if we can start the shutdown sequence for the browser, i.e. the |
| 116 // last browser window is being closed. | 101 // last browser window is being closed. |
| 117 bool ShouldStartShutdown(Browser* browser); | 102 bool ShouldStartShutdown(Browser* browser); |
| 118 | 103 |
| 119 // Disable browser shutdown for unit tests. | |
| 120 void DisableShutdownForTesting(bool disable_shutdown_for_testing); | |
| 121 | |
| 122 } // namespace chrome | 104 } // namespace chrome |
| 123 | 105 |
| 124 #endif // CHROME_BROWSER_LIFETIME_APPLICATION_LIFETIME_H_ | 106 #endif // CHROME_BROWSER_LIFETIME_APPLICATION_LIFETIME_H_ |
| OLD | NEW |