Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1464)

Side by Side Diff: chrome/installer/launcher_support/chrome_launcher_support.cc

Issue 200713003: Add GetAnyChromeSxSPath. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add GetAnyChromeSxSPath instead of checking command line. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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}";
grt (UTC plus 2) 2014/03/18 13:51:06 nit: document this as "Coped from google_chrome_sx
jackhou1 2014/03/18 23:39:10 Done.
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";
45 const wchar_t kUninstallArgumentsField[] = L"UninstallArguments"; 46 const wchar_t kUninstallArgumentsField[] = L"UninstallArguments";
46 const wchar_t kUninstallStringField[] = L"UninstallString"; 47 const wchar_t kUninstallStringField[] = L"UninstallString";
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 base::FilePath GetChromePathForInstallationLevel(InstallationLevel level) { 164 base::FilePath GetChromePathForInstallationLevel(InstallationLevel level) {
164 return FindExeRelativeToSetupExe( 165 return FindExeRelativeToSetupExe(
165 GetSetupExeForInstallationLevel(level), kChromeExe); 166 GetSetupExeForInstallationLevel(level), kChromeExe);
166 } 167 }
167 168
168 base::FilePath GetAppHostPathForInstallationLevel(InstallationLevel level) { 169 base::FilePath GetAppHostPathForInstallationLevel(InstallationLevel level) {
169 return FindExeRelativeToSetupExe( 170 return FindExeRelativeToSetupExe(
170 GetSetupExeFromRegistry(level, kAppHostAppId), kChromeAppHostExe); 171 GetSetupExeFromRegistry(level, kAppHostAppId), kChromeAppHostExe);
171 } 172 }
172 173
174 base::FilePath GetChromeSxSPathForInstallationLevel(InstallationLevel level) {
175 return FindExeRelativeToSetupExe(
176 GetSetupExeFromRegistry(level, kSxSBrowserAppGuid), kChromeExe);
177 }
178
173 base::FilePath GetAnyChromePath() { 179 base::FilePath GetAnyChromePath() {
174 base::FilePath chrome_path; 180 base::FilePath chrome_path;
175 if (chrome_path.empty()) 181 if (chrome_path.empty())
176 chrome_path = GetChromePathForInstallationLevel(SYSTEM_LEVEL_INSTALLATION); 182 chrome_path = GetChromePathForInstallationLevel(SYSTEM_LEVEL_INSTALLATION);
177 if (chrome_path.empty()) 183 if (chrome_path.empty())
178 chrome_path = GetChromePathForInstallationLevel(USER_LEVEL_INSTALLATION); 184 chrome_path = GetChromePathForInstallationLevel(USER_LEVEL_INSTALLATION);
179 return chrome_path; 185 return chrome_path;
180 } 186 }
181 187
182 base::FilePath GetAnyAppHostPath() { 188 base::FilePath GetAnyAppHostPath() {
183 base::FilePath app_host_path; 189 base::FilePath app_host_path;
184 if (app_host_path.empty()) { 190 if (app_host_path.empty()) {
185 app_host_path = GetAppHostPathForInstallationLevel( 191 app_host_path = GetAppHostPathForInstallationLevel(
186 SYSTEM_LEVEL_INSTALLATION); 192 SYSTEM_LEVEL_INSTALLATION);
187 } 193 }
188 if (app_host_path.empty()) 194 if (app_host_path.empty())
189 app_host_path = GetAppHostPathForInstallationLevel(USER_LEVEL_INSTALLATION); 195 app_host_path = GetAppHostPathForInstallationLevel(USER_LEVEL_INSTALLATION);
190 return app_host_path; 196 return app_host_path;
191 } 197 }
192 198
199 base::FilePath GetAnyChromeSxSPath() {
200 base::FilePath path;
201 if (path.empty())
202 path = GetChromeSxSPathForInstallationLevel(SYSTEM_LEVEL_INSTALLATION);
203 if (path.empty())
204 path = GetChromeSxSPathForInstallationLevel(USER_LEVEL_INSTALLATION);
205 return path;
206 }
207
193 bool IsAppHostPresent() { 208 bool IsAppHostPresent() {
194 base::FilePath app_host_exe = GetAnyAppHostPath(); 209 base::FilePath app_host_exe = GetAnyAppHostPath();
195 return !app_host_exe.empty(); 210 return !app_host_exe.empty();
196 } 211 }
197 212
198 InstallationState GetAppLauncherInstallationState() { 213 InstallationState GetAppLauncherInstallationState() {
199 if (IsAppLauncherEnabledAtLevel(SYSTEM_LEVEL_INSTALLATION)) 214 if (IsAppLauncherEnabledAtLevel(SYSTEM_LEVEL_INSTALLATION))
200 return INSTALLED_AT_SYSTEM_LEVEL; 215 return INSTALLED_AT_SYSTEM_LEVEL;
201 216
202 if (IsAppLauncherEnabledAtLevel(USER_LEVEL_INSTALLATION)) 217 if (IsAppLauncherEnabledAtLevel(USER_LEVEL_INSTALLATION))
203 return INSTALLED_AT_USER_LEVEL; 218 return INSTALLED_AT_USER_LEVEL;
204 219
205 return NOT_INSTALLED; 220 return NOT_INSTALLED;
206 } 221 }
207 222
208 bool IsAppLauncherPresent() { 223 bool IsAppLauncherPresent() {
209 return GetAppLauncherInstallationState() != NOT_INSTALLED; 224 return GetAppLauncherInstallationState() != NOT_INSTALLED;
210 } 225 }
211 226
212 bool IsChromeBrowserPresent() { 227 bool IsChromeBrowserPresent() {
213 return IsProductInstalled(USER_LEVEL_INSTALLATION, kBrowserAppGuid) || 228 return IsProductInstalled(USER_LEVEL_INSTALLATION, kBrowserAppGuid) ||
214 IsProductInstalled(SYSTEM_LEVEL_INSTALLATION, kBrowserAppGuid); 229 IsProductInstalled(SYSTEM_LEVEL_INSTALLATION, kBrowserAppGuid);
215 } 230 }
216 231
217 } // namespace chrome_launcher_support 232 } // namespace chrome_launcher_support
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698