| 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 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #if !defined(OS_ANDROID) | 49 #if !defined(OS_ANDROID) |
| 50 // Closes all browsers and if successful, quits. | 50 // Closes all browsers and if successful, quits. |
| 51 void CloseAllBrowsersAndQuit(); | 51 void CloseAllBrowsersAndQuit(); |
| 52 | 52 |
| 53 // Closes all browsers. If the session is ending the windows are closed | 53 // Closes all browsers. If the session is ending the windows are closed |
| 54 // directly. Otherwise the windows are closed by way of posting a WM_CLOSE | 54 // directly. Otherwise the windows are closed by way of posting a WM_CLOSE |
| 55 // message. This will quit the application if there is nothing other than | 55 // message. This will quit the application if there is nothing other than |
| 56 // browser windows keeping it alive or the application is quitting. | 56 // browser windows keeping it alive or the application is quitting. |
| 57 void CloseAllBrowsers(); | 57 void CloseAllBrowsers(); |
| 58 | 58 |
| 59 // If there are no browsers open and we aren't already shutting down, |
| 60 // initiate a shutdown. Also skips shutdown if this is a unit test. |
| 61 // (MessageLoop::current() == null or explicitly disabled). |
| 62 void CloseAllBrowsersIfNeeded(); |
| 63 |
| 59 // Begins shutdown of the application when the desktop session is ending. | 64 // Begins shutdown of the application when the desktop session is ending. |
| 60 void SessionEnding(); | 65 void SessionEnding(); |
| 61 | 66 |
| 62 // Tells the BrowserList to keep the application alive after the last Browser | |
| 63 // closes. This is implemented as a count, so callers should pair their calls | |
| 64 // to IncrementKeepAliveCount() with matching calls to DecrementKeepAliveCount() | |
| 65 // when they no | |
| 66 // longer need to keep the application running. | |
| 67 void IncrementKeepAliveCount(); | |
| 68 | |
| 69 // Stops keeping the application alive after the last Browser is closed. | |
| 70 // Should match a previous call to IncrementKeepAliveCount(). | |
| 71 void DecrementKeepAliveCount(); | |
| 72 | |
| 73 // Returns the current keep alive count. | |
| 74 int GetKeepAliveCountForTesting(); | |
| 75 | |
| 76 // Returns true if application will continue running after the last Browser | |
| 77 // closes. | |
| 78 bool WillKeepAlive(); | |
| 79 #endif // !defined(OS_ANDROID) | 67 #endif // !defined(OS_ANDROID) |
| 80 | 68 |
| 81 // Emits APP_TERMINATING notification. It is guaranteed that the | 69 // Emits APP_TERMINATING notification. It is guaranteed that the |
| 82 // notification is sent only once. | 70 // notification is sent only once. |
| 83 void NotifyAppTerminating(); | 71 void NotifyAppTerminating(); |
| 84 | 72 |
| 85 // Send out notifications. | 73 // Send out notifications. |
| 86 // For ChromeOS, also request session manager to end the session. | 74 // For ChromeOS, also request session manager to end the session. |
| 87 void NotifyAndTerminate(bool fast_path); | 75 void NotifyAndTerminate(bool fast_path); |
| 88 | 76 |
| 89 #if !defined(OS_ANDROID) | 77 #if !defined(OS_ANDROID) |
| 90 // Called once the application is exiting. | 78 // Called once the application is exiting. |
| 91 void OnAppExiting(); | 79 void OnAppExiting(); |
| 92 | 80 |
| 93 // Called once the application is exiting to do any platform specific | 81 // Called once the application is exiting to do any platform specific |
| 94 // processing required. | 82 // processing required. |
| 95 void HandleAppExitingForPlatform(); | 83 void HandleAppExitingForPlatform(); |
| 96 | 84 |
| 97 // Disable browser shutdown for unit tests. | 85 // Disable browser shutdown for unit tests. |
| 98 void DisableShutdownForTesting(bool disable_shutdown_for_testing); | 86 void DisableShutdownForTesting(bool disable_shutdown_for_testing); |
| 99 #endif // !defined(OS_ANDROID) | 87 #endif // !defined(OS_ANDROID) |
| 100 | 88 |
| 101 } // namespace chrome | 89 } // namespace chrome |
| 102 | 90 |
| 103 #endif // CHROME_BROWSER_LIFETIME_APPLICATION_LIFETIME_H_ | 91 #endif // CHROME_BROWSER_LIFETIME_APPLICATION_LIFETIME_H_ |
| OLD | NEW |