| 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> |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 if (channel_info.SetStage(kStages[stage]) && | 367 if (channel_info.SetStage(kStages[stage]) && |
| 368 !channel_info.Write(&state_key)) { | 368 !channel_info.Write(&state_key)) { |
| 369 LOG(ERROR) << "Failed writing installer stage to " << state_key_path; | 369 LOG(ERROR) << "Failed writing installer stage to " << state_key_path; |
| 370 } | 370 } |
| 371 } else { | 371 } else { |
| 372 LOG(ERROR) << "Failed opening " << state_key_path | 372 LOG(ERROR) << "Failed opening " << state_key_path |
| 373 << " to update installer stage; result: " << result; | 373 << " to update installer stage; result: " << result; |
| 374 } | 374 } |
| 375 } | 375 } |
| 376 | 376 |
| 377 const base::char16* const InstallUtil::StageToString( |
| 378 installer::InstallerStage stage) { |
| 379 DCHECK_LE(static_cast<installer::InstallerStage>(0), stage); |
| 380 DCHECK_GT(installer::NUM_STAGES, stage); |
| 381 if (stage == 0) |
| 382 return L"none"; |
| 383 if (kStages[stage] == nullptr) |
| 384 return L"deprecated"; |
| 385 return kStages[stage]; |
| 386 } |
| 387 |
| 377 bool InstallUtil::IsPerUserInstall(const base::FilePath& exe_path) { | 388 bool InstallUtil::IsPerUserInstall(const base::FilePath& exe_path) { |
| 378 scoped_ptr<base::Environment> env(base::Environment::Create()); | 389 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 379 | 390 |
| 380 static const char kEnvProgramFilesPath[] = "CHROME_PROBED_PROGRAM_FILES_PATH"; | 391 static const char kEnvProgramFilesPath[] = "CHROME_PROBED_PROGRAM_FILES_PATH"; |
| 381 std::string env_program_files_path; | 392 std::string env_program_files_path; |
| 382 // Check environment variable to find program files path. | 393 // Check environment variable to find program files path. |
| 383 base::FilePath program_files_path; | 394 base::FilePath program_files_path; |
| 384 if (env->GetVar(kEnvProgramFilesPath, &env_program_files_path) && | 395 if (env->GetVar(kEnvProgramFilesPath, &env_program_files_path) && |
| 385 !env_program_files_path.empty()) { | 396 !env_program_files_path.empty()) { |
| 386 program_files_path = | 397 program_files_path = |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 // Open the program and see if it references the expected file. | 694 // Open the program and see if it references the expected file. |
| 684 base::File file; | 695 base::File file; |
| 685 BY_HANDLE_FILE_INFORMATION info = {}; | 696 BY_HANDLE_FILE_INFORMATION info = {}; |
| 686 | 697 |
| 687 return (OpenForInfo(path, &file) && | 698 return (OpenForInfo(path, &file) && |
| 688 GetInfo(file, &info) && | 699 GetInfo(file, &info) && |
| 689 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && | 700 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && |
| 690 info.nFileIndexHigh == file_info_.nFileIndexHigh && | 701 info.nFileIndexHigh == file_info_.nFileIndexHigh && |
| 691 info.nFileIndexLow == file_info_.nFileIndexLow); | 702 info.nFileIndexLow == file_info_.nFileIndexLow); |
| 692 } | 703 } |
| OLD | NEW |