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

Side by Side Diff: chrome/browser/safe_browsing/client_side_detection_service.h

Issue 6014003: Intergration of the client-side phishing detection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Dont DCHECK because some unit tests are failing. Created 9 years, 10 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 | Annotate | Revision Log
OLDNEW
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 can be used to get a file 6 // client-side phishing detection. This class can be used to get a file
7 // descriptor to the client-side phishing model and also to send a ping back to 7 // descriptor to the client-side phishing model and also to send a ping back to
8 // Google to verify if a particular site is really phishing or not. 8 // 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 GetModelFile() and 10 // This class is not thread-safe and expects all calls to GetModelFile() and
(...skipping 13 matching lines...) Expand all
24 #include "base/basictypes.h" 24 #include "base/basictypes.h"
25 #include "base/callback.h" 25 #include "base/callback.h"
26 #include "base/file_path.h" 26 #include "base/file_path.h"
27 #include "base/gtest_prod_util.h" 27 #include "base/gtest_prod_util.h"
28 #include "base/platform_file.h" 28 #include "base/platform_file.h"
29 #include "base/ref_counted.h" 29 #include "base/ref_counted.h"
30 #include "base/scoped_callback_factory.h" 30 #include "base/scoped_callback_factory.h"
31 #include "base/scoped_ptr.h" 31 #include "base/scoped_ptr.h"
32 #include "base/task.h" 32 #include "base/task.h"
33 #include "base/time.h" 33 #include "base/time.h"
34 #include "chrome/common/render_messages_params.h"
34 #include "chrome/browser/safe_browsing/csd.pb.h" 35 #include "chrome/browser/safe_browsing/csd.pb.h"
36 #include "chrome/browser/tab_contents/navigation_controller.h"
lzheng 2011/02/11 19:39:42 From the changes, it is not obvious to me hy these
noelutz 2011/02/15 23:00:55 Done.
35 #include "chrome/common/net/url_fetcher.h" 37 #include "chrome/common/net/url_fetcher.h"
36 #include "googleurl/src/gurl.h" 38 #include "googleurl/src/gurl.h"
37 39
38 class URLRequestContextGetter; 40 class URLRequestContextGetter;
39 41
40 namespace net { 42 namespace net {
41 class URLRequestStatus; 43 class URLRequestStatus;
42 } // namespace net 44 } // namespace net
43 45
44 namespace safe_browsing { 46 namespace safe_browsing {
(...skipping 30 matching lines...) Expand all
75 // same thread as GetModelFile() was called. 77 // same thread as GetModelFile() was called.
76 void GetModelFile(OpenModelDoneCallback* callback); 78 void GetModelFile(OpenModelDoneCallback* callback);
77 79
78 // Sends a request to the SafeBrowsing servers with the potentially phishing 80 // Sends a request to the SafeBrowsing servers with the potentially phishing
79 // URL and the client-side phishing score. The |phishing_url| scheme should 81 // URL and the client-side phishing score. The |phishing_url| scheme should
80 // be HTTP. This method takes ownership of the |callback| and calls it once 82 // be HTTP. This method takes ownership of the |callback| and calls it once
81 // the result has come back from the server or if an error occurs during the 83 // the result has come back from the server or if an error occurs during the
82 // fetch. If an error occurs the phishing verdict will always be false. The 84 // fetch. If an error occurs the phishing verdict will always be false. The
83 // callback is always called after SendClientReportPhishingRequest() returns 85 // callback is always called after SendClientReportPhishingRequest() returns
84 // and on the same thread as SendClientReportPhishingRequest() was called. 86 // and on the same thread as SendClientReportPhishingRequest() was called.
85 void SendClientReportPhishingRequest( 87 virtual void SendClientReportPhishingRequest(
86 const GURL& phishing_url, 88 const GURL& phishing_url,
87 double score, 89 double score,
88 ClientReportPhishingRequestCallback* callback); 90 ClientReportPhishingRequestCallback* callback);
89 91
92 protected:
93 // Used for testing only.
94 ClientSideDetectionService();
95
90 private: 96 private:
91 friend class ClientSideDetectionServiceTest; 97 friend class ClientSideDetectionServiceTest;
92 98
93 enum ModelStatus { 99 enum ModelStatus {
94 // It's unclear whether or not the model was already fetched. 100 // It's unclear whether or not the model was already fetched.
95 UNKNOWN_STATUS, 101 UNKNOWN_STATUS,
96 // Model is fetched and is stored on disk. 102 // Model is fetched and is stored on disk.
97 READY_STATUS, 103 READY_STATUS,
98 // Error occured during fetching or writing. 104 // Error occured during fetching or writing.
99 ERROR_STATUS, 105 ERROR_STATUS,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 204
199 // The context we use to issue network requests. 205 // The context we use to issue network requests.
200 scoped_refptr<URLRequestContextGetter> request_context_getter_; 206 scoped_refptr<URLRequestContextGetter> request_context_getter_;
201 207
202 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService); 208 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService);
203 }; 209 };
204 210
205 } // namepsace safe_browsing 211 } // namepsace safe_browsing
206 212
207 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_ 213 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698