OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 class PrefService; | 8 class PrefService; |
9 | 9 |
10 namespace browser_shutdown { | 10 namespace browser_shutdown { |
(...skipping 26 matching lines...) Expand all Loading... |
37 // . When the last browser has been deleted and the message loop has finished | 37 // . When the last browser has been deleted and the message loop has finished |
38 // running. | 38 // running. |
39 // . When ChromeFrame::EndSession is invoked and we need to do cleanup. | 39 // . When ChromeFrame::EndSession is invoked and we need to do cleanup. |
40 // NOTE: in this case the message loop is still running, but will die soon | 40 // NOTE: in this case the message loop is still running, but will die soon |
41 // after this returns. | 41 // after this returns. |
42 void Shutdown(); | 42 void Shutdown(); |
43 | 43 |
44 // Called at startup to create a histogram from our previous shutdown time. | 44 // Called at startup to create a histogram from our previous shutdown time. |
45 void ReadLastShutdownInfo(); | 45 void ReadLastShutdownInfo(); |
46 | 46 |
47 #if defined(OS_MACOSX) | 47 // There are various situations where the browser process should continue to |
48 // On Mac, closing the last window does not automatically quit the application. | 48 // run after the last browser window has closed - the Mac always continues |
49 // To actually quit, set a flag which makes final window closure trigger a quit. | 49 // running until the user explicitly quits, and on Windows/Linux the application |
50 // If the quit is aborted, then the flag should be reset (but see notes below on | 50 // should not shutdown when the last browser window closes if there are any |
51 // the proper way to do this, i.e., usually not using |SetTryingToQuit()|). | 51 // BackgroundContents running. |
| 52 // When the user explicitly chooses to shutdown the app (via the "Exit" or |
| 53 // "Quit" menu items) BrowserList will call SetTryingToQuit() to tell itself to |
| 54 // initiate a shutdown when the last window closes. |
| 55 // If the quit is aborted, then the flag should be reset. |
52 | 56 |
53 // This is a low-level mutator; in general, don't call it, except from | 57 // This is a low-level mutator; in general, don't call SetTryingToQuit(true), |
54 // appropriate places in the app controller. To quit, use usual means, e.g., | 58 // except from appropriate places in BrowserList. To quit, use usual means, |
55 // using |chrome_browser_application_mac::Terminate()|. To stop quitting, use | 59 // e.g., using |chrome_browser_application_mac::Terminate()| on the Mac, or |
56 // |chrome_browser_application_mac::CancelTerminate()|. | 60 // |BrowserList::CloseAllWindowsAndExit()| on other platforms. To stop quitting, |
| 61 // use |chrome_browser_application_mac::CancelTerminate()| on the Mac; other |
| 62 // platforms can call SetTryingToQuit(false) directly. |
57 void SetTryingToQuit(bool quitting); | 63 void SetTryingToQuit(bool quitting); |
58 | 64 |
59 // General accessor. | 65 // General accessor. |
60 bool IsTryingToQuit(); | 66 bool IsTryingToQuit(); |
61 #endif // OS_MACOSX | |
62 | 67 |
63 } // namespace browser_shutdown | 68 } // namespace browser_shutdown |
64 | 69 |
65 #endif // CHROME_BROWSER_BROWSER_SHUTDOWN_H__ | 70 #endif // CHROME_BROWSER_BROWSER_SHUTDOWN_H__ |
OLD | NEW |