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/files/file_path.h" | |
7 #include "base/metrics/field_trial.h" | 6 #include "base/metrics/field_trial.h" |
8 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
9 #include "base/metrics/sparse_histogram.h" | 8 #include "base/metrics/sparse_histogram.h" |
10 #include "base/strings/string_util.h" | |
11 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
12 #include "base/win/registry.h" | 10 #include "base/win/registry.h" |
13 #include "chrome/browser/chrome_elf_init_win.h" | 11 #include "chrome/browser/chrome_elf_init_win.h" |
14 #include "chrome/browser/install_verification/win/module_info.h" | |
15 #include "chrome/browser/install_verification/win/module_verification_common.h" | |
16 #include "chrome_elf/blacklist/blacklist.h" | 12 #include "chrome_elf/blacklist/blacklist.h" |
17 #include "chrome_elf/chrome_elf_constants.h" | 13 #include "chrome_elf/chrome_elf_constants.h" |
18 #include "chrome_elf/dll_hash/dll_hash.h" | 14 #include "chrome_elf/dll_hash/dll_hash.h" |
19 #include "components/variations/variations_associated_data.h" | 15 #include "components/variations/variations_associated_data.h" |
20 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
21 #include "version.h" // NOLINT | 17 #include "version.h" // NOLINT |
22 | 18 |
23 const char kBrowserBlacklistTrialName[] = "BrowserBlacklist"; | 19 const char kBrowserBlacklistTrialName[] = "BrowserBlacklist"; |
24 const char kBrowserBlacklistTrialDisabledGroupName[] = "NoBlacklist"; | 20 const char kBrowserBlacklistTrialDisabledGroupName[] = "NoBlacklist"; |
25 | 21 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 197 |
202 blacklist_registry_key.WriteValue(blacklist::kBeaconAttemptCount, | 198 blacklist_registry_key.WriteValue(blacklist::kBeaconAttemptCount, |
203 static_cast<DWORD>(0)); | 199 static_cast<DWORD>(0)); |
204 | 200 |
205 // Only report the blacklist as getting setup when both registry writes | 201 // Only report the blacklist as getting setup when both registry writes |
206 // succeed, since otherwise the blacklist wasn't properly setup. | 202 // succeed, since otherwise the blacklist wasn't properly setup. |
207 if (set_version == ERROR_SUCCESS && set_state == ERROR_SUCCESS) | 203 if (set_version == ERROR_SUCCESS && set_state == ERROR_SUCCESS) |
208 RecordBlacklistSetupEvent(BLACKLIST_SETUP_ENABLED); | 204 RecordBlacklistSetupEvent(BLACKLIST_SETUP_ENABLED); |
209 } | 205 } |
210 } | 206 } |
211 | |
212 bool GetLoadedBlacklistedModules(std::vector<base::string16>* module_names) { | |
213 DCHECK(module_names); | |
214 | |
215 std::set<ModuleInfo> module_info_set; | |
216 if (!GetLoadedModules(&module_info_set)) | |
217 return false; | |
218 | |
219 std::set<ModuleInfo>::const_iterator module_iter(module_info_set.begin()); | |
220 for (; module_iter != module_info_set.end(); ++module_iter) { | |
221 base::string16 module_file_name(base::StringToLowerASCII( | |
222 base::FilePath(module_iter->name).BaseName().value())); | |
223 if (blacklist::GetBlacklistIndex(module_file_name.c_str()) != -1) { | |
224 module_names->push_back(module_iter->name); | |
225 } | |
226 } | |
227 | |
228 return true; | |
229 } | |
OLD | NEW |