OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_H_ | 5 #ifndef CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_H_ |
6 #define CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_H_ | 6 #define CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
11 #include <string> | 11 #include <string> |
12 #endif | 12 #endif |
13 | 13 |
14 #if !defined(OS_CHROMEOS) | 14 #if !defined(OS_CHROMEOS) |
15 | 15 |
| 16 namespace base { |
16 class CommandLine; | 17 class CommandLine; |
| 18 } |
17 | 19 |
18 namespace upgrade_util { | 20 namespace upgrade_util { |
19 | 21 |
20 // Launches Chrome again simulating a "user" launch. If Chrome could not be | 22 // Launches Chrome again simulating a "user" launch. If Chrome could not be |
21 // launched, returns false. | 23 // launched, returns false. |
22 bool RelaunchChromeBrowser(const CommandLine& command_line); | 24 bool RelaunchChromeBrowser(const base::CommandLine& command_line); |
23 | 25 |
24 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
25 | 27 |
26 extern const char kRelaunchModeMetro[]; | 28 extern const char kRelaunchModeMetro[]; |
27 extern const char kRelaunchModeDesktop[]; | 29 extern const char kRelaunchModeDesktop[]; |
28 extern const char kRelaunchModeDefault[]; | 30 extern const char kRelaunchModeDefault[]; |
29 | 31 |
30 enum RelaunchMode { | 32 enum RelaunchMode { |
31 RELAUNCH_MODE_METRO = 0, | 33 RELAUNCH_MODE_METRO = 0, |
32 RELAUNCH_MODE_DESKTOP = 1, | 34 RELAUNCH_MODE_DESKTOP = 1, |
33 // Default mode indicates caller is not sure which mode to launch. | 35 // Default mode indicates caller is not sure which mode to launch. |
34 RELAUNCH_MODE_DEFAULT = 2, | 36 RELAUNCH_MODE_DEFAULT = 2, |
35 }; | 37 }; |
36 | 38 |
37 std::string RelaunchModeEnumToString(const RelaunchMode& relaunch_mode); | 39 std::string RelaunchModeEnumToString(const RelaunchMode& relaunch_mode); |
38 | 40 |
39 RelaunchMode RelaunchModeStringToEnum(const std::string& relaunch_mode); | 41 RelaunchMode RelaunchModeStringToEnum(const std::string& relaunch_mode); |
40 | 42 |
41 // Like RelaunchChromeBrowser() but for Windows 8 it will read pref and restart | 43 // Like RelaunchChromeBrowser() but for Windows 8 it will read pref and restart |
42 // chrome accordingly in desktop or metro mode. | 44 // chrome accordingly in desktop or metro mode. |
43 bool RelaunchChromeWithMode(const CommandLine& command_line, | 45 bool RelaunchChromeWithMode(const base::CommandLine& command_line, |
44 const RelaunchMode& relaunch_mode); | 46 const RelaunchMode& relaunch_mode); |
45 | 47 |
46 #endif | 48 #endif |
47 | 49 |
48 #if !defined(OS_MACOSX) | 50 #if !defined(OS_MACOSX) |
49 | 51 |
50 void SetNewCommandLine(CommandLine* new_command_line); | 52 void SetNewCommandLine(base::CommandLine* new_command_line); |
51 | 53 |
52 // Launches a new instance of the browser if the current instance in persistent | 54 // Launches a new instance of the browser if the current instance in persistent |
53 // mode an upgrade is detected. | 55 // mode an upgrade is detected. |
54 void RelaunchChromeBrowserWithNewCommandLineIfNeeded(); | 56 void RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
55 | 57 |
56 // Windows: | 58 // Windows: |
57 // Checks if chrome_new.exe is present in the current instance's install. | 59 // Checks if chrome_new.exe is present in the current instance's install. |
58 // Linux: | 60 // Linux: |
59 // Checks if the last modified time of chrome is newer than that of the current | 61 // Checks if the last modified time of chrome is newer than that of the current |
60 // running instance. | 62 // running instance. |
61 bool IsUpdatePendingRestart(); | 63 bool IsUpdatePendingRestart(); |
62 | 64 |
63 #endif // !defined(OS_MACOSX) | 65 #endif // !defined(OS_MACOSX) |
64 | 66 |
65 } // namespace upgrade_util | 67 } // namespace upgrade_util |
66 | 68 |
67 #endif // !defined(OS_CHROMEOS) | 69 #endif // !defined(OS_CHROMEOS) |
68 | 70 |
69 #endif // CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_H_ | 71 #endif // CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_H_ |
OLD | NEW |