OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // 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 | 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 #include "chrome/installer/launcher_support/chrome_launcher_support.h" | 5 #include "chrome/installer/launcher_support/chrome_launcher_support.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <tchar.h> | 8 #include <tchar.h> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 16 matching lines...) Expand all Loading... | |
27 const wchar_t kGoogleRegClientStateKey[] = | 27 const wchar_t kGoogleRegClientStateKey[] = |
28 L"Software\\Google\\Update\\ClientState"; | 28 L"Software\\Google\\Update\\ClientState"; |
29 const wchar_t kGoogleRegClientsKey[] = L"Software\\Google\\Update\\Clients"; | 29 const wchar_t kGoogleRegClientsKey[] = L"Software\\Google\\Update\\Clients"; |
30 const wchar_t kRegVersionField[] = L"pv"; | 30 const wchar_t kRegVersionField[] = L"pv"; |
31 | 31 |
32 // Copied from binaries_installer_internal.cc | 32 // Copied from binaries_installer_internal.cc |
33 const wchar_t kAppHostAppId[] = L"{FDA71E6F-AC4C-4a00-8B70-9958A68906BF}"; | 33 const wchar_t kAppHostAppId[] = L"{FDA71E6F-AC4C-4a00-8B70-9958A68906BF}"; |
34 | 34 |
35 // Copied from chrome_appid.cc. | 35 // Copied from chrome_appid.cc. |
36 const wchar_t kBinariesAppGuid[] = L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}"; | 36 const wchar_t kBinariesAppGuid[] = L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}"; |
37 const wchar_t kSxSBrowserAppGuid[] = L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}"; | |
37 | 38 |
38 // Copied from google_chrome_distribution.cc. | 39 // Copied from google_chrome_distribution.cc. |
39 const wchar_t kBrowserAppGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; | 40 const wchar_t kBrowserAppGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; |
40 | 41 |
41 // Copied from util_constants.cc. | 42 // Copied from util_constants.cc. |
42 const wchar_t kChromeAppHostExe[] = L"app_host.exe"; | 43 const wchar_t kChromeAppHostExe[] = L"app_host.exe"; |
43 const char kChromeAppLauncher[] = "app-launcher"; | 44 const char kChromeAppLauncher[] = "app-launcher"; |
44 const wchar_t kChromeExe[] = L"chrome.exe"; | 45 const wchar_t kChromeExe[] = L"chrome.exe"; |
46 const char kChromeSxS[] = "chrome-sxs"; | |
45 const wchar_t kUninstallArgumentsField[] = L"UninstallArguments"; | 47 const wchar_t kUninstallArgumentsField[] = L"UninstallArguments"; |
46 const wchar_t kUninstallStringField[] = L"UninstallString"; | 48 const wchar_t kUninstallStringField[] = L"UninstallString"; |
47 | 49 |
48 // Reads a string value from the specified product's "ClientState" registry key. | 50 // Reads a string value from the specified product's "ClientState" registry key. |
49 // Returns true iff the value is present and successfully read. | 51 // Returns true iff the value is present and successfully read. |
50 bool GetClientStateValue(InstallationLevel level, | 52 bool GetClientStateValue(InstallationLevel level, |
51 const wchar_t* app_guid, | 53 const wchar_t* app_guid, |
52 const wchar_t* value_name, | 54 const wchar_t* value_name, |
53 base::string16* value) { | 55 base::string16* value) { |
54 HKEY root_key = (level == USER_LEVEL_INSTALLATION) ? | 56 HKEY root_key = (level == USER_LEVEL_INSTALLATION) ? |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 CommandLine uninstall_cmd = CommandLine::FromString( | 145 CommandLine uninstall_cmd = CommandLine::FromString( |
144 L"\"" + setup_exe.value() + L"\" " + uninstall_arguments); | 146 L"\"" + setup_exe.value() + L"\" " + uninstall_arguments); |
145 | 147 |
146 VLOG(1) << "Uninstalling legacy app launcher with command line: " | 148 VLOG(1) << "Uninstalling legacy app launcher with command line: " |
147 << uninstall_cmd.GetCommandLineString(); | 149 << uninstall_cmd.GetCommandLineString(); |
148 base::LaunchProcess(uninstall_cmd, base::LaunchOptions(), NULL); | 150 base::LaunchProcess(uninstall_cmd, base::LaunchOptions(), NULL); |
149 } | 151 } |
150 } | 152 } |
151 | 153 |
152 base::FilePath GetSetupExeForInstallationLevel(InstallationLevel level) { | 154 base::FilePath GetSetupExeForInstallationLevel(InstallationLevel level) { |
155 if (CommandLine::ForCurrentProcess()->HasSwitch(kChromeSxS)) | |
grt (UTC plus 2)
2014/03/17 21:26:51
from what context do you expect to call this? do c
| |
156 return GetSetupExeFromRegistry(level, kSxSBrowserAppGuid); | |
157 | |
153 // Look in the registry for Chrome Binaries first. | 158 // Look in the registry for Chrome Binaries first. |
154 base::FilePath setup_exe_path( | 159 base::FilePath setup_exe_path( |
155 GetSetupExeFromRegistry(level, kBinariesAppGuid)); | 160 GetSetupExeFromRegistry(level, kBinariesAppGuid)); |
156 // If the above fails, look in the registry for Chrome next. | 161 // If the above fails, look in the registry for Chrome next. |
157 if (setup_exe_path.empty()) | 162 if (setup_exe_path.empty()) |
158 setup_exe_path = GetSetupExeFromRegistry(level, kBrowserAppGuid); | 163 setup_exe_path = GetSetupExeFromRegistry(level, kBrowserAppGuid); |
159 // If we fail again, then setup_exe_path would be empty. | 164 // If we fail again, then setup_exe_path would be empty. |
160 return setup_exe_path; | 165 return setup_exe_path; |
161 } | 166 } |
162 | 167 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
208 bool IsAppLauncherPresent() { | 213 bool IsAppLauncherPresent() { |
209 return GetAppLauncherInstallationState() != NOT_INSTALLED; | 214 return GetAppLauncherInstallationState() != NOT_INSTALLED; |
210 } | 215 } |
211 | 216 |
212 bool IsChromeBrowserPresent() { | 217 bool IsChromeBrowserPresent() { |
213 return IsProductInstalled(USER_LEVEL_INSTALLATION, kBrowserAppGuid) || | 218 return IsProductInstalled(USER_LEVEL_INSTALLATION, kBrowserAppGuid) || |
214 IsProductInstalled(SYSTEM_LEVEL_INSTALLATION, kBrowserAppGuid); | 219 IsProductInstalled(SYSTEM_LEVEL_INSTALLATION, kBrowserAppGuid); |
215 } | 220 } |
216 | 221 |
217 } // namespace chrome_launcher_support | 222 } // namespace chrome_launcher_support |
OLD | NEW |