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

Side by Side Diff: chrome/browser/component_updater/component_patcher_win.cc

Issue 176843022: Move UTF16ToASCII, remove WideToASCII. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/browser/component_updater/component_patcher_win.h" 5 #include "chrome/browser/component_updater/component_patcher_win.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/process/kill.h" 13 #include "base/process/kill.h"
14 #include "base/process/launch.h" 14 #include "base/process/launch.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/strings/utf_string_conversions.h"
16 #include "base/win/scoped_handle.h" 17 #include "base/win/scoped_handle.h"
17 #include "chrome/installer/util/util_constants.h" 18 #include "chrome/installer/util/util_constants.h"
18 19
19 namespace component_updater { 20 namespace component_updater {
20 21
21 namespace { 22 namespace {
22 23
23 std::string PatchTypeToCommandLineSwitch( 24 std::string PatchTypeToCommandLineSwitch(
24 ComponentPatcher::PatchType patch_type) { 25 ComponentPatcher::PatchType patch_type) {
25 if (patch_type == ComponentPatcher::kPatchTypeCourgette) 26 if (patch_type == ComponentPatcher::kPatchTypeCourgette)
26 return std::string(installer::kCourgette); 27 return std::string(installer::kCourgette);
27 else if (patch_type == ComponentPatcher::kPatchTypeBsdiff) 28 else if (patch_type == ComponentPatcher::kPatchTypeBsdiff)
28 return std::string(installer::kBsdiff); 29 return std::string(installer::kBsdiff);
29 else 30 else
30 return std::string(); 31 return std::string();
31 } 32 }
32 33
33 // Finds the path to the setup.exe. First, it looks for the program in the 34 // Finds the path to the setup.exe. First, it looks for the program in the
34 // "installer" directory. If the program is not found there, it tries to find it 35 // "installer" directory. If the program is not found there, it tries to find it
35 // in the directory where chrome.dll lives. Returns the path to the setup.exe, 36 // in the directory where chrome.dll lives. Returns the path to the setup.exe,
36 // if the path exists, otherwise it returns an an empty path. 37 // if the path exists, otherwise it returns an an empty path.
37 base::FilePath FindSetupProgram() { 38 base::FilePath FindSetupProgram() {
38 base::FilePath exe_dir; 39 base::FilePath exe_dir;
39 if (!PathService::Get(base::DIR_MODULE, &exe_dir)) 40 if (!PathService::Get(base::DIR_MODULE, &exe_dir))
40 return base::FilePath(); 41 return base::FilePath();
41 42
42 const std::string installer_dir(WideToASCII(installer::kInstallerDir)); 43 const std::string installer_dir(base::UTF16ToASCII(installer::kInstallerDir));
43 const std::string setup_exe(WideToASCII(installer::kSetupExe)); 44 const std::string setup_exe(base::UTF16ToASCII(installer::kSetupExe));
44 45
45 base::FilePath setup_path = exe_dir; 46 base::FilePath setup_path = exe_dir;
46 setup_path = setup_path.AppendASCII(installer_dir); 47 setup_path = setup_path.AppendASCII(installer_dir);
47 setup_path = setup_path.AppendASCII(setup_exe); 48 setup_path = setup_path.AppendASCII(setup_exe);
48 if (base::PathExists(setup_path)) 49 if (base::PathExists(setup_path))
49 return setup_path; 50 return setup_path;
50 51
51 setup_path = exe_dir; 52 setup_path = exe_dir;
52 setup_path = setup_path.AppendASCII(setup_exe); 53 setup_path = setup_path.AppendASCII(setup_exe);
53 if (base::PathExists(setup_path)) 54 if (base::PathExists(setup_path))
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 *error = GetLastError(); 109 *error = GetLastError();
109 return ComponentUnpacker::kDeltaPatchProcessFailure; 110 return ComponentUnpacker::kDeltaPatchProcessFailure;
110 } 111 }
111 112
112 *error = exit_code; 113 *error = exit_code;
113 return *error ? ComponentUnpacker::kDeltaOperationFailure : 114 return *error ? ComponentUnpacker::kDeltaOperationFailure :
114 ComponentUnpacker::kNone; 115 ComponentUnpacker::kNone;
115 } 116 }
116 117
117 } // namespace component_updater 118 } // namespace component_updater
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/profiles/profile_list_chromeos_unittest.cc ('k') | chrome/browser/devtools/adb/android_usb_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698