Chromium Code Reviews| Index: chrome/browser/chrome_elf_init_win.cc |
| diff --git a/chrome/browser/chrome_elf_init_win.cc b/chrome/browser/chrome_elf_init_win.cc |
| index c400196fc056a18d137bfdc847f35995457a9929..32decd01bf13d02fc3b1f8ebe6033cdf92000403 100644 |
| --- a/chrome/browser/chrome_elf_init_win.cc |
| +++ b/chrome/browser/chrome_elf_init_win.cc |
| @@ -129,16 +129,23 @@ void AddFinchBlacklistToRegistry() { |
| HKEY_CURRENT_USER, blacklist::kRegistryFinchListPath, KEY_SET_VALUE); |
| std::map<std::string, std::string> params; |
| - variations::GetVariationParams(kBrowserBlacklistTrialName, ¶ms); |
| - |
| - for (std::map<std::string, std::string>::iterator it = params.begin(); |
| - it != params.end(); |
| - ++it) { |
| - std::wstring name = base::UTF8ToWide(it->first); |
| - std::wstring val = base::UTF8ToWide(it->second); |
| - |
| - finch_blacklist_registry_key.WriteValue(name.c_str(), val.c_str()); |
| - } |
| + std::string value = variations::GetVariationParamValue( |
| + kBrowserBlacklistTrialName, blacklist::kRegistryFinchListValueNameStr); |
| + if (value.empty()) |
| + return; |
| + std::wstring value_wcs = base::UTF8ToWide(value); |
|
robertshield
2016/04/20 05:16:09
prefer base::string16
penny
2016/05/28 01:34:22
Done. This base API explicitly returns a std::wst
|
| + |
| + // The dll names are comma-separated in this param value. We need to turn |
| + // this into REG_MULTI_SZ format (double-null terminates). |
| + // Note that the strings are wide character in registry. |
| + std::vector<wchar_t> reg_buffer(value_wcs.begin(), value_wcs.end()); |
|
robertshield
2016/04/20 05:16:09
I'm not sure you need to copy the dll names here.
penny
2016/05/28 01:34:22
Done. TIL! I didn't know you could embed null ch
|
| + reg_buffer.push_back(L'\0'); |
| + reg_buffer.push_back(L'\0'); |
| + std::replace(reg_buffer.begin(), reg_buffer.end(), L',', L'\0'); |
| + |
| + finch_blacklist_registry_key.WriteValue( |
| + blacklist::kRegistryFinchListValueName, reg_buffer.data(), |
| + (reg_buffer.size() * sizeof(wchar_t)), REG_MULTI_SZ); |
| } |
| void BrowserBlacklistBeaconSetup() { |