Chromium Code Reviews| 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 377 } | 377 } |
| 378 | 378 |
| 379 bool InstallUtil::GetSentinelFilePath(const FilePath::CharType* file, | 379 bool InstallUtil::GetSentinelFilePath(const FilePath::CharType* file, |
| 380 BrowserDistribution* dist, | 380 BrowserDistribution* dist, |
| 381 FilePath* path) { | 381 FilePath* path) { |
| 382 FilePath exe_path; | 382 FilePath exe_path; |
| 383 if (!PathService::Get(base::DIR_EXE, &exe_path)) | 383 if (!PathService::Get(base::DIR_EXE, &exe_path)) |
| 384 return false; | 384 return false; |
| 385 | 385 |
| 386 if (IsPerUserInstall(exe_path.value().c_str())) { | 386 if (IsPerUserInstall(exe_path.value().c_str())) { |
| 387 *path = exe_path; | 387 // On user installs, the sentinel file path is by chrome.exe. DIR_EXE |
| 388 // however is the directory of the current exe which could be another | |
| 389 // executable in the install hierarchy (e.g., setup.exe). | |
| 390 FilePath user_level_install_path( | |
|
grt (UTC plus 2)
2013/01/03 15:41:27
instead of requiring that the default install path
gab
2013/01/03 17:11:14
Fine, I was trying to avoid the assumption about b
| |
| 391 installer::GetChromeInstallPath(false, dist)); | |
| 392 if (user_level_install_path.IsParent(exe_path)) | |
| 393 *path = user_level_install_path; | |
| 394 else | |
| 395 *path = exe_path; | |
| 388 } else { | 396 } else { |
| 389 std::vector<FilePath> user_data_dir_paths; | 397 std::vector<FilePath> user_data_dir_paths; |
| 390 installer::GetChromeUserDataPaths(dist, &user_data_dir_paths); | 398 installer::GetChromeUserDataPaths(dist, &user_data_dir_paths); |
| 391 | 399 |
| 392 if (!user_data_dir_paths.empty()) | 400 if (!user_data_dir_paths.empty()) |
| 393 *path = user_data_dir_paths[0]; | 401 *path = user_data_dir_paths[0]; |
| 394 else | 402 else |
| 395 return false; | 403 return false; |
| 396 } | 404 } |
| 397 | 405 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 581 // Open the program and see if it references the expected file. | 589 // Open the program and see if it references the expected file. |
| 582 base::win::ScopedHandle handle; | 590 base::win::ScopedHandle handle; |
| 583 BY_HANDLE_FILE_INFORMATION info = {}; | 591 BY_HANDLE_FILE_INFORMATION info = {}; |
| 584 | 592 |
| 585 return (OpenForInfo(program, &handle) && | 593 return (OpenForInfo(program, &handle) && |
| 586 GetInfo(handle, &info) && | 594 GetInfo(handle, &info) && |
| 587 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && | 595 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && |
| 588 info.nFileIndexHigh == file_info_.nFileIndexHigh && | 596 info.nFileIndexHigh == file_info_.nFileIndexHigh && |
| 589 info.nFileIndexLow == file_info_.nFileIndexLow); | 597 info.nFileIndexLow == file_info_.nFileIndexLow); |
| 590 } | 598 } |
| OLD | NEW |