OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/metrics/field_trial.h" | 6 #include "base/metrics/field_trial.h" |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/metrics/sparse_histogram.h" | 8 #include "base/metrics/sparse_histogram.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/win/registry.h" | 10 #include "base/win/registry.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // No point in trying to continue if the registry key isn't valid. | 120 // No point in trying to continue if the registry key isn't valid. |
121 if (!finch_blacklist_registry_key.Valid()) | 121 if (!finch_blacklist_registry_key.Valid()) |
122 return; | 122 return; |
123 | 123 |
124 // Delete and recreate the key to clear the registry. | 124 // Delete and recreate the key to clear the registry. |
125 finch_blacklist_registry_key.DeleteKey(L""); | 125 finch_blacklist_registry_key.DeleteKey(L""); |
126 finch_blacklist_registry_key.Create( | 126 finch_blacklist_registry_key.Create( |
127 HKEY_CURRENT_USER, blacklist::kRegistryFinchListPath, KEY_SET_VALUE); | 127 HKEY_CURRENT_USER, blacklist::kRegistryFinchListPath, KEY_SET_VALUE); |
128 | 128 |
129 std::map<std::string, std::string> params; | 129 std::map<std::string, std::string> params; |
130 chrome_variations::GetVariationParams(kBrowserBlacklistTrialName, ¶ms); | 130 variations::GetVariationParams(kBrowserBlacklistTrialName, ¶ms); |
131 | 131 |
132 for (std::map<std::string, std::string>::iterator it = params.begin(); | 132 for (std::map<std::string, std::string>::iterator it = params.begin(); |
133 it != params.end(); | 133 it != params.end(); |
134 ++it) { | 134 ++it) { |
135 std::wstring name = base::UTF8ToWide(it->first); | 135 std::wstring name = base::UTF8ToWide(it->first); |
136 std::wstring val = base::UTF8ToWide(it->second); | 136 std::wstring val = base::UTF8ToWide(it->second); |
137 | 137 |
138 finch_blacklist_registry_key.WriteValue(name.c_str(), val.c_str()); | 138 finch_blacklist_registry_key.WriteValue(name.c_str(), val.c_str()); |
139 } | 139 } |
140 } | 140 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 197 |
198 blacklist_registry_key.WriteValue(blacklist::kBeaconAttemptCount, | 198 blacklist_registry_key.WriteValue(blacklist::kBeaconAttemptCount, |
199 static_cast<DWORD>(0)); | 199 static_cast<DWORD>(0)); |
200 | 200 |
201 // Only report the blacklist as getting setup when both registry writes | 201 // Only report the blacklist as getting setup when both registry writes |
202 // succeed, since otherwise the blacklist wasn't properly setup. | 202 // succeed, since otherwise the blacklist wasn't properly setup. |
203 if (set_version == ERROR_SUCCESS && set_state == ERROR_SUCCESS) | 203 if (set_version == ERROR_SUCCESS && set_state == ERROR_SUCCESS) |
204 RecordBlacklistSetupEvent(BLACKLIST_SETUP_ENABLED); | 204 RecordBlacklistSetupEvent(BLACKLIST_SETUP_ENABLED); |
205 } | 205 } |
206 } | 206 } |
OLD | NEW |