Chromium Code Reviews| 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 RetrieveBlacklistedModules(std::vector<base::string16>* module_names) { | |
|
csharp
2014/08/05 21:08:59
std::vector<base::string16>* -> const std::vector<
robertshield
2014/08/06 16:38:32
As discussed, this is an out param and there's not
| |
| 213 DCHECK(module_names); | |
| 214 | |
| 215 bool module_found = false; | |
| 216 std::set<ModuleInfo> module_info; | |
| 217 if (GetLoadedModules(&module_info)) { | |
|
csharp
2014/08/05 21:08:59
Maybe have "if (!GetLoadedModules(&module_info)) r
robertshield
2014/08/06 16:38:32
Done.
| |
| 218 std::set<ModuleInfo>::const_iterator module_iter(module_info.begin()); | |
| 219 for (; module_iter != module_info.end(); ++module_iter) { | |
| 220 base::string16 module_file_name(StringToLowerASCII( | |
| 221 base::FilePath(module_iter->name).BaseName().value())); | |
| 222 int blacklist_index = | |
| 223 blacklist::GetBlacklistIndex(module_file_name.c_str()); | |
|
csharp
2014/08/05 21:08:59
Maybe just move this directly into the if statemen
robertshield
2014/08/06 16:38:32
Done.
| |
| 224 if (blacklist_index > -1) { | |
|
csharp
2014/08/05 21:08:59
why > and not !=?
robertshield
2014/08/06 16:38:32
Done.
| |
| 225 module_names->push_back(module_iter->name); | |
| 226 module_found = true; | |
| 227 } | |
| 228 } | |
| 229 } | |
| 230 | |
| 231 return module_found; | |
| 232 } | |
| OLD | NEW |