Chromium Code Reviews| 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 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 #include "chrome/installer/util/helper.h" | 36 #include "chrome/installer/util/helper.h" |
| 37 #include "chrome/installer/util/install_util.h" | 37 #include "chrome/installer/util/install_util.h" |
| 38 #include "chrome/installer/util/master_preferences.h" | 38 #include "chrome/installer/util/master_preferences.h" |
| 39 #include "chrome/installer/util/master_preferences_constants.h" | 39 #include "chrome/installer/util/master_preferences_constants.h" |
| 40 #include "chrome/installer/util/set_reg_value_work_item.h" | 40 #include "chrome/installer/util/set_reg_value_work_item.h" |
| 41 #include "chrome/installer/util/shell_util.h" | 41 #include "chrome/installer/util/shell_util.h" |
| 42 #include "chrome/installer/util/util_constants.h" | 42 #include "chrome/installer/util/util_constants.h" |
| 43 #include "chrome/installer/util/work_item.h" | 43 #include "chrome/installer/util/work_item.h" |
| 44 #include "chrome/installer/util/work_item_list.h" | 44 #include "chrome/installer/util/work_item_list.h" |
| 45 | 45 |
| 46 | |
| 47 namespace { | 46 namespace { |
| 48 | 47 |
| 49 void LogShortcutOperation(ShellUtil::ShortcutLocation location, | 48 void LogShortcutOperation(ShellUtil::ShortcutLocation location, |
| 50 BrowserDistribution* dist, | 49 BrowserDistribution* dist, |
| 51 const ShellUtil::ShortcutProperties& properties, | 50 const ShellUtil::ShortcutProperties& properties, |
| 52 ShellUtil::ShortcutOperation operation, | 51 ShellUtil::ShortcutOperation operation, |
| 53 bool failed) { | 52 bool failed) { |
| 54 // ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING should not be used at install and | 53 // ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING should not be used at install and |
| 55 // thus this method does not handle logging a message for it. | 54 // thus this method does not handle logging a message for it. |
| 56 DCHECK(operation != ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING); | 55 DCHECK(operation != ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING); |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 383 } else { | 382 } else { |
| 384 // A printf-style format string for generating the visual elements | 383 // A printf-style format string for generating the visual elements |
| 385 // manifest. Required arguments, in order, are: | 384 // manifest. Required arguments, in order, are: |
| 386 // - Localized display name for the product. | 385 // - Localized display name for the product. |
| 387 // - Relative path to the VisualElements directory, three times. | 386 // - Relative path to the VisualElements directory, three times. |
| 388 static const char kManifestTemplate[] = | 387 static const char kManifestTemplate[] = |
| 389 "<Application " | 388 "<Application " |
| 390 "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>\r\n" | 389 "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>\r\n" |
| 391 " <VisualElements\r\n" | 390 " <VisualElements\r\n" |
| 392 " ShowNameOnSquare150x150Logo='on'\r\n" | 391 " ShowNameOnSquare150x150Logo='on'\r\n" |
| 393 " Square150x150Logo='%ls\\Logo.png'\r\n" | 392 " Square150x150Logo='%ls\\Logo%ls.png'\r\n" |
| 394 " Square70x70Logo='%ls\\SmallLogo.png'\r\n" | 393 " Square70x70Logo='%ls\\SmallLogo%ls.png'\r\n" |
| 395 " Square44x44Logo='%ls\\SmallLogo.png'\r\n" | 394 " Square44x44Logo='%ls\\SmallLogo%ls.png'\r\n" |
| 396 " ForegroundText='light'\r\n" | 395 " ForegroundText='light'\r\n" |
| 397 " BackgroundColor='#212121'/>\r\n" | 396 " BackgroundColor='#212121'/>\r\n" |
| 398 "</Application>\r\n"; | 397 "</Application>\r\n"; |
| 399 | 398 |
| 400 const base::string16 manifest_template( | 399 const base::string16 manifest_template( |
| 401 base::ASCIIToUTF16(kManifestTemplate)); | 400 base::ASCIIToUTF16(kManifestTemplate)); |
| 402 | 401 |
| 403 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( | 402 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( |
| 404 BrowserDistribution::CHROME_BROWSER); | 403 BrowserDistribution::CHROME_BROWSER); |
| 405 // TODO(grt): http://crbug.com/75152 Write a reference to a localized | 404 // TODO(grt): http://crbug.com/75152 Write a reference to a localized |
| 406 // resource for |display_name|. | 405 // resource for |display_name|. |
| 407 base::string16 display_name(dist->GetDisplayName()); | 406 base::string16 display_name(dist->GetDisplayName()); |
| 408 EscapeXmlAttributeValueInSingleQuotes(&display_name); | 407 EscapeXmlAttributeValueInSingleQuotes(&display_name); |
| 409 | 408 |
| 410 // Fill the manifest with the desired values. | 409 // Fill the manifest with the desired values. |
| 411 base::string16 manifest16( | 410 const base::char16* canary_str = |
| 412 base::StringPrintf(manifest_template.c_str(), elements_dir.c_str(), | 411 InstallUtil::IsChromeSxSProcess() ? L"Canary" : L""; |
|
scottmg
2016/08/24 20:35:41
Did you want GOOGLE_CHROME_BRANDED around this? It
grt (UTC plus 2)
2016/08/25 10:22:56
Naah. I think it'd be better for CheckIsChromeSxSP
| |
| 413 elements_dir.c_str(), elements_dir.c_str())); | 412 base::string16 manifest16(base::StringPrintf( |
| 413 manifest_template.c_str(), elements_dir.c_str(), canary_str, | |
| 414 elements_dir.c_str(), canary_str, elements_dir.c_str(), canary_str)); | |
| 414 | 415 |
| 415 // Write the manifest to |src_path|. | 416 // Write the manifest to |src_path|. |
| 416 const std::string manifest(base::UTF16ToUTF8(manifest16)); | 417 const std::string manifest(base::UTF16ToUTF8(manifest16)); |
| 417 int size = base::checked_cast<int>(manifest.size()); | 418 int size = base::checked_cast<int>(manifest.size()); |
| 418 if (base::WriteFile( | 419 if (base::WriteFile( |
| 419 src_path.Append(installer::kVisualElementsManifest), | 420 src_path.Append(installer::kVisualElementsManifest), |
| 420 manifest.c_str(), size) == size) { | 421 manifest.c_str(), size) == size) { |
| 421 VLOG(1) << "Successfully wrote " << installer::kVisualElementsManifest | 422 VLOG(1) << "Successfully wrote " << installer::kVisualElementsManifest |
| 422 << " to " << src_path.value(); | 423 << " to " << src_path.value(); |
| 423 return true; | 424 return true; |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 780 // Read master_preferences copied beside chrome.exe at install. | 781 // Read master_preferences copied beside chrome.exe at install. |
| 781 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); | 782 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); |
| 782 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); | 783 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); |
| 783 CreateOrUpdateShortcuts( | 784 CreateOrUpdateShortcuts( |
| 784 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); | 785 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); |
| 785 | 786 |
| 786 UpdateDefaultBrowserBeaconForPath(chrome_exe); | 787 UpdateDefaultBrowserBeaconForPath(chrome_exe); |
| 787 } | 788 } |
| 788 | 789 |
| 789 } // namespace installer | 790 } // namespace installer |
| OLD | NEW |