Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: chrome/browser/chrome_elf_init_win.cc

Issue 346763003: Adding blacklisted dlls to safe browsing incident reports. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@updatedWard2
Patch Set: rebasing again... Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/environment_data_collection_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Schedule another task to report all sucessful interceptions later. 102 // Schedule another task to report all sucessful interceptions later.
103 // This time delay should be long enough to catch any dlls that attempt to 103 // This time delay should be long enough to catch any dlls that attempt to
104 // inject after Chrome has started up. 104 // inject after Chrome has started up.
105 content::BrowserThread::PostDelayedTask( 105 content::BrowserThread::PostDelayedTask(
106 content::BrowserThread::UI, 106 content::BrowserThread::UI,
107 FROM_HERE, 107 FROM_HERE,
108 base::Bind(&ReportSuccessfulBlocks), 108 base::Bind(&ReportSuccessfulBlocks),
109 base::TimeDelta::FromSeconds(kBlacklistReportingDelaySec)); 109 base::TimeDelta::FromSeconds(kBlacklistReportingDelaySec));
110 } 110 }
111 111
112 // Note that running multiple chrome instances with distinct user data
113 // directories could lead to deletion (and/or replacement) of the finch
114 // blacklist registry data in one instance before the second has a chance to
115 // read those values.
112 void AddFinchBlacklistToRegistry() { 116 void AddFinchBlacklistToRegistry() {
113 base::win::RegKey finch_blacklist_registry_key( 117 base::win::RegKey finch_blacklist_registry_key(
114 HKEY_CURRENT_USER, blacklist::kRegistryFinchListPath, KEY_SET_VALUE); 118 HKEY_CURRENT_USER, blacklist::kRegistryFinchListPath, KEY_SET_VALUE);
115 119
116 // 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.
117 if (!finch_blacklist_registry_key.Valid()) 121 if (!finch_blacklist_registry_key.Valid())
118 return; 122 return;
119 123
124 // Delete and recreate the key to clear the registry.
125 finch_blacklist_registry_key.DeleteKey(L"");
126 finch_blacklist_registry_key.Create(
127 HKEY_CURRENT_USER, blacklist::kRegistryFinchListPath, KEY_SET_VALUE);
128
120 std::map<std::string, std::string> params; 129 std::map<std::string, std::string> params;
121 chrome_variations::GetVariationParams(kBrowserBlacklistTrialName, &params); 130 chrome_variations::GetVariationParams(kBrowserBlacklistTrialName, &params);
122 131
123 for (std::map<std::string, std::string>::iterator it = params.begin(); 132 for (std::map<std::string, std::string>::iterator it = params.begin();
124 it != params.end(); 133 it != params.end();
125 ++it) { 134 ++it) {
126 std::wstring name = base::UTF8ToWide(it->first); 135 std::wstring name = base::UTF8ToWide(it->first);
127 std::wstring val = base::UTF8ToWide(it->second); 136 std::wstring val = base::UTF8ToWide(it->second);
128 137
129 finch_blacklist_registry_key.WriteValue(name.c_str(), val.c_str()); 138 finch_blacklist_registry_key.WriteValue(name.c_str(), val.c_str());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 197
189 blacklist_registry_key.WriteValue(blacklist::kBeaconAttemptCount, 198 blacklist_registry_key.WriteValue(blacklist::kBeaconAttemptCount,
190 static_cast<DWORD>(0)); 199 static_cast<DWORD>(0));
191 200
192 // Only report the blacklist as getting setup when both registry writes 201 // Only report the blacklist as getting setup when both registry writes
193 // succeed, since otherwise the blacklist wasn't properly setup. 202 // succeed, since otherwise the blacklist wasn't properly setup.
194 if (set_version == ERROR_SUCCESS && set_state == ERROR_SUCCESS) 203 if (set_version == ERROR_SUCCESS && set_state == ERROR_SUCCESS)
195 RecordBlacklistSetupEvent(BLACKLIST_SETUP_ENABLED); 204 RecordBlacklistSetupEvent(BLACKLIST_SETUP_ENABLED);
196 } 205 }
197 } 206 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/environment_data_collection_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698