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 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "base/win/registry.h" | 12 #include "base/win/registry.h" |
13 | 13 |
14 namespace chrome_launcher_support { | 14 namespace chrome_launcher_support { |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 // TODO(huangs) Refactor the constants: http://crbug.com/148538 | 18 // TODO(huangs) Refactor the constants: http://crbug.com/148538 |
19 const wchar_t kGoogleRegClientStateKey[] = | 19 const wchar_t kGoogleRegClientStateKey[] = |
20 L"Software\\Google\\Update\\ClientState"; | 20 L"Software\\Google\\Update\\ClientState"; |
21 | 21 |
22 // Copied from chrome_appid.cc. | 22 // Copied from chrome_appid.cc. |
23 const wchar_t kBinariesAppGuid[] = L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}"; | 23 const wchar_t kBinariesAppGuid[] = L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}"; |
24 | 24 |
25 // Copied from google_chrome_distribution.cc. | 25 // Copied from google_chrome_distribution.cc. |
26 const wchar_t kBrowserAppGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; | 26 const wchar_t kBrowserAppGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; |
27 | 27 |
| 28 // Copied frome google_chrome_sxs_distribution.cc. |
| 29 const wchar_t kSxSBrowserAppGuid[] = L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}"; |
| 30 |
28 // Copied from util_constants.cc. | 31 // Copied from util_constants.cc. |
29 const wchar_t kChromeExe[] = L"chrome.exe"; | 32 const wchar_t kChromeExe[] = L"chrome.exe"; |
30 const wchar_t kUninstallStringField[] = L"UninstallString"; | 33 const wchar_t kUninstallStringField[] = L"UninstallString"; |
31 | 34 |
32 // Reads a string value from the specified product's "ClientState" registry key. | 35 // Reads a string value from the specified product's "ClientState" registry key. |
33 // Returns true iff the value is present and successfully read. | 36 // Returns true iff the value is present and successfully read. |
34 bool GetClientStateValue(InstallationLevel level, | 37 bool GetClientStateValue(InstallationLevel level, |
35 const wchar_t* app_guid, | 38 const wchar_t* app_guid, |
36 const wchar_t* value_name, | 39 const wchar_t* value_name, |
37 base::string16* value) { | 40 base::string16* value) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 return base::FilePath(); | 102 return base::FilePath(); |
100 } | 103 } |
101 | 104 |
102 } // namespace | 105 } // namespace |
103 | 106 |
104 base::FilePath GetChromePathForInstallationLevel(InstallationLevel level) { | 107 base::FilePath GetChromePathForInstallationLevel(InstallationLevel level) { |
105 return FindExeRelativeToSetupExe( | 108 return FindExeRelativeToSetupExe( |
106 GetSetupExeForInstallationLevel(level), kChromeExe); | 109 GetSetupExeForInstallationLevel(level), kChromeExe); |
107 } | 110 } |
108 | 111 |
| 112 base::FilePath GetChromeSxSPathForInstallationLevel(InstallationLevel level) { |
| 113 return FindExeRelativeToSetupExe( |
| 114 GetSetupExeFromRegistry(level, kSxSBrowserAppGuid), kChromeExe); |
| 115 } |
| 116 |
109 base::FilePath GetAnyChromePath() { | 117 base::FilePath GetAnyChromePath() { |
110 base::FilePath chrome_path; | 118 base::FilePath chrome_path; |
111 if (chrome_path.empty()) | 119 if (chrome_path.empty()) |
112 chrome_path = GetChromePathForInstallationLevel(SYSTEM_LEVEL_INSTALLATION); | 120 chrome_path = GetChromePathForInstallationLevel(SYSTEM_LEVEL_INSTALLATION); |
113 if (chrome_path.empty()) | 121 if (chrome_path.empty()) |
114 chrome_path = GetChromePathForInstallationLevel(USER_LEVEL_INSTALLATION); | 122 chrome_path = GetChromePathForInstallationLevel(USER_LEVEL_INSTALLATION); |
115 return chrome_path; | 123 return chrome_path; |
116 } | 124 } |
117 | 125 |
| 126 base::FilePath GetAnyChromeSxSPath() { |
| 127 base::FilePath path = |
| 128 GetChromeSxSPathForInstallationLevel(USER_LEVEL_INSTALLATION); |
| 129 if (path.empty()) |
| 130 path = GetChromeSxSPathForInstallationLevel(SYSTEM_LEVEL_INSTALLATION); |
| 131 return path; |
| 132 } |
| 133 |
118 } // namespace chrome_launcher_support | 134 } // namespace chrome_launcher_support |
OLD | NEW |