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/google_update_settings.h" | 5 #include "chrome/installer/util/google_update_settings.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
| 10 #include "base/base_paths_win.h" |
10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
14 #include "base/path_service.h" | |
15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "base/win/registry.h" | 20 #include "base/win/registry.h" |
21 #include "base/win/win_util.h" | 21 #include "base/win/win_util.h" |
22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/installer/util/app_registration_data.h" | 23 #include "chrome/installer/util/app_registration_data.h" |
24 #include "chrome/installer/util/browser_distribution.h" | 24 #include "chrome/installer/util/browser_distribution.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( | 208 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( |
209 BrowserDistribution::CHROME_BINARIES); | 209 BrowserDistribution::CHROME_BINARIES); |
210 return GoogleUpdateSettings::UpdateDidRunStateForApp( | 210 return GoogleUpdateSettings::UpdateDidRunStateForApp( |
211 dist->GetAppRegistrationData(), did_run); | 211 dist->GetAppRegistrationData(), did_run); |
212 } | 212 } |
213 | 213 |
214 } // namespace | 214 } // namespace |
215 | 215 |
216 bool GoogleUpdateSettings::IsSystemInstall() { | 216 bool GoogleUpdateSettings::IsSystemInstall() { |
217 bool system_install = false; | 217 bool system_install = false; |
218 base::FilePath module_dir; | 218 base::FilePath module_file; |
219 if (!PathService::Get(base::DIR_MODULE, &module_dir)) { | 219 // We don't use PathService here to be able to use this function very early in |
| 220 // startup. http://crbug.com/564398. |
| 221 if (!GetFileModule(&module_file)) { |
220 LOG(WARNING) | 222 LOG(WARNING) |
221 << "Failed to get directory of module; assuming per-user install."; | 223 << "Failed to get directory of module; assuming per-user install."; |
222 } else { | 224 } else { |
| 225 base::FilePath module_dir = module_file.DirName(); |
223 system_install = !InstallUtil::IsPerUserInstall(module_dir); | 226 system_install = !InstallUtil::IsPerUserInstall(module_dir); |
224 } | 227 } |
225 return system_install; | 228 return system_install; |
226 } | 229 } |
227 | 230 |
228 bool GoogleUpdateSettings::GetCollectStatsConsent() { | 231 bool GoogleUpdateSettings::GetCollectStatsConsent() { |
229 return GetCollectStatsConsentAtLevel(IsSystemInstall()); | 232 return GetCollectStatsConsentAtLevel(IsSystemInstall()); |
230 } | 233 } |
231 | 234 |
232 // Older versions of Chrome unconditionally read from HKCU\...\ClientState\... | 235 // Older versions of Chrome unconditionally read from HKCU\...\ClientState\... |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 } | 972 } |
970 | 973 |
971 // If the key or value was not present, return the empty string. | 974 // If the key or value was not present, return the empty string. |
972 if (result == ERROR_FILE_NOT_FOUND || result == ERROR_PATH_NOT_FOUND) { | 975 if (result == ERROR_FILE_NOT_FOUND || result == ERROR_PATH_NOT_FOUND) { |
973 experiment_labels->clear(); | 976 experiment_labels->clear(); |
974 return true; | 977 return true; |
975 } | 978 } |
976 | 979 |
977 return result == ERROR_SUCCESS; | 980 return result == ERROR_SUCCESS; |
978 } | 981 } |
OLD | NEW |