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 // See the corresponding header file for description of the functions in this | 5 // See the corresponding header file for description of the functions in this |
6 // file. | 6 // file. |
7 | 7 |
8 #include "chrome/installer/util/install_util.h" | 8 #include "chrome/installer/util/install_util.h" |
9 | 9 |
10 #include <shellapi.h> | 10 #include <shellapi.h> |
11 #include <shlobj.h> | 11 #include <shlobj.h> |
12 #include <shlwapi.h> | 12 #include <shlwapi.h> |
13 | 13 |
14 #include <algorithm> | 14 #include <algorithm> |
| 15 #include <memory> |
15 | 16 |
16 #include "base/command_line.h" | 17 #include "base/command_line.h" |
17 #include "base/environment.h" | 18 #include "base/environment.h" |
18 #include "base/files/file_util.h" | 19 #include "base/files/file_util.h" |
19 #include "base/logging.h" | 20 #include "base/logging.h" |
20 #include "base/macros.h" | 21 #include "base/macros.h" |
21 #include "base/memory/scoped_ptr.h" | |
22 #include "base/numerics/safe_conversions.h" | 22 #include "base/numerics/safe_conversions.h" |
23 #include "base/path_service.h" | 23 #include "base/path_service.h" |
24 #include "base/process/launch.h" | 24 #include "base/process/launch.h" |
25 #include "base/strings/string_util.h" | 25 #include "base/strings/string_util.h" |
26 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
27 #include "base/sys_info.h" | 27 #include "base/sys_info.h" |
28 #include "base/values.h" | 28 #include "base/values.h" |
29 #include "base/version.h" | 29 #include "base/version.h" |
30 #include "base/win/registry.h" | 30 #include "base/win/registry.h" |
31 #include "base/win/windows_version.h" | 31 #include "base/win/windows_version.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 !channel_info.Write(&state_key)) { | 354 !channel_info.Write(&state_key)) { |
355 LOG(ERROR) << "Failed writing installer stage to " << state_key_path; | 355 LOG(ERROR) << "Failed writing installer stage to " << state_key_path; |
356 } | 356 } |
357 } else { | 357 } else { |
358 LOG(ERROR) << "Failed opening " << state_key_path | 358 LOG(ERROR) << "Failed opening " << state_key_path |
359 << " to update installer stage; result: " << result; | 359 << " to update installer stage; result: " << result; |
360 } | 360 } |
361 } | 361 } |
362 | 362 |
363 bool InstallUtil::IsPerUserInstall(const base::FilePath& exe_path) { | 363 bool InstallUtil::IsPerUserInstall(const base::FilePath& exe_path) { |
364 scoped_ptr<base::Environment> env(base::Environment::Create()); | 364 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
365 | 365 |
366 static const char kEnvProgramFilesPath[] = "CHROME_PROBED_PROGRAM_FILES_PATH"; | 366 static const char kEnvProgramFilesPath[] = "CHROME_PROBED_PROGRAM_FILES_PATH"; |
367 std::string env_program_files_path; | 367 std::string env_program_files_path; |
368 // Check environment variable to find program files path. | 368 // Check environment variable to find program files path. |
369 base::FilePath program_files_path; | 369 base::FilePath program_files_path; |
370 if (env->GetVar(kEnvProgramFilesPath, &env_program_files_path) && | 370 if (env->GetVar(kEnvProgramFilesPath, &env_program_files_path) && |
371 !env_program_files_path.empty()) { | 371 !env_program_files_path.empty()) { |
372 program_files_path = | 372 program_files_path = |
373 base::FilePath(base::UTF8ToWide(env_program_files_path)); | 373 base::FilePath(base::UTF8ToWide(env_program_files_path)); |
374 } else { | 374 } else { |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 | 676 |
677 // Open the program and see if it references the expected file. | 677 // Open the program and see if it references the expected file. |
678 base::File file; | 678 base::File file; |
679 BY_HANDLE_FILE_INFORMATION info = {}; | 679 BY_HANDLE_FILE_INFORMATION info = {}; |
680 | 680 |
681 return (OpenForInfo(path, &file, comparison_type_) && GetInfo(file, &info) && | 681 return (OpenForInfo(path, &file, comparison_type_) && GetInfo(file, &info) && |
682 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && | 682 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && |
683 info.nFileIndexHigh == file_info_.nFileIndexHigh && | 683 info.nFileIndexHigh == file_info_.nFileIndexHigh && |
684 info.nFileIndexLow == file_info_.nFileIndexLow); | 684 info.nFileIndexLow == file_info_.nFileIndexLow); |
685 } | 685 } |
OLD | NEW |