blob: 29157dd9221369ce75c5a2adcedd96ba52ab4cb9 [file] [log] [blame]
[email protected]2e6389f2012-05-18 19:41:251// 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
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_LIFETIME_APPLICATION_LIFETIME_H_
6#define CHROME_BROWSER_LIFETIME_APPLICATION_LIFETIME_H_
[email protected]2e6389f2012-05-18 19:41:257
[email protected]b9503276a2013-12-05 21:44:348#include "base/compiler_specific.h"
avi6846aef2015-12-26 01:09:389#include "build/build_config.h"
[email protected]b9503276a2013-12-05 21:44:3410
[email protected]3c9185a22013-04-18 21:12:5311class Browser;
12
[email protected]0c98ab652013-02-18 00:39:3713namespace chrome {
[email protected]2e6389f2012-05-18 19:41:2514
15// Starts a user initiated exit process. Called from Browser::Exit.
16// On platforms other than ChromeOS, this is equivalent to
17// CloseAllBrowsers() On ChromeOS, this tells session manager
18// that chrome is signing out, which lets session manager send
19// SIGTERM to start actual exit process.
20void AttemptUserExit();
21
22// Starts a user initiated restart process. On platforms other than
23// chromeos, this sets a restart bit in the preference so that
24// chrome will be restarted at the end of shutdown process. On
25// ChromeOS, this simply exits the chrome, which lets sesssion
26// manager re-launch the browser with restore last session flag.
27void AttemptRestart();
28
dpapad374368fd2016-06-09 04:04:4229// Starts a user initiated relaunch process. On platforms other than
30// chromeos, this is equivalent to AttemptRestart. On ChromeOS, this relaunches
31// the entire OS, instead of just relaunching the browser.
32void AttemptRelaunch();
33
[email protected]2e6389f2012-05-18 19:41:2534// Attempt to exit by closing all browsers. This is equivalent to
35// CloseAllBrowsers() on platforms where the application exits
36// when no more windows are remaining. On other platforms (the Mac),
37// this will additionally exit the application if all browsers are
38// successfully closed.
thakis6ae1c3d2016-06-16 23:40:5539// Note that the exit process may be interrupted by download or
[email protected]2e6389f2012-05-18 19:41:2540// unload handler, and the browser may or may not exit.
41void AttemptExit();
42
43#if defined(OS_CHROMEOS)
[email protected]7df2c032014-01-22 10:42:0144// Shutdown chrome cleanly without blocking. This is called
45// when SIGTERM is received on Chrome OS, and always sets
46// exit-cleanly bit and exits the browser, even if there is
47// ongoing downloads or a page with onbeforeunload handler.
48//
49// If you need to exit or restart in your code on ChromeOS,
50// use AttemptExit or AttemptRestart respectively.
[email protected]2e6389f2012-05-18 19:41:2551void ExitCleanly();
thestigea81c77b52017-04-17 23:19:1152
53// Returns true if any of the above Attempt calls have been called.
54bool IsAttemptingShutdown();
[email protected]2e6389f2012-05-18 19:41:2555#endif
56
tzika2f1ff92016-02-10 22:59:5457#if !defined(OS_ANDROID)
[email protected]0c95faf42013-10-28 06:27:2058// Closes all browsers and if successful, quits.
59void CloseAllBrowsersAndQuit();
60
[email protected]2e6389f2012-05-18 19:41:2561// Closes all browsers. If the session is ending the windows are closed
62// directly. Otherwise the windows are closed by way of posting a WM_CLOSE
[email protected]0c95faf42013-10-28 06:27:2063// message. This will quit the application if there is nothing other than
64// browser windows keeping it alive or the application is quitting.
[email protected]2e6389f2012-05-18 19:41:2565void CloseAllBrowsers();
66
dgn02377782016-03-12 00:58:3867// If there are no browsers open and we aren't already shutting down,
dgnfe075c82016-03-18 11:25:3568// initiate a shutdown.
69void ShutdownIfNeeded();
dgn02377782016-03-12 00:58:3870
[email protected]2e6389f2012-05-18 19:41:2571// Begins shutdown of the application when the desktop session is ending.
72void SessionEnding();
73
[email protected]2e6389f2012-05-18 19:41:2574// Called once the application is exiting.
75void OnAppExiting();
76
77// Called once the application is exiting to do any platform specific
78// processing required.
79void HandleAppExitingForPlatform();
tzika2f1ff92016-02-10 22:59:5480#endif // !defined(OS_ANDROID)
skyostil0becb332015-04-27 17:59:3781
[email protected]313fce12013-01-30 17:09:0482} // namespace chrome
[email protected]2e6389f2012-05-18 19:41:2583
84#endif // CHROME_BROWSER_LIFETIME_APPLICATION_LIFETIME_H_