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

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

Issue 141113003: Refactor base/safe_numerics.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
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 <string> 11 #include <string>
12 12
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/file_util.h" 14 #include "base/file_util.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/numerics/safe_conversions.h"
18 #include "base/path_service.h" 19 #include "base/path_service.h"
19 #include "base/process/launch.h" 20 #include "base/process/launch.h"
20 #include "base/safe_numerics.h"
21 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
22 #include "base/strings/stringprintf.h" 22 #include "base/strings/stringprintf.h"
23 #include "base/strings/utf_string_conversions.h" 23 #include "base/strings/utf_string_conversions.h"
24 #include "base/win/shortcut.h" 24 #include "base/win/shortcut.h"
25 #include "base/win/windows_version.h" 25 #include "base/win/windows_version.h"
26 #include "chrome/common/chrome_constants.h" 26 #include "chrome/common/chrome_constants.h"
27 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
28 #include "chrome/installer/launcher_support/chrome_launcher_support.h" 28 #include "chrome/installer/launcher_support/chrome_launcher_support.h"
29 #include "chrome/installer/setup/install_worker.h" 29 #include "chrome/installer/setup/install_worker.h"
30 #include "chrome/installer/setup/setup_constants.h" 30 #include "chrome/installer/setup/setup_constants.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 // resource for |display_name|. 344 // resource for |display_name|.
345 base::string16 display_name(dist->GetDisplayName()); 345 base::string16 display_name(dist->GetDisplayName());
346 EscapeXmlAttributeValueInSingleQuotes(&display_name); 346 EscapeXmlAttributeValueInSingleQuotes(&display_name);
347 347
348 // Fill the manifest with the desired values. 348 // Fill the manifest with the desired values.
349 base::string16 manifest16(base::StringPrintf( 349 base::string16 manifest16(base::StringPrintf(
350 manifest_template.c_str(), display_name.c_str(), elements_dir.c_str())); 350 manifest_template.c_str(), display_name.c_str(), elements_dir.c_str()));
351 351
352 // Write the manifest to |src_path|. 352 // Write the manifest to |src_path|.
353 const std::string manifest(UTF16ToUTF8(manifest16)); 353 const std::string manifest(UTF16ToUTF8(manifest16));
354 int size = base::checked_numeric_cast<int>(manifest.size()); 354 int size = base::checked_cast<int>(manifest.size());
355 if (file_util::WriteFile( 355 if (file_util::WriteFile(
356 src_path.Append(installer::kVisualElementsManifest), 356 src_path.Append(installer::kVisualElementsManifest),
357 manifest.c_str(), size) == size) { 357 manifest.c_str(), size) == size) {
358 VLOG(1) << "Successfully wrote " << installer::kVisualElementsManifest 358 VLOG(1) << "Successfully wrote " << installer::kVisualElementsManifest
359 << " to " << src_path.value(); 359 << " to " << src_path.value();
360 return true; 360 return true;
361 } else { 361 } else {
362 PLOG(ERROR) << "Error writing " << installer::kVisualElementsManifest 362 PLOG(ERROR) << "Error writing " << installer::kVisualElementsManifest
363 << " to " << src_path.value(); 363 << " to " << src_path.value();
364 return false; 364 return false;
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 if (app_host_path.empty()) 702 if (app_host_path.empty())
703 return false; 703 return false;
704 704
705 CommandLine cmd(app_host_path); 705 CommandLine cmd(app_host_path);
706 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); 706 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code);
707 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); 707 VLOG(1) << "App install command: " << cmd.GetCommandLineString();
708 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); 708 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL);
709 } 709 }
710 710
711 } // namespace installer 711 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/session_model_associator.cc ('k') | chrome/renderer/pepper/ppb_pdf_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698