| OLD | NEW |
| 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 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 namespace content { | 42 namespace content { |
| 43 class RenderProcessHost; | 43 class RenderProcessHost; |
| 44 } | 44 } |
| 45 | 45 |
| 46 namespace net { | 46 namespace net { |
| 47 class URLFetcher; | 47 class URLFetcher; |
| 48 class URLRequestContextGetter; | 48 class URLRequestContextGetter; |
| 49 class URLRequestStatus; | 49 class URLRequestStatus; |
| 50 typedef std::vector<std::string> ResponseCookies; | |
| 51 } // namespace net | 50 } // namespace net |
| 52 | 51 |
| 53 namespace safe_browsing { | 52 namespace safe_browsing { |
| 54 class ClientMalwareRequest; | 53 class ClientMalwareRequest; |
| 55 class ClientPhishingRequest; | 54 class ClientPhishingRequest; |
| 56 class ClientPhishingResponse; | 55 class ClientPhishingResponse; |
| 57 class ClientSideModel; | 56 class ClientSideModel; |
| 58 | 57 |
| 59 // Main service which pushes models to the renderers, responds to classification | 58 // Main service which pushes models to the renderers, responds to classification |
| 60 // requests. This owns two ModelLoader objects. | 59 // requests. This owns two ModelLoader objects. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 void StartClientReportMalwareRequest( | 183 void StartClientReportMalwareRequest( |
| 185 ClientMalwareRequest* verdict, | 184 ClientMalwareRequest* verdict, |
| 186 const ClientReportMalwareRequestCallback& callback); | 185 const ClientReportMalwareRequestCallback& callback); |
| 187 | 186 |
| 188 // Called by OnURLFetchComplete to handle the server response from | 187 // Called by OnURLFetchComplete to handle the server response from |
| 189 // sending the client-side phishing request. | 188 // sending the client-side phishing request. |
| 190 void HandlePhishingVerdict(const net::URLFetcher* source, | 189 void HandlePhishingVerdict(const net::URLFetcher* source, |
| 191 const GURL& url, | 190 const GURL& url, |
| 192 const net::URLRequestStatus& status, | 191 const net::URLRequestStatus& status, |
| 193 int response_code, | 192 int response_code, |
| 194 const net::ResponseCookies& cookies, | |
| 195 const std::string& data); | 193 const std::string& data); |
| 196 | 194 |
| 197 // Called by OnURLFetchComplete to handle the server response from | 195 // Called by OnURLFetchComplete to handle the server response from |
| 198 // sending the client-side malware request. | 196 // sending the client-side malware request. |
| 199 void HandleMalwareVerdict(const net::URLFetcher* source, | 197 void HandleMalwareVerdict(const net::URLFetcher* source, |
| 200 const GURL& url, | 198 const GURL& url, |
| 201 const net::URLRequestStatus& status, | 199 const net::URLRequestStatus& status, |
| 202 int response_code, | 200 int response_code, |
| 203 const net::ResponseCookies& cookies, | |
| 204 const std::string& data); | 201 const std::string& data); |
| 205 | 202 |
| 206 // Invalidate cache results which are no longer useful. | 203 // Invalidate cache results which are no longer useful. |
| 207 void UpdateCache(); | 204 void UpdateCache(); |
| 208 | 205 |
| 209 // Get the number of malware reports that we have sent over kReportsInterval. | 206 // Get the number of malware reports that we have sent over kReportsInterval. |
| 210 int GetMalwareNumReports(); | 207 int GetMalwareNumReports(); |
| 211 | 208 |
| 212 // Get the number of phishing reports that we have sent over kReportsInterval. | 209 // Get the number of phishing reports that we have sent over kReportsInterval. |
| 213 int GetPhishingNumReports(); | 210 int GetPhishingNumReports(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // Used to asynchronously call the callbacks for | 264 // Used to asynchronously call the callbacks for |
| 268 // SendClientReportPhishingRequest. | 265 // SendClientReportPhishingRequest. |
| 269 base::WeakPtrFactory<ClientSideDetectionService> weak_factory_; | 266 base::WeakPtrFactory<ClientSideDetectionService> weak_factory_; |
| 270 | 267 |
| 271 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService); | 268 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService); |
| 272 }; | 269 }; |
| 273 | 270 |
| 274 } // namespace safe_browsing | 271 } // namespace safe_browsing |
| 275 | 272 |
| 276 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_ | 273 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_ |
| OLD | NEW |