| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/installer/util/package.h" | 5 #include "chrome/installer/util/package.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/win/registry.h" | 9 #include "base/win/registry.h" |
| 10 #include "chrome/installer/util/delete_tree_work_item.h" | 10 #include "chrome/installer/util/delete_tree_work_item.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 if (!products_.size()) { | 51 if (!products_.size()) { |
| 52 NOTREACHED() << "this should not be possible"; | 52 NOTREACHED() << "this should not be possible"; |
| 53 return false; | 53 return false; |
| 54 } | 54 } |
| 55 return products_[0]->system_level(); | 55 return products_[0]->system_level(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 FilePath Package::GetInstallerDirectory( | 58 FilePath Package::GetInstallerDirectory( |
| 59 const Version& version) const { | 59 const Version& version) const { |
| 60 return path_.Append(version.GetString()) | 60 return path_.Append(version.GetString()) |
| 61 .Append(installer_util::kInstallerDir); | 61 .Append(installer::kInstallerDir); |
| 62 } | 62 } |
| 63 | 63 |
| 64 Version* Package::GetCurrentVersion() const { | 64 Version* Package::GetCurrentVersion() const { |
| 65 scoped_ptr<Version> current_version; | 65 scoped_ptr<Version> current_version; |
| 66 // Be aware that there might be a pending "new_chrome.exe" already in the | 66 // Be aware that there might be a pending "new_chrome.exe" already in the |
| 67 // installation path. | 67 // installation path. |
| 68 FilePath new_chrome_exe(path_.Append(installer_util::kChromeNewExe)); | 68 FilePath new_chrome_exe(path_.Append(installer::kChromeNewExe)); |
| 69 bool new_chrome_exists = file_util::PathExists(new_chrome_exe); | 69 bool new_chrome_exists = file_util::PathExists(new_chrome_exe); |
| 70 | 70 |
| 71 for (size_t i = 0; i < products_.size(); ++i) { | 71 for (size_t i = 0; i < products_.size(); ++i) { |
| 72 const Product* product = products_[i]; | 72 const Product* product = products_[i]; |
| 73 HKEY root = product->system_level() ? HKEY_LOCAL_MACHINE : | 73 HKEY root = product->system_level() ? HKEY_LOCAL_MACHINE : |
| 74 HKEY_CURRENT_USER; | 74 HKEY_CURRENT_USER; |
| 75 RegKey chrome_key(root, product->distribution()->GetVersionKey().c_str(), | 75 RegKey chrome_key(root, product->distribution()->GetVersionKey().c_str(), |
| 76 KEY_READ); | 76 KEY_READ); |
| 77 std::wstring version; | 77 std::wstring version; |
| 78 if (new_chrome_exists) | 78 if (new_chrome_exists) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 ret = FindNextFile(file_handle, &find_file_data); | 149 ret = FindNextFile(file_handle, &find_file_data); |
| 150 } | 150 } |
| 151 | 151 |
| 152 FindClose(file_handle); | 152 FindClose(file_handle); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace installer | 155 } // namespace installer |
| 156 | 156 |
| OLD | NEW |