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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
11 #include "chrome/common/chrome_constants.h" | 11 #include "chrome/common/chrome_constants.h" |
12 #include "chrome/installer/util/browser_distribution.h" | 12 #include "chrome/installer/util/browser_distribution.h" |
13 #include "chrome/installer/util/installation_state.h" | 13 #include "chrome/installer/util/installation_state.h" |
14 #include "chrome/installer/util/install_util.h" | 14 #include "chrome/installer/util/install_util.h" |
15 #include "chrome/installer/util/util_constants.h" | 15 #include "chrome/installer/util/util_constants.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 FilePath GetChromeInstallBasePath(bool system, | 19 base::FilePath GetChromeInstallBasePath(bool system, |
20 BrowserDistribution* distribution, | 20 BrowserDistribution* distribution, |
21 const wchar_t* sub_path) { | 21 const wchar_t* sub_path) { |
22 base::FilePath install_path; | 22 base::FilePath install_path; |
23 if (system) { | 23 if (system) { |
24 PathService::Get(base::DIR_PROGRAM_FILES, &install_path); | 24 PathService::Get(base::DIR_PROGRAM_FILES, &install_path); |
25 } else { | 25 } else { |
26 PathService::Get(base::DIR_LOCAL_APP_DATA, &install_path); | 26 PathService::Get(base::DIR_LOCAL_APP_DATA, &install_path); |
27 } | 27 } |
28 | 28 |
29 if (!install_path.empty()) { | 29 if (!install_path.empty()) { |
30 install_path = install_path.Append(distribution->GetInstallSubDir()); | 30 install_path = install_path.Append(distribution->GetInstallSubDir()); |
31 install_path = install_path.Append(sub_path); | 31 install_path = install_path.Append(sub_path); |
32 } | 32 } |
33 | 33 |
34 return install_path; | 34 return install_path; |
35 } | 35 } |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 namespace installer { | 39 namespace installer { |
40 | 40 |
41 FilePath GetChromeInstallPath(bool system_install, BrowserDistribution* dist) { | 41 base::FilePath GetChromeInstallPath(bool system_install, |
| 42 BrowserDistribution* dist) { |
42 return GetChromeInstallBasePath(system_install, dist, kInstallBinaryDir); | 43 return GetChromeInstallBasePath(system_install, dist, kInstallBinaryDir); |
43 } | 44 } |
44 | 45 |
45 void GetChromeUserDataPaths(BrowserDistribution* dist, | 46 void GetChromeUserDataPaths(BrowserDistribution* dist, |
46 std::vector<base::FilePath>* paths) { | 47 std::vector<base::FilePath>* paths) { |
47 const bool has_metro_data = dist->CanSetAsDefault() && | 48 const bool has_metro_data = dist->CanSetAsDefault() && |
48 base::win::GetVersion() >= base::win::VERSION_WIN8; | 49 base::win::GetVersion() >= base::win::VERSION_WIN8; |
49 base::FilePath data_dir(GetChromeInstallBasePath(false, dist, | 50 base::FilePath data_dir(GetChromeInstallBasePath(false, dist, |
50 kInstallUserDataDir)); | 51 kInstallUserDataDir)); |
51 if (data_dir.empty()) { | 52 if (data_dir.empty()) { |
(...skipping 23 matching lines...) Expand all Loading... |
75 } else { | 76 } else { |
76 return dist; | 77 return dist; |
77 } | 78 } |
78 } | 79 } |
79 | 80 |
80 std::wstring GetAppGuidForUpdates(bool system_install) { | 81 std::wstring GetAppGuidForUpdates(bool system_install) { |
81 return GetBinariesDistribution(system_install)->GetAppGuid(); | 82 return GetBinariesDistribution(system_install)->GetAppGuid(); |
82 } | 83 } |
83 | 84 |
84 } // namespace installer. | 85 } // namespace installer. |
OLD | NEW |