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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // called with "false" verdicts. Enabling starts downloading the model after | 81 // called with "false" verdicts. Enabling starts downloading the model after |
82 // a delay. In all cases, each render process is updated to match the state | 82 // a delay. In all cases, each render process is updated to match the state |
83 // of the SafeBrowsing preference for that profile. | 83 // of the SafeBrowsing preference for that profile. |
84 void SetEnabledAndRefreshState(bool enabled); | 84 void SetEnabledAndRefreshState(bool enabled); |
85 | 85 |
86 bool enabled() const { | 86 bool enabled() const { |
87 return enabled_; | 87 return enabled_; |
88 } | 88 } |
89 | 89 |
90 // From the net::URLFetcherDelegate interface. | 90 // From the net::URLFetcherDelegate interface. |
91 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 91 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; |
92 | 92 |
93 // content::NotificationObserver overrides: | 93 // content::NotificationObserver overrides: |
94 virtual void Observe(int type, | 94 virtual void Observe(int type, |
95 const content::NotificationSource& source, | 95 const content::NotificationSource& source, |
96 const content::NotificationDetails& details) OVERRIDE; | 96 const content::NotificationDetails& details) override; |
97 | 97 |
98 // Sends a request to the SafeBrowsing servers with the ClientPhishingRequest. | 98 // Sends a request to the SafeBrowsing servers with the ClientPhishingRequest. |
99 // The URL scheme of the |url()| in the request should be HTTP. This method | 99 // The URL scheme of the |url()| in the request should be HTTP. This method |
100 // takes ownership of the |verdict| as well as the |callback| and calls the | 100 // takes ownership of the |verdict| as well as the |callback| and calls the |
101 // the callback once the result has come back from the server or if an error | 101 // the callback once the result has come back from the server or if an error |
102 // occurs during the fetch. If the service is disabled or an error occurs | 102 // occurs during the fetch. If the service is disabled or an error occurs |
103 // the phishing verdict will always be false. The callback is always called | 103 // the phishing verdict will always be false. The callback is always called |
104 // after SendClientReportPhishingRequest() returns and on the same thread as | 104 // after SendClientReportPhishingRequest() returns and on the same thread as |
105 // SendClientReportPhishingRequest() was called. You may set |callback| to | 105 // SendClientReportPhishingRequest() was called. You may set |callback| to |
106 // NULL if you don't care about the server verdict. | 106 // NULL if you don't care about the server verdict. |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 327 |
328 // Used to asynchronously call the callbacks for | 328 // Used to asynchronously call the callbacks for |
329 // SendClientReportPhishingRequest. | 329 // SendClientReportPhishingRequest. |
330 base::WeakPtrFactory<ClientSideDetectionService> weak_factory_; | 330 base::WeakPtrFactory<ClientSideDetectionService> weak_factory_; |
331 | 331 |
332 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService); | 332 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService); |
333 }; | 333 }; |
334 } // namespace safe_browsing | 334 } // namespace safe_browsing |
335 | 335 |
336 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_ | 336 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_ |
OLD | NEW |