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

Unified Diff: chrome/browser/safe_browsing/incident_reporting/resource_request_detector.h

Issue 1024943002: Add domain request detection to incident reporting service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set default type to unknown Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/incident_reporting/resource_request_detector.h
diff --git a/chrome/browser/safe_browsing/incident_reporting/script_request_detector.h b/chrome/browser/safe_browsing/incident_reporting/resource_request_detector.h
similarity index 58%
rename from chrome/browser/safe_browsing/incident_reporting/script_request_detector.h
rename to chrome/browser/safe_browsing/incident_reporting/resource_request_detector.h
index f5e31f0654bb4c54683cb3947c4656985195e05f..6d3b5348188685f0f5357094816b61c092e51827 100644
--- a/chrome/browser/safe_browsing/incident_reporting/script_request_detector.h
+++ b/chrome/browser/safe_browsing/incident_reporting/resource_request_detector.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_SCRIPT_REQUEST_DETECTOR_H_
-#define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_SCRIPT_REQUEST_DETECTOR_H_
+#ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_RESOURCE_REQUEST_DETECTOR_H_
+#define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_RESOURCE_REQUEST_DETECTOR_H_
#include "base/containers/hash_tables.h"
#include "base/macros.h"
@@ -17,14 +17,14 @@ class URLRequest;
namespace safe_browsing {
-class ClientIncidentReport_IncidentData_ScriptRequestIncident;
+class ClientIncidentReport_IncidentData_ResourceRequestIncident;
// Observes network requests and reports suspicious activity.
-class ScriptRequestDetector {
+class ResourceRequestDetector {
public:
- explicit ScriptRequestDetector(
+ explicit ResourceRequestDetector(
scoped_ptr<IncidentReceiver> incident_receiver);
- ~ScriptRequestDetector();
+ ~ResourceRequestDetector();
// Analyzes the |request| and triggers an incident report on suspicious
// script inclusion.
@@ -35,23 +35,27 @@ class ScriptRequestDetector {
void set_allow_null_profile_for_testing(bool allow_null_profile_for_testing);
private:
- void InitializeScriptSet();
+ void InitializeHashSets();
+
+ void DetectDomainRequests(const net::URLRequest* request);
+ void DetectScriptRequests(const net::URLRequest* request);
void ReportIncidentOnUIThread(
int render_process_id,
int render_frame_id,
- scoped_ptr<ClientIncidentReport_IncidentData_ScriptRequestIncident>
+ scoped_ptr<ClientIncidentReport_IncidentData_ResourceRequestIncident>
incident_data);
scoped_ptr<IncidentReceiver> incident_receiver_;
base::hash_set<std::string> script_set_;
+ base::hash_set<std::string> domain_set_;
bool allow_null_profile_for_testing_;
- base::WeakPtrFactory<ScriptRequestDetector> weak_ptr_factory_;
+ base::WeakPtrFactory<ResourceRequestDetector> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(ScriptRequestDetector);
+ DISALLOW_COPY_AND_ASSIGN(ResourceRequestDetector);
};
} // namespace safe_browsing
-#endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_SCRIPT_REQUEST_DETECTOR_H_
+#endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_RESOURCE_REQUEST_DETECTOR_H_

Powered by Google App Engine
This is Rietveld 408576698