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/setup/install.h" | 5 #include "chrome/installer/setup/install.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <shlobj.h> | 8 #include <shlobj.h> |
9 #include <time.h> | 9 #include <time.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/files/file_util.h" | 16 #include "base/files/file_util.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/numerics/safe_conversions.h" | 18 #include "base/numerics/safe_conversions.h" |
19 #include "base/process/launch.h" | 19 #include "base/process/launch.h" |
20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
21 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
23 #include "base/win/shortcut.h" | 23 #include "base/win/shortcut.h" |
| 24 #include "chrome/install_static/install_details.h" |
24 #include "chrome/installer/setup/install_worker.h" | 25 #include "chrome/installer/setup/install_worker.h" |
25 #include "chrome/installer/setup/installer_crash_reporting.h" | 26 #include "chrome/installer/setup/installer_crash_reporting.h" |
26 #include "chrome/installer/setup/installer_state.h" | 27 #include "chrome/installer/setup/installer_state.h" |
27 #include "chrome/installer/setup/setup_constants.h" | 28 #include "chrome/installer/setup/setup_constants.h" |
28 #include "chrome/installer/setup/setup_util.h" | 29 #include "chrome/installer/setup/setup_util.h" |
29 #include "chrome/installer/setup/update_active_setup_version_work_item.h" | 30 #include "chrome/installer/setup/update_active_setup_version_work_item.h" |
30 #include "chrome/installer/util/beacons.h" | 31 #include "chrome/installer/util/beacons.h" |
31 #include "chrome/installer/util/browser_distribution.h" | 32 #include "chrome/installer/util/browser_distribution.h" |
32 #include "chrome/installer/util/create_reg_key_work_item.h" | 33 #include "chrome/installer/util/create_reg_key_work_item.h" |
33 #include "chrome/installer/util/delete_after_reboot_helper.h" | 34 #include "chrome/installer/util/delete_after_reboot_helper.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 const base::string16 manifest_template( | 302 const base::string16 manifest_template( |
302 base::ASCIIToUTF16(kManifestTemplate)); | 303 base::ASCIIToUTF16(kManifestTemplate)); |
303 | 304 |
304 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 305 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
305 // TODO(grt): http://crbug.com/75152 Write a reference to a localized | 306 // TODO(grt): http://crbug.com/75152 Write a reference to a localized |
306 // resource for |display_name|. | 307 // resource for |display_name|. |
307 base::string16 display_name(dist->GetDisplayName()); | 308 base::string16 display_name(dist->GetDisplayName()); |
308 EscapeXmlAttributeValueInSingleQuotes(&display_name); | 309 EscapeXmlAttributeValueInSingleQuotes(&display_name); |
309 | 310 |
310 // Fill the manifest with the desired values. | 311 // Fill the manifest with the desired values. |
311 const base::char16* canary_str = | 312 const base::char16* logo_suffix = |
312 InstallUtil::IsChromeSxSProcess() ? L"Canary" : L""; | 313 install_static::InstallDetails::Get().logo_suffix(); |
313 base::string16 manifest16(base::StringPrintf( | 314 base::string16 manifest16(base::StringPrintf( |
314 manifest_template.c_str(), elements_dir.c_str(), canary_str, | 315 manifest_template.c_str(), elements_dir.c_str(), logo_suffix, |
315 elements_dir.c_str(), canary_str, elements_dir.c_str(), canary_str)); | 316 elements_dir.c_str(), logo_suffix, elements_dir.c_str(), logo_suffix)); |
316 | 317 |
317 // Write the manifest to |src_path|. | 318 // Write the manifest to |src_path|. |
318 const std::string manifest(base::UTF16ToUTF8(manifest16)); | 319 const std::string manifest(base::UTF16ToUTF8(manifest16)); |
319 int size = base::checked_cast<int>(manifest.size()); | 320 int size = base::checked_cast<int>(manifest.size()); |
320 if (base::WriteFile( | 321 if (base::WriteFile( |
321 src_path.Append(installer::kVisualElementsManifest), | 322 src_path.Append(installer::kVisualElementsManifest), |
322 manifest.c_str(), size) == size) { | 323 manifest.c_str(), size) == size) { |
323 VLOG(1) << "Successfully wrote " << installer::kVisualElementsManifest | 324 VLOG(1) << "Successfully wrote " << installer::kVisualElementsManifest |
324 << " to " << src_path.value(); | 325 << " to " << src_path.value(); |
325 return true; | 326 return true; |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 // Read master_preferences copied beside chrome.exe at install. | 689 // Read master_preferences copied beside chrome.exe at install. |
689 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); | 690 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); |
690 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); | 691 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); |
691 CreateOrUpdateShortcuts( | 692 CreateOrUpdateShortcuts( |
692 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); | 693 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); |
693 | 694 |
694 UpdateDefaultBrowserBeaconForPath(chrome_exe); | 695 UpdateDefaultBrowserBeaconForPath(chrome_exe); |
695 } | 696 } |
696 | 697 |
697 } // namespace installer | 698 } // namespace installer |
OLD | NEW |