blob: 700b2b449306e3248c2fe9361d4f5e84282588ef [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
[email protected]d9fcd2632011-06-24 15:59:028#include "build/build_config.h"
9
[email protected]d51373d2013-10-31 15:22:0010#if defined(OS_WIN)
11#include <string>
12#endif
13
[email protected]d9fcd2632011-06-24 15:59:0214#if !defined(OS_CHROMEOS)
15
[email protected]2f3b1cc2014-03-17 23:07:1516namespace base {
[email protected]815856722011-04-13 17:19:1917class CommandLine;
[email protected]2f3b1cc2014-03-17 23:07:1518}
[email protected]815856722011-04-13 17:19:1919
[email protected]815856722011-04-13 17:19:1920namespace upgrade_util {
21
[email protected]d9fcd2632011-06-24 15:59:0222// Launches Chrome again simulating a "user" launch. If Chrome could not be
23// launched, returns false.
[email protected]2f3b1cc2014-03-17 23:07:1524bool RelaunchChromeBrowser(const base::CommandLine& command_line);
[email protected]d9fcd2632011-06-24 15:59:0225
[email protected]770c6d82012-09-06 22:21:3226#if defined(OS_WIN)
27
[email protected]d51373d2013-10-31 15:22:0028extern const char kRelaunchModeMetro[];
29extern const char kRelaunchModeDesktop[];
30extern const char kRelaunchModeDefault[];
31
32enum RelaunchMode {
33 RELAUNCH_MODE_METRO = 0,
34 RELAUNCH_MODE_DESKTOP = 1,
35 // Default mode indicates caller is not sure which mode to launch.
36 RELAUNCH_MODE_DEFAULT = 2,
37};
38
39std::string RelaunchModeEnumToString(const RelaunchMode& relaunch_mode);
40
41RelaunchMode RelaunchModeStringToEnum(const std::string& relaunch_mode);
42
43// Like RelaunchChromeBrowser() but for Windows 8 it will read pref and restart
44// chrome accordingly in desktop or metro mode.
[email protected]2f3b1cc2014-03-17 23:07:1545bool RelaunchChromeWithMode(const base::CommandLine& command_line,
[email protected]d51373d2013-10-31 15:22:0046 const RelaunchMode& relaunch_mode);
[email protected]770c6d82012-09-06 22:21:3247
48#endif
49
[email protected]d9fcd2632011-06-24 15:59:0250#if !defined(OS_MACOSX)
51
[email protected]2f3b1cc2014-03-17 23:07:1552void SetNewCommandLine(base::CommandLine* new_command_line);
[email protected]815856722011-04-13 17:19:1953
54// Launches a new instance of the browser if the current instance in persistent
55// mode an upgrade is detected.
56void RelaunchChromeBrowserWithNewCommandLineIfNeeded();
57
[email protected]815856722011-04-13 17:19:1958// Windows:
59// Checks if chrome_new.exe is present in the current instance's install.
60// Linux:
61// Checks if the last modified time of chrome is newer than that of the current
62// running instance.
63bool IsUpdatePendingRestart();
64
[email protected]d9fcd2632011-06-24 15:59:0265#endif // !defined(OS_MACOSX)
66
[email protected]815856722011-04-13 17:19:1967} // namespace upgrade_util
68
[email protected]d9fcd2632011-06-24 15:59:0269#endif // !defined(OS_CHROMEOS)
70
[email protected]815856722011-04-13 17:19:1971#endif // CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_H_