| 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_BROWSER_SHUTDOWN_H_ | 5 #ifndef CHROME_BROWSER_BROWSER_SHUTDOWN_H_ |
| 6 #define CHROME_BROWSER_BROWSER_SHUTDOWN_H_ | 6 #define CHROME_BROWSER_BROWSER_SHUTDOWN_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 class PrefRegistrySimple; | 10 class PrefRegistrySimple; |
| 11 | 11 |
| 12 namespace browser_shutdown { | 12 namespace browser_shutdown { |
| 13 | 13 |
| 14 // Shutdown flags |
| 15 enum Flags { |
| 16 NO_FLAGS = 0, |
| 17 |
| 18 // If |RESTART_LAST_SESSION| is set, the browser will attempt to restart in |
| 19 // in the last session after the shutdown. |
| 20 RESTART_LAST_SESSION = 1 << 0, |
| 21 |
| 22 // Makes a panned restart happen in the background. The browser will just come |
| 23 // up in the system tray but not open a new window after restarting. This flag |
| 24 // has no effect if |RESTART_LAST_SESSION| is not set. |
| 25 RESTART_IN_BACKGROUND = 1 << 1 |
| 26 }; |
| 27 |
| 14 enum ShutdownType { | 28 enum ShutdownType { |
| 15 // an uninitialized value | 29 // an uninitialized value |
| 16 NOT_VALID = 0, | 30 NOT_VALID = 0, |
| 17 // the last browser window was closed | 31 // the last browser window was closed |
| 18 WINDOW_CLOSE, | 32 WINDOW_CLOSE, |
| 19 // user clicked on the Exit menu item | 33 // user clicked on the Exit menu item |
| 20 BROWSER_EXIT, | 34 BROWSER_EXIT, |
| 21 // windows is logging off or shutting down | 35 // windows is logging off or shutting down |
| 22 END_SESSION | 36 END_SESSION |
| 23 }; | 37 }; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 #if !defined(OS_ANDROID) | 48 #if !defined(OS_ANDROID) |
| 35 // Performs the shutdown tasks that need to be done before | 49 // Performs the shutdown tasks that need to be done before |
| 36 // BrowserProcess and the various threads go away. | 50 // BrowserProcess and the various threads go away. |
| 37 // | 51 // |
| 38 // Returns true if the session should be restarted. | 52 // Returns true if the session should be restarted. |
| 39 bool ShutdownPreThreadsStop(); | 53 bool ShutdownPreThreadsStop(); |
| 40 | 54 |
| 41 // Performs the remaining shutdown tasks after all threads but the | 55 // Performs the remaining shutdown tasks after all threads but the |
| 42 // main thread have been stopped. This includes deleting g_browser_process. | 56 // main thread have been stopped. This includes deleting g_browser_process. |
| 43 // | 57 // |
| 44 // The provided parameter indicates whether a preference to restart | 58 // See |browser_shutdown::Flags| for the possible flag values and their effects. |
| 45 // the session was present. | 59 void ShutdownPostThreadsStop(int shutdown_flags); |
| 46 void ShutdownPostThreadsStop(bool restart_last_session); | |
| 47 #endif | 60 #endif |
| 48 | 61 |
| 49 // Called at startup to create a histogram from our previous shutdown time. | 62 // Called at startup to create a histogram from our previous shutdown time. |
| 50 void ReadLastShutdownInfo(); | 63 void ReadLastShutdownInfo(); |
| 51 | 64 |
| 52 // There are various situations where the browser process should continue to | 65 // There are various situations where the browser process should continue to |
| 53 // run after the last browser window has closed - the Mac always continues | 66 // run after the last browser window has closed - the Mac always continues |
| 54 // running until the user explicitly quits, and on Windows/Linux the application | 67 // running until the user explicitly quits, and on Windows/Linux the application |
| 55 // should not shutdown when the last browser window closes if there are any | 68 // should not shutdown when the last browser window closes if there are any |
| 56 // BackgroundContents running. | 69 // BackgroundContents running. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 71 bool IsTryingToQuit(); | 84 bool IsTryingToQuit(); |
| 72 | 85 |
| 73 // Starts to collect shutdown traces. On ChromeOS this will start immediately | 86 // Starts to collect shutdown traces. On ChromeOS this will start immediately |
| 74 // on AttemptUserExit() and all other systems will start once all tabs are | 87 // on AttemptUserExit() and all other systems will start once all tabs are |
| 75 // closed. | 88 // closed. |
| 76 void StartShutdownTracing(); | 89 void StartShutdownTracing(); |
| 77 | 90 |
| 78 } // namespace browser_shutdown | 91 } // namespace browser_shutdown |
| 79 | 92 |
| 80 #endif // CHROME_BROWSER_BROWSER_SHUTDOWN_H_ | 93 #endif // CHROME_BROWSER_BROWSER_SHUTDOWN_H_ |
| OLD | NEW |