Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
|
grt (UTC plus 2)
2015/01/28 14:49:05
So this is the new year? I don't feel any differen
robertshield
2015/01/28 22:20:32
I find your assumption that I too am bound to the
| |
| 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/callback.h" | |
|
grt (UTC plus 2)
2015/01/28 14:49:05
unused?
robertshield
2015/01/28 22:20:32
Done.
| |
| 9 #include "base/containers/hash_tables.h" | |
| 10 #include "base/macros.h" | |
| 11 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser vice.h" | |
| 12 #include "chrome/common/safe_browsing/csd.pb.h" | |
|
grt (UTC plus 2)
2015/01/28 14:49:05
replace this with a forward decl of ClientIncident
robertshield
2015/01/28 22:20:33
Done.
| |
| 13 #include "content/public/common/resource_type.h" | |
|
grt (UTC plus 2)
2015/01/28 14:49:05
unused?
robertshield
2015/01/28 22:20:33
Done.
| |
| 14 | |
| 15 namespace net { | |
| 16 class URLRequest; | |
| 17 } | |
| 18 | |
| 19 namespace safe_browsing { | |
| 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); | |
|
grt (UTC plus 2)
2015/01/28 14:49:05
Passing in a ptr to the service defeats the whole
robertshield
2015/01/28 22:20:33
Agreed, at the same time with the current API this
grt (UTC plus 2)
2015/01/30 16:15:23
The more I think about it, the less comfortable I
robertshield
2015/02/01 04:25:57
Sure, happy to merge either way, let me know.
grt (UTC plus 2)
2015/02/02 18:45:22
The latest work-in-progress is out for review here
robertshield
2015/02/06 02:47:47
Rebased on top of the latest hotness.
| |
| 27 virtual ~ScriptRequestDetector(); | |
| 28 | |
| 29 // Analyzes the |request| and triggers an incident report on suspicious | |
| 30 // script inclusion. | |
| 31 void OnResourceRequest(const net::URLRequest* request); | |
| 32 | |
| 33 // Add a custom script hash. Used only for testing. | |
| 34 void AddScriptHashForTesting(const std::string& raw_hash); | |
|
grt (UTC plus 2)
2015/01/28 14:49:05
unused
robertshield
2015/01/28 22:20:32
Done.
grt (UTC plus 2)
2015/01/30 16:15:23
Hard to kill, it seems.
robertshield
2015/02/01 04:26:00
Huh, I stabbed it repeatedly this time.
| |
| 35 | |
| 36 // Add a custom script hash. Used only for testing. | |
| 37 bool ContainsScriptHashForTesting(const std::string& raw_hash); | |
|
grt (UTC plus 2)
2015/01/28 14:49:05
unused
robertshield
2015/01/28 22:20:33
Done.
grt (UTC plus 2)
2015/01/30 16:15:23
I don't think this word means what you think it me
robertshield
2015/02/01 04:25:57
It would seem I fell victim to one of the classic
| |
| 38 | |
| 39 protected: | |
| 40 // Testing hook. | |
| 41 virtual bool AllowNullProfileForTesting(); | |
|
grt (UTC plus 2)
2015/01/28 14:49:05
interesting. gab@ chose to do GetProfileForRenderP
robertshield
2015/01/28 22:20:32
Interesting, I don't believe one is better than th
grt (UTC plus 2)
2015/01/30 16:15:23
How do you feel about getting rid of virtual dispa
robertshield
2015/02/01 04:25:59
Equally ok. I am chronically unopinionated about s
| |
| 42 | |
| 43 private: | |
| 44 void InitializeScriptSet(); | |
| 45 | |
| 46 void ReportIncidentOnUIThread( | |
| 47 int render_process_id, | |
| 48 scoped_ptr<ClientIncidentReport_IncidentData_ScriptRequestIncident> | |
| 49 incident_data); | |
| 50 | |
| 51 IncidentReportingService* incident_reporting_service_; | |
| 52 base::hash_set<std::string> script_set_; | |
| 53 | |
| 54 base::WeakPtrFactory<ScriptRequestDetector> weak_ptr_factory_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(ScriptRequestDetector); | |
| 57 }; | |
| 58 | |
| 59 } // namespace safe_browsing | |
| 60 | |
| 61 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_SCRIPT_REQUEST_DETECT OR_H_ | |
| OLD | NEW |