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

Side by Side Diff: chrome/browser/safe_browsing/incident_reporting/script_request_detector.h

Issue 845663004: Initial script request detector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix initializer order. Created 5 years, 10 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
OLDNEW
(Empty)
1 // Copyright 2015 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_SCRIPT_REQUEST_DETECTOR_ H_
6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_SCRIPT_REQUEST_DETECTOR_ H_
7
8 #include "base/containers/hash_tables.h"
9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h"
11
12 namespace net {
13 class URLRequest;
14 }
15
16 namespace safe_browsing {
17
18 class ClientIncidentReport_IncidentData_ScriptRequestIncident;
19 class IncidentReportingService;
20
21 // Observes network requests and reports suspicious activity.
22 class ScriptRequestDetector {
23 public:
24 // |incident_reporting_service| MUST outlive this class.
25 explicit ScriptRequestDetector(
26 IncidentReportingService* incident_reporting_service);
27 virtual ~ScriptRequestDetector();
grt (UTC plus 2) 2015/02/02 18:45:22 can this be made non-virtual now?
robertshield 2015/02/06 02:47:47 Done.
28
29 // Analyzes the |request| and triggers an incident report on suspicious
30 // script inclusion.
31 void OnResourceRequest(const net::URLRequest* request);
32
33 protected:
34 // Testing hook.
35 void set_allow_null_profile_for_testing(bool allow_null_profile_for_testing);
36
37 private:
38 void InitializeScriptSet();
39
40 void ReportIncidentOnUIThread(
41 int render_process_id,
42 int render_frame_id,
43 scoped_ptr<ClientIncidentReport_IncidentData_ScriptRequestIncident>
44 incident_data);
45
46 IncidentReportingService* incident_reporting_service_;
47 base::hash_set<std::string> script_set_;
48 bool allow_null_profile_for_testing_;
49
50 base::WeakPtrFactory<ScriptRequestDetector> weak_ptr_factory_;
51
52 DISALLOW_COPY_AND_ASSIGN(ScriptRequestDetector);
53 };
54
55 } // namespace safe_browsing
56
57 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_SCRIPT_REQUEST_DETECT OR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698