OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_MODULE_LOAD_ANALYZER_H_ |
| 6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_MODULE_LOAD_ANALYZER_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/feature_list.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/strings/string16.h" |
| 15 #include "components/safe_browsing_db/database_manager.h" |
| 16 |
| 17 namespace safe_browsing { |
| 18 |
| 19 class IncidentReceiver; |
| 20 |
| 21 #if defined(OS_WIN) |
| 22 extern const base::Feature kIncidentReportingModuleLoadAnalysis; |
| 23 #endif // defined(OS_WIN) |
| 24 |
| 25 class ModuleLoadAnalyzer { |
| 26 public: |
| 27 // Constructs an ModuleLoadAnalyzer which will use |database_manager| |
| 28 // over the course of its lifetime. The ModuleLoadAnalyzer will check for |
| 29 // suspicious modules loaded in Chrome. |
| 30 explicit ModuleLoadAnalyzer( |
| 31 const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager); |
| 32 ~ModuleLoadAnalyzer(); |
| 33 |
| 34 // Callback to pass to the incident reporting service. The incident reporting |
| 35 // service will decide when to start the analysis. Visible for testing. |
| 36 void VerifyModuleLoadState(scoped_ptr<IncidentReceiver> incident_receiver); |
| 37 |
| 38 private: |
| 39 // Returns the names of suspicious modules that are loaded in the process. |
| 40 void GetLoadedSuspiciousModulesOnIOThread(); |
| 41 |
| 42 // Creates and reports |SuspiciousModuleIncident| to the incident_receiver_. |
| 43 void ReportIncidentsForSuspiciousModules( |
| 44 scoped_ptr<std::set<base::string16>> module_names); |
| 45 |
| 46 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_; |
| 47 scoped_ptr<IncidentReceiver> incident_receiver_; |
| 48 bool abort_reporting_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(ModuleLoadAnalyzer); |
| 51 }; |
| 52 |
| 53 } // namespace safe_browsing |
| 54 |
| 55 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_MODULE_LOAD_ANALYZER_
H_ |
OLD | NEW |