| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 17 matching lines...) Expand all Loading... |
| 28 #include "base/memory/ref_counted.h" | 28 #include "base/memory/ref_counted.h" |
| 29 #include "base/memory/scoped_ptr.h" | 29 #include "base/memory/scoped_ptr.h" |
| 30 #include "base/task.h" | 30 #include "base/task.h" |
| 31 #include "base/time.h" | 31 #include "base/time.h" |
| 32 #include "content/public/common/url_fetcher_delegate.h" | 32 #include "content/public/common/url_fetcher_delegate.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 "googleurl/src/gurl.h" | 35 #include "googleurl/src/gurl.h" |
| 36 #include "net/base/net_util.h" | 36 #include "net/base/net_util.h" |
| 37 | 37 |
| 38 class RenderProcessHost; | |
| 39 class SafeBrowsingService; | 38 class SafeBrowsingService; |
| 40 | 39 |
| 41 namespace base { | 40 namespace base { |
| 42 class TimeDelta; | 41 class TimeDelta; |
| 43 } | 42 } |
| 44 | 43 |
| 44 namespace content { |
| 45 class RenderProcessHost; |
| 46 } |
| 47 |
| 45 namespace net { | 48 namespace net { |
| 46 class URLRequestContextGetter; | 49 class URLRequestContextGetter; |
| 47 class URLRequestStatus; | 50 class URLRequestStatus; |
| 48 typedef std::vector<std::string> ResponseCookies; | 51 typedef std::vector<std::string> ResponseCookies; |
| 49 } // namespace net | 52 } // namespace net |
| 50 | 53 |
| 51 namespace safe_browsing { | 54 namespace safe_browsing { |
| 52 class ClientPhishingRequest; | 55 class ClientPhishingRequest; |
| 53 class ClientPhishingResponse; | 56 class ClientPhishingResponse; |
| 54 class ClientSideModel; | 57 class ClientSideModel; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 void UpdateCache(); | 230 void UpdateCache(); |
| 228 | 231 |
| 229 // Get the number of phishing reports that we have sent over kReportsInterval | 232 // Get the number of phishing reports that we have sent over kReportsInterval |
| 230 int GetNumReports(); | 233 int GetNumReports(); |
| 231 | 234 |
| 232 // Initializes the |private_networks_| vector with the network blocks | 235 // Initializes the |private_networks_| vector with the network blocks |
| 233 // that we consider non-public IP addresses. Returns true on success. | 236 // that we consider non-public IP addresses. Returns true on success. |
| 234 bool InitializePrivateNetworks(); | 237 bool InitializePrivateNetworks(); |
| 235 | 238 |
| 236 // Send the model to the given renderer. | 239 // Send the model to the given renderer. |
| 237 void SendModelToProcess(RenderProcessHost* process); | 240 void SendModelToProcess(content::RenderProcessHost* process); |
| 238 | 241 |
| 239 // Same as above but sends the model to all rendereres. | 242 // Same as above but sends the model to all rendereres. |
| 240 void SendModelToRenderers(); | 243 void SendModelToRenderers(); |
| 241 | 244 |
| 242 // Reads the bad subnets from the client model and inserts them into | 245 // Reads the bad subnets from the client model and inserts them into |
| 243 // |bad_subnets| for faster lookups. This method is static to simplify | 246 // |bad_subnets| for faster lookups. This method is static to simplify |
| 244 // testing. | 247 // testing. |
| 245 static void SetBadSubnets(const ClientSideModel& model, | 248 static void SetBadSubnets(const ClientSideModel& model, |
| 246 BadSubnetMap* bad_subnets); | 249 BadSubnetMap* bad_subnets); |
| 247 | 250 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 // this map to speed up lookups. | 301 // this map to speed up lookups. |
| 299 BadSubnetMap bad_subnets_; | 302 BadSubnetMap bad_subnets_; |
| 300 | 303 |
| 301 content::NotificationRegistrar registrar_; | 304 content::NotificationRegistrar registrar_; |
| 302 | 305 |
| 303 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService); | 306 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService); |
| 304 }; | 307 }; |
| 305 } // namepsace safe_browsing | 308 } // namepsace safe_browsing |
| 306 | 309 |
| 307 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_ | 310 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_ |
| OLD | NEW |