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 28 matching lines...) Expand all Loading... |
39 // Shutdown chrome cleanly without blocking. This is called | 39 // Shutdown chrome cleanly without blocking. This is called |
40 // when SIGTERM is received on Chrome OS, and always sets | 40 // when SIGTERM is received on Chrome OS, and always sets |
41 // exit-cleanly bit and exits the browser, even if there is | 41 // exit-cleanly bit and exits the browser, even if there is |
42 // ongoing downloads or a page with onbeforeunload handler. | 42 // ongoing downloads or a page with onbeforeunload handler. |
43 // | 43 // |
44 // If you need to exit or restart in your code on ChromeOS, | 44 // If you need to exit or restart in your code on ChromeOS, |
45 // use AttemptExit or AttemptRestart respectively. | 45 // use AttemptExit or AttemptRestart respectively. |
46 void ExitCleanly(); | 46 void ExitCleanly(); |
47 #endif | 47 #endif |
48 | 48 |
| 49 #if !defined(OS_ANDROID) |
49 // Closes all browsers and if successful, quits. | 50 // Closes all browsers and if successful, quits. |
50 void CloseAllBrowsersAndQuit(); | 51 void CloseAllBrowsersAndQuit(); |
51 | 52 |
52 // 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 |
53 // 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 |
54 // 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 |
55 // browser windows keeping it alive or the application is quitting. | 56 // browser windows keeping it alive or the application is quitting. |
56 void CloseAllBrowsers(); | 57 void CloseAllBrowsers(); |
57 | 58 |
58 // Begins shutdown of the application when the desktop session is ending. | 59 // Begins shutdown of the application when the desktop session is ending. |
59 void SessionEnding(); | 60 void SessionEnding(); |
60 | 61 |
61 // Tells the BrowserList to keep the application alive after the last Browser | 62 // Tells the BrowserList to keep the application alive after the last Browser |
62 // closes. This is implemented as a count, so callers should pair their calls | 63 // closes. This is implemented as a count, so callers should pair their calls |
63 // to IncrementKeepAliveCount() with matching calls to DecrementKeepAliveCount() | 64 // to IncrementKeepAliveCount() with matching calls to DecrementKeepAliveCount() |
64 // when they no | 65 // when they no |
65 // longer need to keep the application running. | 66 // longer need to keep the application running. |
66 void IncrementKeepAliveCount(); | 67 void IncrementKeepAliveCount(); |
67 | 68 |
68 // Stops keeping the application alive after the last Browser is closed. | 69 // Stops keeping the application alive after the last Browser is closed. |
69 // Should match a previous call to IncrementKeepAliveCount(). | 70 // Should match a previous call to IncrementKeepAliveCount(). |
70 void DecrementKeepAliveCount(); | 71 void DecrementKeepAliveCount(); |
71 | 72 |
72 // Returns true if application will continue running after the last Browser | 73 // Returns true if application will continue running after the last Browser |
73 // closes. | 74 // closes. |
74 bool WillKeepAlive(); | 75 bool WillKeepAlive(); |
| 76 #endif // !defined(OS_ANDROID) |
75 | 77 |
76 // Emits APP_TERMINATING notification. It is guaranteed that the | 78 // Emits APP_TERMINATING notification. It is guaranteed that the |
77 // notification is sent only once. | 79 // notification is sent only once. |
78 void NotifyAppTerminating(); | 80 void NotifyAppTerminating(); |
79 | 81 |
80 // Send out notifications. | 82 // Send out notifications. |
81 // For ChromeOS, also request session manager to end the session. | 83 // For ChromeOS, also request session manager to end the session. |
82 void NotifyAndTerminate(bool fast_path); | 84 void NotifyAndTerminate(bool fast_path); |
83 | 85 |
| 86 #if !defined(OS_ANDROID) |
84 // Called once the application is exiting. | 87 // Called once the application is exiting. |
85 void OnAppExiting(); | 88 void OnAppExiting(); |
86 | 89 |
87 // Called once the application is exiting to do any platform specific | 90 // Called once the application is exiting to do any platform specific |
88 // processing required. | 91 // processing required. |
89 void HandleAppExitingForPlatform(); | 92 void HandleAppExitingForPlatform(); |
90 | 93 |
91 // Disable browser shutdown for unit tests. | 94 // Disable browser shutdown for unit tests. |
92 void DisableShutdownForTesting(bool disable_shutdown_for_testing); | 95 void DisableShutdownForTesting(bool disable_shutdown_for_testing); |
| 96 #endif // !defined(OS_ANDROID) |
93 | 97 |
94 } // namespace chrome | 98 } // namespace chrome |
95 | 99 |
96 #endif // CHROME_BROWSER_LIFETIME_APPLICATION_LIFETIME_H_ | 100 #endif // CHROME_BROWSER_LIFETIME_APPLICATION_LIFETIME_H_ |
OLD | NEW |