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

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

Issue 6277002: Remove thumbnails from the ClientSideDetectionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/client_side_detection_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 15 matching lines...) Expand all
26 #include "base/gtest_prod_util.h" 26 #include "base/gtest_prod_util.h"
27 #include "base/platform_file.h" 27 #include "base/platform_file.h"
28 #include "base/ref_counted.h" 28 #include "base/ref_counted.h"
29 #include "base/scoped_callback_factory.h" 29 #include "base/scoped_callback_factory.h"
30 #include "base/scoped_ptr.h" 30 #include "base/scoped_ptr.h"
31 #include "base/task.h" 31 #include "base/task.h"
32 #include "chrome/browser/safe_browsing/csd.pb.h" 32 #include "chrome/browser/safe_browsing/csd.pb.h"
33 #include "chrome/common/net/url_fetcher.h" 33 #include "chrome/common/net/url_fetcher.h"
34 #include "googleurl/src/gurl.h" 34 #include "googleurl/src/gurl.h"
35 35
36 class SkBitmap;
37 class URLRequestContextGetter; 36 class URLRequestContextGetter;
38 37
39 namespace net { 38 namespace net {
40 class URLRequestStatus; 39 class URLRequestStatus;
41 } // namespace net 40 } // namespace net
42 41
43 namespace safe_browsing { 42 namespace safe_browsing {
44 43
45 class ClientSideDetectionService : public URLFetcher::Delegate { 44 class ClientSideDetectionService : public URLFetcher::Delegate {
46 public: 45 public:
(...skipping 21 matching lines...) Expand all
68 67
69 // Gets the model file descriptor once the model is ready and stored 68 // Gets the model file descriptor once the model is ready and stored
70 // on disk. If there was an error the callback is called and the 69 // on disk. If there was an error the callback is called and the
71 // platform file is set to kInvalidPlatformFileValue. The 70 // platform file is set to kInvalidPlatformFileValue. The
72 // ClientSideDetectionService takes ownership of the |callback|. 71 // ClientSideDetectionService takes ownership of the |callback|.
73 // The callback is always called after GetModelFile() returns and on the 72 // The callback is always called after GetModelFile() returns and on the
74 // same thread as GetModelFile() was called. 73 // same thread as GetModelFile() was called.
75 void GetModelFile(OpenModelDoneCallback* callback); 74 void GetModelFile(OpenModelDoneCallback* callback);
76 75
77 // Sends a request to the SafeBrowsing servers with the potentially phishing 76 // Sends a request to the SafeBrowsing servers with the potentially phishing
78 // URL, the client-side phishing score, and a low resolution thumbnail. The 77 // URL and the client-side phishing score. The |phishing_url| scheme should
79 // |phishing_url| scheme should be HTTP. This method takes ownership of the 78 // be HTTP. This method takes ownership of the |callback| and calls it once
80 // |callback| and calls it once the result has come back from the server or 79 // the result has come back from the server or if an error occurs during the
81 // if an error occurs during the fetch. If an error occurs the phishing 80 // fetch. If an error occurs the phishing verdict will always be false. The
82 // verdict will always be false. The callback is always called after 81 // callback is always called after SendClientReportPhishingRequest() returns
83 // SendClientReportPhishingRequest() returns and on the same thread as 82 // and on the same thread as SendClientReportPhishingRequest() was called.
84 // SendClientReportPhishingRequest() was called.
85 void SendClientReportPhishingRequest( 83 void SendClientReportPhishingRequest(
86 const GURL& phishing_url, 84 const GURL& phishing_url,
87 double score, 85 double score,
88 SkBitmap thumbnail,
89 ClientReportPhishingRequestCallback* callback); 86 ClientReportPhishingRequestCallback* callback);
90 87
91 private: 88 private:
92 friend class ClientSideDetectionServiceTest; 89 friend class ClientSideDetectionServiceTest;
93 90
94 enum ModelStatus { 91 enum ModelStatus {
95 // It's unclear whether or not the model was already fetched. 92 // It's unclear whether or not the model was already fetched.
96 UNKNOWN_STATUS, 93 UNKNOWN_STATUS,
97 // Model is fetched and is stored on disk. 94 // Model is fetched and is stored on disk.
98 READY_STATUS, 95 READY_STATUS,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 int bytes_written); 132 int bytes_written);
136 133
137 // Helper function which closes the |model_file_| if necessary. 134 // Helper function which closes the |model_file_| if necessary.
138 void CloseModelFile(); 135 void CloseModelFile();
139 136
140 // Starts preparing the request to be sent to the client-side detection 137 // Starts preparing the request to be sent to the client-side detection
141 // frontends. 138 // frontends.
142 void StartClientReportPhishingRequest( 139 void StartClientReportPhishingRequest(
143 const GURL& phishing_url, 140 const GURL& phishing_url,
144 double score, 141 double score,
145 SkBitmap thumbnail,
146 ClientReportPhishingRequestCallback* callback); 142 ClientReportPhishingRequestCallback* callback);
147 143
148 // Starts getting the model file. 144 // Starts getting the model file.
149 void StartGetModelFile(OpenModelDoneCallback* callback); 145 void StartGetModelFile(OpenModelDoneCallback* callback);
150 146
151 // Called by OnURLFetchComplete to handle the response from fetching the 147 // Called by OnURLFetchComplete to handle the response from fetching the
152 // model. 148 // model.
153 void HandleModelResponse(const URLFetcher* source, 149 void HandleModelResponse(const URLFetcher* source,
154 const GURL& url, 150 const GURL& url,
155 const net::URLRequestStatus& status, 151 const net::URLRequestStatus& status,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 186
191 // The context we use to issue network requests. 187 // The context we use to issue network requests.
192 scoped_refptr<URLRequestContextGetter> request_context_getter_; 188 scoped_refptr<URLRequestContextGetter> request_context_getter_;
193 189
194 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService); 190 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService);
195 }; 191 };
196 192
197 } // namepsace safe_browsing 193 } // namepsace safe_browsing
198 194
199 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_ 195 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/client_side_detection_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698