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 const FilePath maybe_product_dir(exe_path.DirName().DirName()); |
388 if (file_util::PathExists(exe_path.Append(installer::kChromeExe))) { | |
389 // DIR_EXE is most likely Chrome's directory in which case |exe_path| is | |
390 // the user-level sentinel path. | |
391 *path = exe_path; | |
392 } else if (file_util::PathExists( | |
393 maybe_product_dir.Append(installer::kChromeExe))) { | |
grt (UTC plus 2)
2013/01/03 17:48:58
nit: 4-space indent relative to file_util above
gab
2013/01/03 18:39:49
Done.
| |
394 // DIR_EXE can also be the Installer directory if this is called from a | |
395 // setup.exe running from Application\<version>\Installer (see | |
396 // InstallerState::GetInstallerDirectory) in which case Chrome's directory | |
397 // is two levels down. | |
grt (UTC plus 2)
2013/01/03 17:48:58
down -> up?
gab
2013/01/03 18:39:49
Done.
| |
398 *path = maybe_product_dir; | |
399 } else { | |
400 NOTREACHED(); | |
401 return false; | |
402 } | |
388 } else { | 403 } else { |
389 std::vector<FilePath> user_data_dir_paths; | 404 std::vector<FilePath> user_data_dir_paths; |
390 installer::GetChromeUserDataPaths(dist, &user_data_dir_paths); | 405 installer::GetChromeUserDataPaths(dist, &user_data_dir_paths); |
391 | 406 |
392 if (!user_data_dir_paths.empty()) | 407 if (!user_data_dir_paths.empty()) |
393 *path = user_data_dir_paths[0]; | 408 *path = user_data_dir_paths[0]; |
394 else | 409 else |
395 return false; | 410 return false; |
396 } | 411 } |
397 | 412 |
(...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. | 596 // Open the program and see if it references the expected file. |
582 base::win::ScopedHandle handle; | 597 base::win::ScopedHandle handle; |
583 BY_HANDLE_FILE_INFORMATION info = {}; | 598 BY_HANDLE_FILE_INFORMATION info = {}; |
584 | 599 |
585 return (OpenForInfo(program, &handle) && | 600 return (OpenForInfo(program, &handle) && |
586 GetInfo(handle, &info) && | 601 GetInfo(handle, &info) && |
587 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && | 602 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && |
588 info.nFileIndexHigh == file_info_.nFileIndexHigh && | 603 info.nFileIndexHigh == file_info_.nFileIndexHigh && |
589 info.nFileIndexLow == file_info_.nFileIndexLow); | 604 info.nFileIndexLow == file_info_.nFileIndexLow); |
590 } | 605 } |
OLD | NEW |