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

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

Issue 1870003002: Convert //chrome/browser/safe_browsing from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and address comments Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 #ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_RESOURCE_REQUEST_DETECTO R_H_ 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_RESOURCE_REQUEST_DETECTO R_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_RESOURCE_REQUEST_DETECTO R_H_ 6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_RESOURCE_REQUEST_DETECTO R_H_
7 7
8 #include <memory>
9
8 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/safe_browsing/incident_reporting/incident_receiver.h" 13 #include "chrome/browser/safe_browsing/incident_reporting/incident_receiver.h"
13 #include "components/safe_browsing_db/database_manager.h" 14 #include "components/safe_browsing_db/database_manager.h"
14 15
15 namespace net { 16 namespace net {
16 class URLRequest; 17 class URLRequest;
17 } 18 }
18 19
19 namespace safe_browsing { 20 namespace safe_browsing {
20 21
21 class SafeBrowsingService; 22 class SafeBrowsingService;
22 23
23 class ClientIncidentReport_IncidentData_ResourceRequestIncident; 24 class ClientIncidentReport_IncidentData_ResourceRequestIncident;
24 25
25 // Observes network requests and reports suspicious activity. 26 // Observes network requests and reports suspicious activity.
26 class ResourceRequestDetector { 27 class ResourceRequestDetector {
27 public: 28 public:
28 ResourceRequestDetector( 29 ResourceRequestDetector(
29 scoped_refptr<SafeBrowsingDatabaseManager> sb_database_manager, 30 scoped_refptr<SafeBrowsingDatabaseManager> sb_database_manager,
30 scoped_ptr<IncidentReceiver> incident_receiver); 31 std::unique_ptr<IncidentReceiver> incident_receiver);
31 ~ResourceRequestDetector(); 32 ~ResourceRequestDetector();
32 33
33 // Analyzes the |request| and triggers an incident report on suspicious 34 // Analyzes the |request| and triggers an incident report on suspicious
34 // script inclusion. 35 // script inclusion.
35 void OnResourceRequest(const net::URLRequest* request); 36 void OnResourceRequest(const net::URLRequest* request);
36 37
37 protected: 38 protected:
38 // Testing hook. 39 // Testing hook.
39 void set_allow_null_profile_for_testing(bool allow_null_profile_for_testing); 40 void set_allow_null_profile_for_testing(bool allow_null_profile_for_testing);
40 41
41 private: 42 private:
42 void ReportIncidentOnUIThread( 43 void ReportIncidentOnUIThread(
43 int render_process_id, 44 int render_process_id,
44 int render_frame_id, 45 int render_frame_id,
45 scoped_ptr<ClientIncidentReport_IncidentData_ResourceRequestIncident> 46 std::unique_ptr<ClientIncidentReport_IncidentData_ResourceRequestIncident>
46 incident_data); 47 incident_data);
47 48
48 scoped_ptr<IncidentReceiver> incident_receiver_; 49 std::unique_ptr<IncidentReceiver> incident_receiver_;
49 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_; 50 scoped_refptr<SafeBrowsingDatabaseManager> database_manager_;
50 bool allow_null_profile_for_testing_; 51 bool allow_null_profile_for_testing_;
51 52
52 base::WeakPtrFactory<ResourceRequestDetector> weak_ptr_factory_; 53 base::WeakPtrFactory<ResourceRequestDetector> weak_ptr_factory_;
53 54
54 DISALLOW_COPY_AND_ASSIGN(ResourceRequestDetector); 55 DISALLOW_COPY_AND_ASSIGN(ResourceRequestDetector);
55 }; 56 };
56 57
57 } // namespace safe_browsing 58 } // namespace safe_browsing
58 59
59 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_RESOURCE_REQUEST_DETE CTOR_H_ 60 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_RESOURCE_REQUEST_DETE CTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698