| 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/google_update_settings.h" | 5 #include "chrome/installer/util/google_update_settings.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { | 106 bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { |
| 107 DWORD value = consented? 1 : 0; | 107 DWORD value = consented? 1 : 0; |
| 108 // Writing to HKLM is only a best effort deal. | 108 // Writing to HKLM is only a best effort deal. |
| 109 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 109 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 110 std::wstring reg_path = dist->GetStateMediumKey(); | 110 std::wstring reg_path = dist->GetStateMediumKey(); |
| 111 RegKey key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ | KEY_WRITE); | 111 RegKey key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ | KEY_WRITE); |
| 112 key.WriteValue(google_update::kRegUsageStatsField, value); | 112 key.WriteValue(google_update::kRegUsageStatsField, value); |
| 113 // Writing to HKCU is used both by chrome and by the crash reporter. | 113 // Writing to HKCU is used both by chrome and by the crash reporter. |
| 114 reg_path = dist->GetStateKey(); | 114 reg_path = dist->GetStateKey(); |
| 115 key.Open(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE); | 115 key.Create(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE); |
| 116 return (key.WriteValue(google_update::kRegUsageStatsField, value) == | 116 return (key.WriteValue(google_update::kRegUsageStatsField, value) == |
| 117 ERROR_SUCCESS); | 117 ERROR_SUCCESS); |
| 118 } | 118 } |
| 119 | 119 |
| 120 bool GoogleUpdateSettings::GetMetricsId(std::wstring* metrics_id) { | 120 bool GoogleUpdateSettings::GetMetricsId(std::wstring* metrics_id) { |
| 121 return ReadGoogleUpdateStrKey(google_update::kRegMetricsId, metrics_id); | 121 return ReadGoogleUpdateStrKey(google_update::kRegMetricsId, metrics_id); |
| 122 } | 122 } |
| 123 | 123 |
| 124 bool GoogleUpdateSettings::SetMetricsId(const std::wstring& metrics_id) { | 124 bool GoogleUpdateSettings::SetMetricsId(const std::wstring& metrics_id) { |
| 125 return WriteGoogleUpdateStrKey(google_update::kRegMetricsId, metrics_id); | 125 return WriteGoogleUpdateStrKey(google_update::kRegMetricsId, metrics_id); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 }; | 359 }; |
| 360 const wchar_t** end = &kBrands[arraysize(kBrands)]; | 360 const wchar_t** end = &kBrands[arraysize(kBrands)]; |
| 361 const wchar_t** found = std::find(&kBrands[0], end, brand); | 361 const wchar_t** found = std::find(&kBrands[0], end, brand); |
| 362 if (found != end) | 362 if (found != end) |
| 363 return true; | 363 return true; |
| 364 if (StartsWith(brand, L"EUB", true) || StartsWith(brand, L"EUC", true) || | 364 if (StartsWith(brand, L"EUB", true) || StartsWith(brand, L"EUC", true) || |
| 365 StartsWith(brand, L"GGR", true)) | 365 StartsWith(brand, L"GGR", true)) |
| 366 return true; | 366 return true; |
| 367 return false; | 367 return false; |
| 368 } | 368 } |
| OLD | NEW |