| 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 #include "chrome/installer/util/helper.h" | 5 #include "chrome/installer/util/helper.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | |
| 8 #include "base/logging.h" | |
| 9 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 10 #include "chrome/installer/util/browser_distribution.h" | 8 #include "chrome/installer/util/browser_distribution.h" |
| 11 #include "chrome/installer/util/install_util.h" | |
| 12 #include "chrome/installer/util/installation_state.h" | |
| 13 #include "chrome/installer/util/util_constants.h" | 9 #include "chrome/installer/util/util_constants.h" |
| 14 | 10 |
| 15 namespace installer { | 11 namespace installer { |
| 16 | 12 |
| 17 base::FilePath GetChromeInstallPath(bool system_install, | 13 base::FilePath GetChromeInstallPath(bool system_install, |
| 18 BrowserDistribution* dist) { | 14 BrowserDistribution* dist) { |
| 19 base::FilePath install_path; | 15 base::FilePath install_path; |
| 20 #if defined(_WIN64) | 16 #if defined(_WIN64) |
| 21 // TODO(wfh): Place Chrome binaries into DIR_PROGRAM_FILESX86 until the code | 17 // TODO(wfh): Place Chrome binaries into DIR_PROGRAM_FILESX86 until the code |
| 22 // to support moving the binaries is added. | 18 // to support moving the binaries is added. |
| 23 int key = | 19 int key = |
| 24 system_install ? base::DIR_PROGRAM_FILESX86 : base::DIR_LOCAL_APP_DATA; | 20 system_install ? base::DIR_PROGRAM_FILESX86 : base::DIR_LOCAL_APP_DATA; |
| 25 #else | 21 #else |
| 26 int key = system_install ? base::DIR_PROGRAM_FILES : base::DIR_LOCAL_APP_DATA; | 22 int key = system_install ? base::DIR_PROGRAM_FILES : base::DIR_LOCAL_APP_DATA; |
| 27 #endif | 23 #endif |
| 28 if (PathService::Get(key, &install_path)) { | 24 if (PathService::Get(key, &install_path)) { |
| 29 install_path = install_path.Append(dist->GetInstallSubDir()); | 25 install_path = install_path.Append(dist->GetInstallSubDir()); |
| 30 install_path = install_path.Append(kInstallBinaryDir); | 26 install_path = install_path.Append(kInstallBinaryDir); |
| 31 } | 27 } |
| 32 return install_path; | 28 return install_path; |
| 33 } | 29 } |
| 34 | 30 |
| 35 BrowserDistribution* GetBinariesDistribution(bool system_install) { | |
| 36 ProductState state; | |
| 37 | |
| 38 // If we're part of a multi-install, we need to poll using the multi-installer | |
| 39 // package's app guid rather than the browser's. If we can't read the app's | |
| 40 // state from the registry, assume it isn't multi-installed. | |
| 41 if (!state.Initialize(system_install) || !state.is_multi_install()) | |
| 42 return BrowserDistribution::GetDistribution(); | |
| 43 return BrowserDistribution::GetSpecificDistribution( | |
| 44 BrowserDistribution::CHROME_BINARIES); | |
| 45 } | |
| 46 | |
| 47 std::wstring GetAppGuidForUpdates(bool system_install) { | |
| 48 return GetBinariesDistribution(system_install)->GetAppGuid(); | |
| 49 } | |
| 50 | |
| 51 } // namespace installer. | 31 } // namespace installer. |
| OLD | NEW |