| 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 base::FilePath user_data_dir; | 407 base::FilePath user_data_dir; |
| 408 return !PathService::Get(chrome::DIR_USER_DATA, &user_data_dir) || | 408 return !PathService::Get(chrome::DIR_USER_DATA, &user_data_dir) || |
| 409 base::PathExists(user_data_dir.Append(chrome::kFirstRunSentinel)); | 409 base::PathExists(user_data_dir.Append(chrome::kFirstRunSentinel)); |
| 410 } | 410 } |
| 411 | 411 |
| 412 // static | 412 // static |
| 413 bool InstallUtil::GetSentinelFilePath(const base::FilePath::CharType* file, | 413 bool InstallUtil::GetSentinelFilePath(const base::FilePath::CharType* file, |
| 414 BrowserDistribution* dist, | 414 BrowserDistribution* dist, |
| 415 base::FilePath* path) { | 415 base::FilePath* path) { |
| 416 // TODO(msw): Use PathService to obtain the correct DIR_USER_DATA. | 416 // TODO(msw): Use PathService to obtain the correct DIR_USER_DATA. |
| 417 std::vector<base::FilePath> user_data_dir_paths; | 417 base::FilePath user_data_dir(installer::GetChromeUserDataPath(dist)); |
| 418 installer::GetChromeUserDataPaths(dist, &user_data_dir_paths); | |
| 419 | 418 |
| 420 if (user_data_dir_paths.empty()) | 419 if (user_data_dir.empty()) |
| 421 return false; | 420 return false; |
| 422 *path = user_data_dir_paths[0].Append(file); | 421 *path = user_data_dir.Append(file); |
| 423 return true; | 422 return true; |
| 424 } | 423 } |
| 425 | 424 |
| 426 // This method tries to delete a registry key and logs an error message | 425 // This method tries to delete a registry key and logs an error message |
| 427 // in case of failure. It returns true if deletion is successful (or the key did | 426 // in case of failure. It returns true if deletion is successful (or the key did |
| 428 // not exist), otherwise false. | 427 // not exist), otherwise false. |
| 429 bool InstallUtil::DeleteRegistryKey(HKEY root_key, | 428 bool InstallUtil::DeleteRegistryKey(HKEY root_key, |
| 430 const base::string16& key_path) { | 429 const base::string16& key_path) { |
| 431 VLOG(1) << "Deleting registry key " << key_path; | 430 VLOG(1) << "Deleting registry key " << key_path; |
| 432 LONG result = ::SHDeleteKey(root_key, key_path.c_str()); | 431 LONG result = ::SHDeleteKey(root_key, key_path.c_str()); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 // Open the program and see if it references the expected file. | 609 // Open the program and see if it references the expected file. |
| 611 base::File file; | 610 base::File file; |
| 612 BY_HANDLE_FILE_INFORMATION info = {}; | 611 BY_HANDLE_FILE_INFORMATION info = {}; |
| 613 | 612 |
| 614 return (OpenForInfo(path, &file) && | 613 return (OpenForInfo(path, &file) && |
| 615 GetInfo(file, &info) && | 614 GetInfo(file, &info) && |
| 616 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && | 615 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && |
| 617 info.nFileIndexHigh == file_info_.nFileIndexHigh && | 616 info.nFileIndexHigh == file_info_.nFileIndexHigh && |
| 618 info.nFileIndexLow == file_info_.nFileIndexLow); | 617 info.nFileIndexLow == file_info_.nFileIndexLow); |
| 619 } | 618 } |
| OLD | NEW |