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 20 matching lines...) Expand all Loading... |
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 | 37 |
38 // Copied from google_chrome_distribution.cc. | 38 // Copied from google_chrome_distribution.cc. |
39 const wchar_t kBrowserAppGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; | 39 const wchar_t kBrowserAppGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; |
40 | 40 |
| 41 // Copied frome google_chrome_sxs_distribution.cc. |
| 42 const wchar_t kSxSBrowserAppGuid[] = L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}"; |
| 43 |
41 // Copied from util_constants.cc. | 44 // Copied from util_constants.cc. |
42 const wchar_t kChromeAppHostExe[] = L"app_host.exe"; | 45 const wchar_t kChromeAppHostExe[] = L"app_host.exe"; |
43 const char kChromeAppLauncher[] = "app-launcher"; | 46 const char kChromeAppLauncher[] = "app-launcher"; |
44 const wchar_t kChromeExe[] = L"chrome.exe"; | 47 const wchar_t kChromeExe[] = L"chrome.exe"; |
45 const wchar_t kUninstallArgumentsField[] = L"UninstallArguments"; | 48 const wchar_t kUninstallArgumentsField[] = L"UninstallArguments"; |
46 const wchar_t kUninstallStringField[] = L"UninstallString"; | 49 const wchar_t kUninstallStringField[] = L"UninstallString"; |
47 | 50 |
48 // Reads a string value from the specified product's "ClientState" registry key. | 51 // Reads a string value from the specified product's "ClientState" registry key. |
49 // Returns true iff the value is present and successfully read. | 52 // Returns true iff the value is present and successfully read. |
50 bool GetClientStateValue(InstallationLevel level, | 53 bool GetClientStateValue(InstallationLevel level, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 base::FilePath GetChromePathForInstallationLevel(InstallationLevel level) { | 166 base::FilePath GetChromePathForInstallationLevel(InstallationLevel level) { |
164 return FindExeRelativeToSetupExe( | 167 return FindExeRelativeToSetupExe( |
165 GetSetupExeForInstallationLevel(level), kChromeExe); | 168 GetSetupExeForInstallationLevel(level), kChromeExe); |
166 } | 169 } |
167 | 170 |
168 base::FilePath GetAppHostPathForInstallationLevel(InstallationLevel level) { | 171 base::FilePath GetAppHostPathForInstallationLevel(InstallationLevel level) { |
169 return FindExeRelativeToSetupExe( | 172 return FindExeRelativeToSetupExe( |
170 GetSetupExeFromRegistry(level, kAppHostAppId), kChromeAppHostExe); | 173 GetSetupExeFromRegistry(level, kAppHostAppId), kChromeAppHostExe); |
171 } | 174 } |
172 | 175 |
| 176 base::FilePath GetChromeSxSPathForInstallationLevel(InstallationLevel level) { |
| 177 return FindExeRelativeToSetupExe( |
| 178 GetSetupExeFromRegistry(level, kSxSBrowserAppGuid), kChromeExe); |
| 179 } |
| 180 |
173 base::FilePath GetAnyChromePath() { | 181 base::FilePath GetAnyChromePath() { |
174 base::FilePath chrome_path; | 182 base::FilePath chrome_path; |
175 if (chrome_path.empty()) | 183 if (chrome_path.empty()) |
176 chrome_path = GetChromePathForInstallationLevel(SYSTEM_LEVEL_INSTALLATION); | 184 chrome_path = GetChromePathForInstallationLevel(SYSTEM_LEVEL_INSTALLATION); |
177 if (chrome_path.empty()) | 185 if (chrome_path.empty()) |
178 chrome_path = GetChromePathForInstallationLevel(USER_LEVEL_INSTALLATION); | 186 chrome_path = GetChromePathForInstallationLevel(USER_LEVEL_INSTALLATION); |
179 return chrome_path; | 187 return chrome_path; |
180 } | 188 } |
181 | 189 |
182 base::FilePath GetAnyAppHostPath() { | 190 base::FilePath GetAnyAppHostPath() { |
183 base::FilePath app_host_path; | 191 base::FilePath app_host_path; |
184 if (app_host_path.empty()) { | 192 if (app_host_path.empty()) { |
185 app_host_path = GetAppHostPathForInstallationLevel( | 193 app_host_path = GetAppHostPathForInstallationLevel( |
186 SYSTEM_LEVEL_INSTALLATION); | 194 SYSTEM_LEVEL_INSTALLATION); |
187 } | 195 } |
188 if (app_host_path.empty()) | 196 if (app_host_path.empty()) |
189 app_host_path = GetAppHostPathForInstallationLevel(USER_LEVEL_INSTALLATION); | 197 app_host_path = GetAppHostPathForInstallationLevel(USER_LEVEL_INSTALLATION); |
190 return app_host_path; | 198 return app_host_path; |
191 } | 199 } |
192 | 200 |
| 201 base::FilePath GetAnyChromeSxSPath() { |
| 202 base::FilePath path = |
| 203 GetChromeSxSPathForInstallationLevel(USER_LEVEL_INSTALLATION); |
| 204 if (path.empty()) |
| 205 path = GetChromeSxSPathForInstallationLevel(SYSTEM_LEVEL_INSTALLATION); |
| 206 return path; |
| 207 } |
| 208 |
193 bool IsAppHostPresent() { | 209 bool IsAppHostPresent() { |
194 base::FilePath app_host_exe = GetAnyAppHostPath(); | 210 base::FilePath app_host_exe = GetAnyAppHostPath(); |
195 return !app_host_exe.empty(); | 211 return !app_host_exe.empty(); |
196 } | 212 } |
197 | 213 |
198 InstallationState GetAppLauncherInstallationState() { | 214 InstallationState GetAppLauncherInstallationState() { |
199 if (IsAppLauncherEnabledAtLevel(SYSTEM_LEVEL_INSTALLATION)) | 215 if (IsAppLauncherEnabledAtLevel(SYSTEM_LEVEL_INSTALLATION)) |
200 return INSTALLED_AT_SYSTEM_LEVEL; | 216 return INSTALLED_AT_SYSTEM_LEVEL; |
201 | 217 |
202 if (IsAppLauncherEnabledAtLevel(USER_LEVEL_INSTALLATION)) | 218 if (IsAppLauncherEnabledAtLevel(USER_LEVEL_INSTALLATION)) |
203 return INSTALLED_AT_USER_LEVEL; | 219 return INSTALLED_AT_USER_LEVEL; |
204 | 220 |
205 return NOT_INSTALLED; | 221 return NOT_INSTALLED; |
206 } | 222 } |
207 | 223 |
208 bool IsAppLauncherPresent() { | 224 bool IsAppLauncherPresent() { |
209 return GetAppLauncherInstallationState() != NOT_INSTALLED; | 225 return GetAppLauncherInstallationState() != NOT_INSTALLED; |
210 } | 226 } |
211 | 227 |
212 bool IsChromeBrowserPresent() { | 228 bool IsChromeBrowserPresent() { |
213 return IsProductInstalled(USER_LEVEL_INSTALLATION, kBrowserAppGuid) || | 229 return IsProductInstalled(USER_LEVEL_INSTALLATION, kBrowserAppGuid) || |
214 IsProductInstalled(SYSTEM_LEVEL_INSTALLATION, kBrowserAppGuid); | 230 IsProductInstalled(SYSTEM_LEVEL_INSTALLATION, kBrowserAppGuid); |
215 } | 231 } |
216 | 232 |
217 } // namespace chrome_launcher_support | 233 } // namespace chrome_launcher_support |
OLD | NEW |