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 042f3d1a4063383134df0cf06f5f238598af6837..4f9501686e344c425cea74ca9d554f696af3bcfa 100644 |
| --- a/chrome/browser/chrome_elf_init_win.cc |
| +++ b/chrome/browser/chrome_elf_init_win.cc |
| @@ -12,11 +12,13 @@ |
| #include "chrome_elf/blacklist/blacklist.h" |
| #include "chrome_elf/chrome_elf_constants.h" |
| #include "chrome_elf/dll_hash/dll_hash.h" |
| +#include "components/variations/variations_associated_data.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "version.h" // NOLINT |
| const char kBrowserBlacklistTrialName[] = "BrowserBlacklist"; |
| const char kBrowserBlacklistTrialDisabledGroupName[] = "NoBlacklist"; |
| +const char kBrowserBlacklistTrialEnabledGroupName[] = "Enabled"; |
|
csharp
2014/05/29 20:51:52
Seems to be unused, remove?
krstnmnlsn
2014/05/30 14:09:13
Done.
|
| namespace { |
| @@ -87,6 +89,7 @@ void InitializeChromeElf() { |
| base::win::RegKey blacklist_registry_key(HKEY_CURRENT_USER); |
| blacklist_registry_key.DeleteKey(blacklist::kRegistryBeaconPath); |
| } else { |
| + AddFinchBlacklistToRegistry(); |
| BrowserBlacklistBeaconSetup(); |
| } |
| @@ -103,6 +106,38 @@ void InitializeChromeElf() { |
| base::TimeDelta::FromSeconds(kBlacklistReportingDelaySec)); |
| } |
| +void AddFinchBlacklistToRegistry() { |
| + std::map<std::string, std::string> params; |
| + if (chrome_variations::GetVariationParams(kBrowserBlacklistTrialName, |
| + ¶ms)) { |
| + base::win::RegKey finch_blacklist_registry_key(HKEY_CURRENT_USER, |
|
csharp
2014/05/29 20:51:52
Incorrect indent (same for the following two lines
krstnmnlsn
2014/05/30 14:09:13
Done.
|
| + blacklist::kRegistryFinchListPath, |
| + KEY_QUERY_VALUE | KEY_SET_VALUE); |
| + |
| + // No point in trying to continue if the registry key isn't valid. |
|
csharp
2014/05/29 20:51:52
Should be indented 2 more spaces
krstnmnlsn
2014/05/30 14:09:13
Done.
|
| + if (!finch_blacklist_registry_key.Valid()) |
| + return; |
| + |
| + std::map<std::string, std::string>::iterator it = params.begin(); |
| + while (it != params.end()) { |
| + const char* name_str = (it->first).c_str(); |
|
csharp
2014/05/29 20:51:52
The converting can be done with:
std::wstring wide
krstnmnlsn
2014/05/30 14:09:13
this is great!
|
| + const char* val_str = (it->second).c_str(); |
| + size_t name_len = MultiByteToWideChar(CP_UTF8, 0, name_str, -1, NULL, 0); |
| + size_t val_len = MultiByteToWideChar(CP_UTF8, 0, val_str, -1, NULL, 0); |
| + wchar_t* name = new wchar_t[name_len]; |
| + wchar_t* val = new wchar_t[val_len]; |
| + MultiByteToWideChar(CP_UTF8, 0, name_str, -1, name, name_len); |
| + MultiByteToWideChar(CP_UTF8, 0, val_str, -1, val, val_len); |
| + finch_blacklist_registry_key.WriteValue(name, val); |
| + |
| + delete[] name; |
| + delete[] val; |
| + |
| + ++it; |
| + } |
| + } |
| +} |
| + |
| void BrowserBlacklistBeaconSetup() { |
| base::win::RegKey blacklist_registry_key(HKEY_CURRENT_USER, |
| blacklist::kRegistryBeaconPath, |