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

Side by Side Diff: chrome/installer/setup/install.cc

Issue 2459583002: Use InstallDetails in setup. (Closed)
Patch Set: Created 4 years, 1 month 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
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/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 "base/win/windows_version.h" 24 #include "base/win/windows_version.h"
25 #include "chrome/common/chrome_constants.h" 25 #include "chrome/common/chrome_constants.h"
26 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
27 #include "chrome/installer/setup/brand_constants.h"
27 #include "chrome/installer/setup/install_worker.h" 28 #include "chrome/installer/setup/install_worker.h"
28 #include "chrome/installer/setup/installer_crash_reporting.h" 29 #include "chrome/installer/setup/installer_crash_reporting.h"
29 #include "chrome/installer/setup/setup_constants.h" 30 #include "chrome/installer/setup/setup_constants.h"
30 #include "chrome/installer/setup/setup_util.h" 31 #include "chrome/installer/setup/setup_util.h"
31 #include "chrome/installer/setup/update_active_setup_version_work_item.h" 32 #include "chrome/installer/setup/update_active_setup_version_work_item.h"
32 #include "chrome/installer/util/beacons.h" 33 #include "chrome/installer/util/beacons.h"
33 #include "chrome/installer/util/browser_distribution.h" 34 #include "chrome/installer/util/browser_distribution.h"
34 #include "chrome/installer/util/create_reg_key_work_item.h" 35 #include "chrome/installer/util/create_reg_key_work_item.h"
35 #include "chrome/installer/util/delete_after_reboot_helper.h" 36 #include "chrome/installer/util/delete_after_reboot_helper.h"
36 #include "chrome/installer/util/delete_old_versions.h" 37 #include "chrome/installer/util/delete_old_versions.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 base::ASCIIToUTF16(kManifestTemplate)); 313 base::ASCIIToUTF16(kManifestTemplate));
313 314
314 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( 315 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution(
315 BrowserDistribution::CHROME_BROWSER); 316 BrowserDistribution::CHROME_BROWSER);
316 // TODO(grt): http://crbug.com/75152 Write a reference to a localized 317 // TODO(grt): http://crbug.com/75152 Write a reference to a localized
317 // resource for |display_name|. 318 // resource for |display_name|.
318 base::string16 display_name(dist->GetDisplayName()); 319 base::string16 display_name(dist->GetDisplayName());
319 EscapeXmlAttributeValueInSingleQuotes(&display_name); 320 EscapeXmlAttributeValueInSingleQuotes(&display_name);
320 321
321 // Fill the manifest with the desired values. 322 // Fill the manifest with the desired values.
322 const base::char16* canary_str = 323 const base::char16* logo_suffix = GetBrandConstants().logo_suffix;
323 InstallUtil::IsChromeSxSProcess() ? L"Canary" : L"";
324 base::string16 manifest16(base::StringPrintf( 324 base::string16 manifest16(base::StringPrintf(
325 manifest_template.c_str(), elements_dir.c_str(), canary_str, 325 manifest_template.c_str(), elements_dir.c_str(), logo_suffix,
326 elements_dir.c_str(), canary_str, elements_dir.c_str(), canary_str)); 326 elements_dir.c_str(), logo_suffix, elements_dir.c_str(), logo_suffix));
327 327
328 // Write the manifest to |src_path|. 328 // Write the manifest to |src_path|.
329 const std::string manifest(base::UTF16ToUTF8(manifest16)); 329 const std::string manifest(base::UTF16ToUTF8(manifest16));
330 int size = base::checked_cast<int>(manifest.size()); 330 int size = base::checked_cast<int>(manifest.size());
331 if (base::WriteFile( 331 if (base::WriteFile(
332 src_path.Append(installer::kVisualElementsManifest), 332 src_path.Append(installer::kVisualElementsManifest),
333 manifest.c_str(), size) == size) { 333 manifest.c_str(), size) == size) {
334 VLOG(1) << "Successfully wrote " << installer::kVisualElementsManifest 334 VLOG(1) << "Successfully wrote " << installer::kVisualElementsManifest
335 << " to " << src_path.value(); 335 << " to " << src_path.value();
336 return true; 336 return true;
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 // Read master_preferences copied beside chrome.exe at install. 717 // Read master_preferences copied beside chrome.exe at install.
718 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); 718 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs));
719 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); 719 base::FilePath chrome_exe(installation_root.Append(kChromeExe));
720 CreateOrUpdateShortcuts( 720 CreateOrUpdateShortcuts(
721 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); 721 chrome_exe, chrome, prefs, CURRENT_USER, install_operation);
722 722
723 UpdateDefaultBrowserBeaconForPath(chrome_exe); 723 UpdateDefaultBrowserBeaconForPath(chrome_exe);
724 } 724 }
725 725
726 } // namespace installer 726 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698