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

Side by Side Diff: chrome/browser/safe_browsing/client_side_detection_service.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Helper class which handles communication with the SafeBrowsing backends for 5 // Helper class which handles communication with the SafeBrowsing backends for
6 // client-side phishing detection. This class is used to fetch the client-side 6 // client-side phishing detection. This class is used to fetch the client-side
7 // model and send it to all renderers. This class is also used to send a ping 7 // model and send it to all renderers. This class is also used to send a ping
8 // back to Google to verify if a particular site is really phishing or not. 8 // back to Google to verify if a particular site is really phishing or not.
9 // 9 //
10 // This class is not thread-safe and expects all calls to be made on the UI 10 // This class is not thread-safe and expects all calls to be made on the UI
11 // thread. We also expect that the calling thread runs a message loop. 11 // thread. We also expect that the calling thread runs a message loop.
12 12
13 #ifndef CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_ 13 #ifndef CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_
14 #define CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_ 14 #define CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_
15 15
16 #include <map> 16 #include <map>
17 #include <memory>
17 #include <queue> 18 #include <queue>
18 #include <set> 19 #include <set>
19 #include <string> 20 #include <string>
20 #include <utility> 21 #include <utility>
21 #include <vector> 22 #include <vector>
22 23
23 #include "base/callback_forward.h" 24 #include "base/callback_forward.h"
24 #include "base/gtest_prod_util.h" 25 #include "base/gtest_prod_util.h"
25 #include "base/macros.h" 26 #include "base/macros.h"
26 #include "base/memory/linked_ptr.h" 27 #include "base/memory/linked_ptr.h"
27 #include "base/memory/ref_counted.h" 28 #include "base/memory/ref_counted.h"
28 #include "base/memory/scoped_ptr.h"
29 #include "base/memory/weak_ptr.h" 29 #include "base/memory/weak_ptr.h"
30 #include "base/time/time.h" 30 #include "base/time/time.h"
31 #include "chrome/browser/safe_browsing/client_side_model_loader.h" 31 #include "chrome/browser/safe_browsing/client_side_model_loader.h"
32 #include "content/public/browser/browser_thread.h" 32 #include "content/public/browser/browser_thread.h"
33 #include "content/public/browser/notification_observer.h" 33 #include "content/public/browser/notification_observer.h"
34 #include "content/public/browser/notification_registrar.h" 34 #include "content/public/browser/notification_registrar.h"
35 #include "net/url_request/url_fetcher_delegate.h" 35 #include "net/url_request/url_fetcher_delegate.h"
36 #include "url/gurl.h" 36 #include "url/gurl.h"
37 37
38 namespace base { 38 namespace base {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 // Returns the URL that will be used for phishing requests. 222 // Returns the URL that will be used for phishing requests.
223 static GURL GetClientReportUrl(const std::string& report_url); 223 static GURL GetClientReportUrl(const std::string& report_url);
224 224
225 // Whether the service is running or not. When the service is not running, 225 // Whether the service is running or not. When the service is not running,
226 // it won't download the model nor report detected phishing URLs. 226 // it won't download the model nor report detected phishing URLs.
227 bool enabled_; 227 bool enabled_;
228 228
229 // We load two models: One for stadard Safe Browsing profiles, 229 // We load two models: One for stadard Safe Browsing profiles,
230 // and one for those opted into extended reporting. 230 // and one for those opted into extended reporting.
231 scoped_ptr<ModelLoader> model_loader_standard_; 231 std::unique_ptr<ModelLoader> model_loader_standard_;
232 scoped_ptr<ModelLoader> model_loader_extended_; 232 std::unique_ptr<ModelLoader> model_loader_extended_;
233 233
234 // Map of client report phishing request to the corresponding callback that 234 // Map of client report phishing request to the corresponding callback that
235 // has to be invoked when the request is done. 235 // has to be invoked when the request is done.
236 struct ClientReportInfo; 236 struct ClientReportInfo;
237 std::map<const net::URLFetcher*, ClientReportInfo*> 237 std::map<const net::URLFetcher*, ClientReportInfo*>
238 client_phishing_reports_; 238 client_phishing_reports_;
239 // Map of client malware ip request to the corresponding callback that 239 // Map of client malware ip request to the corresponding callback that
240 // has to be invoked when the request is done. 240 // has to be invoked when the request is done.
241 struct ClientMalwareReportInfo; 241 struct ClientMalwareReportInfo;
242 std::map<const net::URLFetcher*, ClientMalwareReportInfo*> 242 std::map<const net::URLFetcher*, ClientMalwareReportInfo*>
(...skipping 24 matching lines...) Expand all
267 // Used to asynchronously call the callbacks for 267 // Used to asynchronously call the callbacks for
268 // SendClientReportPhishingRequest. 268 // SendClientReportPhishingRequest.
269 base::WeakPtrFactory<ClientSideDetectionService> weak_factory_; 269 base::WeakPtrFactory<ClientSideDetectionService> weak_factory_;
270 270
271 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService); 271 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService);
272 }; 272 };
273 273
274 } // namespace safe_browsing 274 } // namespace safe_browsing
275 275
276 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_ 276 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698