blob: 55bf2f8104f39d66f0d6dc9b169bd4ab20e3d4a2 [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
[email protected]2e6389f2012-05-18 19:41:2522// 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.
39// Note that he exit process may be interrupted by download or
40// 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();
52#endif
53
tzika2f1ff92016-02-10 22:59:5454#if !defined(OS_ANDROID)
[email protected]0c95faf42013-10-28 06:27:2055// Closes all browsers and if successful, quits.
56void CloseAllBrowsersAndQuit();
57
[email protected]2e6389f2012-05-18 19:41:2558// Closes all browsers. If the session is ending the windows are closed
59// directly. Otherwise the windows are closed by way of posting a WM_CLOSE
[email protected]0c95faf42013-10-28 06:27:2060// message. This will quit the application if there is nothing other than
61// browser windows keeping it alive or the application is quitting.
[email protected]2e6389f2012-05-18 19:41:2562void CloseAllBrowsers();
63
dgn02377782016-03-12 00:58:3864// If there are no browsers open and we aren't already shutting down,
dgnfe075c82016-03-18 11:25:3565// initiate a shutdown.
66void ShutdownIfNeeded();
dgn02377782016-03-12 00:58:3867
[email protected]2e6389f2012-05-18 19:41:2568// Begins shutdown of the application when the desktop session is ending.
69void SessionEnding();
70
tzika2f1ff92016-02-10 22:59:5471#endif // !defined(OS_ANDROID)
[email protected]2e6389f2012-05-18 19:41:2572
73// Emits APP_TERMINATING notification. It is guaranteed that the
74// notification is sent only once.
75void NotifyAppTerminating();
76
77// Send out notifications.
78// For ChromeOS, also request session manager to end the session.
79void NotifyAndTerminate(bool fast_path);
80
tzika2f1ff92016-02-10 22:59:5481#if !defined(OS_ANDROID)
[email protected]2e6389f2012-05-18 19:41:2582// Called once the application is exiting.
83void OnAppExiting();
84
85// Called once the application is exiting to do any platform specific
86// processing required.
87void HandleAppExitingForPlatform();
tzika2f1ff92016-02-10 22:59:5488#endif // !defined(OS_ANDROID)
skyostil0becb332015-04-27 17:59:3789
[email protected]313fce12013-01-30 17:09:0490} // namespace chrome
[email protected]2e6389f2012-05-18 19:41:2591
92#endif // CHROME_BROWSER_LIFETIME_APPLICATION_LIFETIME_H_