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

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

Issue 902643002: Revert "Enable positional parameters for base::vsnprintf and base::vswprintf on Windows." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 5 years, 10 months 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
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 elements_dir.push_back(base::FilePath::kSeparators[0]); 295 elements_dir.push_back(base::FilePath::kSeparators[0]);
296 elements_dir.append(installer::kVisualElements); 296 elements_dir.append(installer::kVisualElements);
297 297
298 // Some distributions of Chromium may not include visual elements. Only 298 // Some distributions of Chromium may not include visual elements. Only
299 // proceed if this distribution does. 299 // proceed if this distribution does.
300 if (!base::PathExists(src_path.Append(elements_dir))) { 300 if (!base::PathExists(src_path.Append(elements_dir))) {
301 VLOG(1) << "No visual elements found, not writing " 301 VLOG(1) << "No visual elements found, not writing "
302 << installer::kVisualElementsManifest << " to " << src_path.value(); 302 << installer::kVisualElementsManifest << " to " << src_path.value();
303 return true; 303 return true;
304 } else { 304 } else {
305 // A printf_p-style format string for generating the visual elements 305 // A printf-style format string for generating the visual elements
306 // manifest. Required arguments, in order, are: 306 // manifest. Required arguments, in order, are:
307 // - Localized display name for the product. 307 // - Localized display name for the product.
308 // - Relative path to the VisualElements directory. 308 // - Relative path to the VisualElements directory, three times.
309 static const char kManifestTemplate[] = 309 static const char kManifestTemplate[] =
310 "<Application>\r\n" 310 "<Application>\r\n"
311 " <VisualElements\r\n" 311 " <VisualElements\r\n"
312 " DisplayName='%1$ls'\r\n" 312 " DisplayName='%ls'\r\n"
313 " Logo='%2$ls\\Logo.png'\r\n" 313 " Logo='%ls\\Logo.png'\r\n"
314 " SmallLogo='%2$ls\\SmallLogo.png'\r\n" 314 " SmallLogo='%ls\\SmallLogo.png'\r\n"
315 " ForegroundText='light'\r\n" 315 " ForegroundText='light'\r\n"
316 " BackgroundColor='#323232'>\r\n" 316 " BackgroundColor='#323232'>\r\n"
317 " <DefaultTile ShowName='allLogos'/>\r\n" 317 " <DefaultTile ShowName='allLogos'/>\r\n"
318 " <SplashScreen Image='%2$ls\\splash-620x300.png'/>\r\n" 318 " <SplashScreen Image='%ls\\splash-620x300.png'/>\r\n"
319 " </VisualElements>\r\n" 319 " </VisualElements>\r\n"
320 "</Application>"; 320 "</Application>";
321 321
322 const base::string16 manifest_template( 322 const base::string16 manifest_template(
323 base::ASCIIToUTF16(kManifestTemplate)); 323 base::ASCIIToUTF16(kManifestTemplate));
324 324
325 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( 325 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution(
326 BrowserDistribution::CHROME_BROWSER); 326 BrowserDistribution::CHROME_BROWSER);
327 // TODO(grt): http://crbug.com/75152 Write a reference to a localized 327 // TODO(grt): http://crbug.com/75152 Write a reference to a localized
328 // resource for |display_name|. 328 // resource for |display_name|.
329 base::string16 display_name(dist->GetDisplayName()); 329 base::string16 display_name(dist->GetDisplayName());
330 EscapeXmlAttributeValueInSingleQuotes(&display_name); 330 EscapeXmlAttributeValueInSingleQuotes(&display_name);
331 331
332 // Fill the manifest with the desired values. 332 // Fill the manifest with the desired values.
333 base::string16 manifest16(base::StringPrintf( 333 base::string16 manifest16(base::StringPrintf(
334 manifest_template.c_str(), display_name.c_str(), elements_dir.c_str())); 334 manifest_template.c_str(), display_name.c_str(), elements_dir.c_str(),
335 elements_dir.c_str(), elements_dir.c_str()));
335 336
336 // Write the manifest to |src_path|. 337 // Write the manifest to |src_path|.
337 const std::string manifest(base::UTF16ToUTF8(manifest16)); 338 const std::string manifest(base::UTF16ToUTF8(manifest16));
338 int size = base::checked_cast<int>(manifest.size()); 339 int size = base::checked_cast<int>(manifest.size());
339 if (base::WriteFile( 340 if (base::WriteFile(
340 src_path.Append(installer::kVisualElementsManifest), 341 src_path.Append(installer::kVisualElementsManifest),
341 manifest.c_str(), size) == size) { 342 manifest.c_str(), size) == size) {
342 VLOG(1) << "Successfully wrote " << installer::kVisualElementsManifest 343 VLOG(1) << "Successfully wrote " << installer::kVisualElementsManifest
343 << " to " << src_path.value(); 344 << " to " << src_path.value();
344 return true; 345 return true;
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); 673 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL);
673 674
674 // Read master_preferences copied beside chrome.exe at install. 675 // Read master_preferences copied beside chrome.exe at install.
675 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); 676 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs));
676 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); 677 base::FilePath chrome_exe(installation_root.Append(kChromeExe));
677 CreateOrUpdateShortcuts( 678 CreateOrUpdateShortcuts(
678 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); 679 chrome_exe, chrome, prefs, CURRENT_USER, install_operation);
679 } 680 }
680 681
681 } // namespace installer 682 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698