blob: ac048523d810f7436da4a81fe3db15f31b7d512b [file] [log] [blame]
[email protected]815856722011-04-13 17:19:191// Copyright (c) 2011 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_FIRST_RUN_UPGRADE_UTIL_H_
6#define CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_H_
[email protected]815856722011-04-13 17:19:197
Greg Thompson87ee38f2019-08-09 06:00:238#include <memory>
9
10#include "base/callback_forward.h"
[email protected]d9fcd2632011-06-24 15:59:0211#include "build/build_config.h"
12
thestig6ad7fe512015-10-01 06:40:2713#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
14#error Not used on Android or ChromeOS
15#endif
16
[email protected]2f3b1cc2014-03-17 23:07:1517namespace base {
[email protected]815856722011-04-13 17:19:1918class CommandLine;
[email protected]2f3b1cc2014-03-17 23:07:1519}
[email protected]815856722011-04-13 17:19:1920
[email protected]815856722011-04-13 17:19:1921namespace upgrade_util {
22
[email protected]d9fcd2632011-06-24 15:59:0223// Launches Chrome again simulating a "user" launch. If Chrome could not be
24// launched, returns false.
[email protected]2f3b1cc2014-03-17 23:07:1525bool RelaunchChromeBrowser(const base::CommandLine& command_line);
[email protected]d9fcd2632011-06-24 15:59:0226
Avi Drissman2e458df2020-07-29 16:24:3127#if !defined(OS_MAC)
[email protected]d9fcd2632011-06-24 15:59:0228
Greg Thompson87ee38f2019-08-09 06:00:2329// Sets a command line to be used to relaunch the browser upon exit.
30void SetNewCommandLine(std::unique_ptr<base::CommandLine> new_command_line);
[email protected]815856722011-04-13 17:19:1931
Greg Thompson87ee38f2019-08-09 06:00:2332// Launches a new instance of the browser using a command line previously
33// provided to SetNewCommandLine. This is typically used to finalize an in-use
34// update that was detected while the browser was in persistent mode.
[email protected]815856722011-04-13 17:19:1935void RelaunchChromeBrowserWithNewCommandLineIfNeeded();
36
[email protected]815856722011-04-13 17:19:1937// Windows:
38// Checks if chrome_new.exe is present in the current instance's install.
39// Linux:
40// Checks if the last modified time of chrome is newer than that of the current
41// running instance.
42bool IsUpdatePendingRestart();
43
Avi Drissman2e458df2020-07-29 16:24:3144#endif // !defined(OS_MAC)
[email protected]d9fcd2632011-06-24 15:59:0245
Greg Thompson87ee38f2019-08-09 06:00:2346using RelaunchChromeBrowserCallback =
47 base::RepeatingCallback<bool(const base::CommandLine&)>;
48
49// Sets |callback| to be run to process a RelaunchChromeBrowser request. This
50// is a test seam for whole-browser tests. See
51// ScopedRelaunchChromeBrowserOverride for convenience.
52RelaunchChromeBrowserCallback SetRelaunchChromeBrowserCallbackForTesting(
53 RelaunchChromeBrowserCallback callback);
54
[email protected]815856722011-04-13 17:19:1955} // namespace upgrade_util
56
[email protected]815856722011-04-13 17:19:1957#endif // CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_H_