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