[email protected] | 81585672 | 2011-04-13 17:19:19 | [diff] [blame] | 1 | // 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] | 81585672 | 2011-04-13 17:19:19 | [diff] [blame] | 7 | |
Greg Thompson | 87ee38f | 2019-08-09 06:00:23 | [diff] [blame] | 8 | #include <memory> |
9 | |||||
10 | #include "base/callback_forward.h" | ||||
[email protected] | d9fcd263 | 2011-06-24 15:59:02 | [diff] [blame] | 11 | #include "build/build_config.h" |
12 | |||||
thestig | 6ad7fe51 | 2015-10-01 06:40:27 | [diff] [blame] | 13 | #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
14 | #error Not used on Android or ChromeOS | ||||
15 | #endif | ||||
16 | |||||
[email protected] | 2f3b1cc | 2014-03-17 23:07:15 | [diff] [blame] | 17 | namespace base { |
[email protected] | 81585672 | 2011-04-13 17:19:19 | [diff] [blame] | 18 | class CommandLine; |
[email protected] | 2f3b1cc | 2014-03-17 23:07:15 | [diff] [blame] | 19 | } |
[email protected] | 81585672 | 2011-04-13 17:19:19 | [diff] [blame] | 20 | |
[email protected] | 81585672 | 2011-04-13 17:19:19 | [diff] [blame] | 21 | namespace upgrade_util { |
22 | |||||
[email protected] | d9fcd263 | 2011-06-24 15:59:02 | [diff] [blame] | 23 | // Launches Chrome again simulating a "user" launch. If Chrome could not be |
24 | // launched, returns false. | ||||
[email protected] | 2f3b1cc | 2014-03-17 23:07:15 | [diff] [blame] | 25 | bool RelaunchChromeBrowser(const base::CommandLine& command_line); |
[email protected] | d9fcd263 | 2011-06-24 15:59:02 | [diff] [blame] | 26 | |
Avi Drissman | 2e458df | 2020-07-29 16:24:31 | [diff] [blame] | 27 | #if !defined(OS_MAC) |
[email protected] | d9fcd263 | 2011-06-24 15:59:02 | [diff] [blame] | 28 | |
Greg Thompson | 87ee38f | 2019-08-09 06:00:23 | [diff] [blame] | 29 | // Sets a command line to be used to relaunch the browser upon exit. |
30 | void SetNewCommandLine(std::unique_ptr<base::CommandLine> new_command_line); | ||||
[email protected] | 81585672 | 2011-04-13 17:19:19 | [diff] [blame] | 31 | |
Greg Thompson | 87ee38f | 2019-08-09 06:00:23 | [diff] [blame] | 32 | // 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] | 81585672 | 2011-04-13 17:19:19 | [diff] [blame] | 35 | void RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
36 | |||||
[email protected] | 81585672 | 2011-04-13 17:19:19 | [diff] [blame] | 37 | // 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. | ||||
42 | bool IsUpdatePendingRestart(); | ||||
43 | |||||
Avi Drissman | 2e458df | 2020-07-29 16:24:31 | [diff] [blame] | 44 | #endif // !defined(OS_MAC) |
[email protected] | d9fcd263 | 2011-06-24 15:59:02 | [diff] [blame] | 45 | |
Greg Thompson | 87ee38f | 2019-08-09 06:00:23 | [diff] [blame] | 46 | using 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. | ||||
52 | RelaunchChromeBrowserCallback SetRelaunchChromeBrowserCallbackForTesting( | ||||
53 | RelaunchChromeBrowserCallback callback); | ||||
54 | |||||
[email protected] | 81585672 | 2011-04-13 17:19:19 | [diff] [blame] | 55 | } // namespace upgrade_util |
56 | |||||
[email protected] | 81585672 | 2011-04-13 17:19:19 | [diff] [blame] | 57 | #endif // CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_H_ |