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 // This file defines specific implementation of BrowserDistribution class for | 5 // This file defines specific implementation of BrowserDistribution class for |
6 // Google Chrome. | 6 // Google Chrome. |
7 | 7 |
8 #include "chrome/installer/util/google_chrome_distribution.h" | 8 #include "chrome/installer/util/google_chrome_distribution.h" |
9 | 9 |
10 #include <windows.h> | 10 #include <windows.h> |
11 #include <msi.h> | 11 #include <msi.h> |
12 #include <shellapi.h> | 12 #include <shellapi.h> |
13 | 13 |
14 #include <utility> | 14 #include <utility> |
15 | 15 |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
18 #include "base/path_service.h" | 18 #include "base/path_service.h" |
19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
22 #include "base/win/registry.h" | 22 #include "base/win/registry.h" |
23 #include "base/win/windows_version.h" | 23 #include "base/win/windows_version.h" |
24 #include "chrome/common/chrome_icon_resources_win.h" | 24 #include "chrome/common/chrome_icon_resources_win.h" |
25 #include "chrome/common/chrome_paths_internal.h" | 25 #include "chrome/common/chrome_paths_internal.h" |
| 26 #include "chrome/install_static/install_util.h" |
26 #include "chrome/installer/util/app_registration_data.h" | 27 #include "chrome/installer/util/app_registration_data.h" |
27 #include "chrome/installer/util/channel_info.h" | 28 #include "chrome/installer/util/channel_info.h" |
28 #include "chrome/installer/util/google_update_constants.h" | 29 #include "chrome/installer/util/google_update_constants.h" |
29 #include "chrome/installer/util/google_update_settings.h" | 30 #include "chrome/installer/util/google_update_settings.h" |
30 #include "chrome/installer/util/install_util.h" | 31 #include "chrome/installer/util/install_util.h" |
31 #include "chrome/installer/util/installer_util_strings.h" | 32 #include "chrome/installer/util/installer_util_strings.h" |
32 #include "chrome/installer/util/l10n_string_util.h" | 33 #include "chrome/installer/util/l10n_string_util.h" |
33 #include "chrome/installer/util/uninstall_metrics.h" | 34 #include "chrome/installer/util/uninstall_metrics.h" |
34 #include "chrome/installer/util/updating_app_registration_data.h" | 35 #include "chrome/installer/util/updating_app_registration_data.h" |
35 #include "chrome/installer/util/util_constants.h" | 36 #include "chrome/installer/util/util_constants.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } | 141 } |
141 | 142 |
142 if (os_info->version() >= base::win::VERSION_WIN10 && | 143 if (os_info->version() >= base::win::VERSION_WIN10 && |
143 NavigateToUrlWithEdge(url)) { | 144 NavigateToUrlWithEdge(url)) { |
144 return; | 145 return; |
145 } | 146 } |
146 NavigateToUrlWithIExplore(url); | 147 NavigateToUrlWithIExplore(url); |
147 } | 148 } |
148 | 149 |
149 base::string16 GoogleChromeDistribution::GetActiveSetupGuid() { | 150 base::string16 GoogleChromeDistribution::GetActiveSetupGuid() { |
150 return GetAppGuid(); | 151 return install_static::GetAppGuid(); |
151 } | 152 } |
152 | 153 |
153 base::string16 GoogleChromeDistribution::GetBaseAppName() { | 154 base::string16 GoogleChromeDistribution::GetBaseAppName() { |
154 // I'd really like to return L ## PRODUCT_FULLNAME_STRING; but that's no good | 155 // I'd really like to return L ## PRODUCT_FULLNAME_STRING; but that's no good |
155 // since it'd be "Chromium" in a non-Chrome build, which isn't at all what I | 156 // since it'd be "Chromium" in a non-Chrome build, which isn't at all what I |
156 // want. Sigh. | 157 // want. Sigh. |
157 return L"Google Chrome"; | 158 return L"Google Chrome"; |
158 } | 159 } |
159 | 160 |
160 base::string16 GoogleChromeDistribution::GetShortcutName() { | 161 base::string16 GoogleChromeDistribution::GetShortcutName() { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 return app_description; | 197 return app_description; |
197 } | 198 } |
198 | 199 |
199 std::string GoogleChromeDistribution::GetSafeBrowsingName() { | 200 std::string GoogleChromeDistribution::GetSafeBrowsingName() { |
200 return "googlechrome"; | 201 return "googlechrome"; |
201 } | 202 } |
202 | 203 |
203 base::string16 GoogleChromeDistribution::GetDistributionData(HKEY root_key) { | 204 base::string16 GoogleChromeDistribution::GetDistributionData(HKEY root_key) { |
204 base::string16 sub_key(google_update::kRegPathClientState); | 205 base::string16 sub_key(google_update::kRegPathClientState); |
205 sub_key.append(L"\\"); | 206 sub_key.append(L"\\"); |
206 sub_key.append(GetAppGuid()); | 207 sub_key.append(install_static::GetAppGuid()); |
207 | 208 |
208 base::win::RegKey client_state_key( | 209 base::win::RegKey client_state_key( |
209 root_key, sub_key.c_str(), KEY_READ | KEY_WOW64_32KEY); | 210 root_key, sub_key.c_str(), KEY_READ | KEY_WOW64_32KEY); |
210 base::string16 result; | 211 base::string16 result; |
211 base::string16 brand_value; | 212 base::string16 brand_value; |
212 if (client_state_key.ReadValue(google_update::kRegRLZBrandField, | 213 if (client_state_key.ReadValue(google_update::kRegRLZBrandField, |
213 &brand_value) == ERROR_SUCCESS) { | 214 &brand_value) == ERROR_SUCCESS) { |
214 result = google_update::kRegRLZBrandField; | 215 result = google_update::kRegRLZBrandField; |
215 result.append(L"="); | 216 result.append(L"="); |
216 result.append(brand_value); | 217 result.append(brand_value); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 // full installer as fall back method in case incremental installer fails. | 274 // full installer as fall back method in case incremental installer fails. |
274 // - If incremental installer fails we append a magic string ("-full"), if | 275 // - If incremental installer fails we append a magic string ("-full"), if |
275 // it is not present already, so that Google Update server next time will send | 276 // it is not present already, so that Google Update server next time will send |
276 // full installer to update Chrome on the local machine | 277 // full installer to update Chrome on the local machine |
277 // - If we are currently running full installer, we remove this magic | 278 // - If we are currently running full installer, we remove this magic |
278 // string (if it is present) regardless of whether installer failed or not. | 279 // string (if it is present) regardless of whether installer failed or not. |
279 // There is no fall-back for full installer :) | 280 // There is no fall-back for full installer :) |
280 void GoogleChromeDistribution::UpdateInstallStatus(bool system_install, | 281 void GoogleChromeDistribution::UpdateInstallStatus(bool system_install, |
281 installer::ArchiveType archive_type, | 282 installer::ArchiveType archive_type, |
282 installer::InstallStatus install_status) { | 283 installer::InstallStatus install_status) { |
283 GoogleUpdateSettings::UpdateInstallStatus(system_install, | 284 GoogleUpdateSettings::UpdateInstallStatus( |
284 archive_type, InstallUtil::GetInstallReturnCode(install_status), | 285 system_install, archive_type, |
285 GetAppGuid()); | 286 InstallUtil::GetInstallReturnCode(install_status), |
| 287 install_static::GetAppGuid()); |
286 } | 288 } |
287 | 289 |
288 bool GoogleChromeDistribution::ShouldSetExperimentLabels() { | 290 bool GoogleChromeDistribution::ShouldSetExperimentLabels() { |
289 return true; | 291 return true; |
290 } | 292 } |
291 | 293 |
292 bool GoogleChromeDistribution::HasUserExperiments() { | 294 bool GoogleChromeDistribution::HasUserExperiments() { |
293 return true; | 295 return true; |
294 } | 296 } |
OLD | NEW |