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

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

Issue 5841002: Finish deinlining virtual methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert parts of the balloon modifications Created 10 years 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 enum ModelStatus { 91 enum ModelStatus {
92 // It's unclear whether or not the model was already fetched. 92 // It's unclear whether or not the model was already fetched.
93 UNKNOWN_STATUS, 93 UNKNOWN_STATUS,
94 // Model is fetched and is stored on disk. 94 // Model is fetched and is stored on disk.
95 READY_STATUS, 95 READY_STATUS,
96 // Error occured during fetching or writing. 96 // Error occured during fetching or writing.
97 ERROR_STATUS, 97 ERROR_STATUS,
98 }; 98 };
99 99
100 struct ClientReportInfo {
101 scoped_ptr<ClientReportPhishingRequestCallback> callback;
102 GURL phishing_url;
103 };
104
105 static const char kClientReportPhishingUrl[]; 100 static const char kClientReportPhishingUrl[];
106 static const char kClientModelUrl[]; 101 static const char kClientModelUrl[];
107 102
108 // Use Create() method to create an instance of this object. 103 // Use Create() method to create an instance of this object.
109 ClientSideDetectionService(const FilePath& model_path, 104 ClientSideDetectionService(const FilePath& model_path,
110 URLRequestContextGetter* request_context_getter); 105 URLRequestContextGetter* request_context_getter);
111 106
112 // Sets the model status and invokes all the pending callbacks in 107 // Sets the model status and invokes all the pending callbacks in
113 // |open_callbacks_| with the current |model_file_| as parameter. 108 // |open_callbacks_| with the current |model_file_| as parameter.
114 void SetModelStatus(ModelStatus status); 109 void SetModelStatus(ModelStatus status);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 165
171 FilePath model_path_; 166 FilePath model_path_;
172 ModelStatus model_status_; 167 ModelStatus model_status_;
173 base::PlatformFile model_file_; 168 base::PlatformFile model_file_;
174 URLFetcher* model_fetcher_; 169 URLFetcher* model_fetcher_;
175 scoped_ptr<std::string> tmp_model_string_; 170 scoped_ptr<std::string> tmp_model_string_;
176 std::vector<OpenModelDoneCallback*> open_callbacks_; 171 std::vector<OpenModelDoneCallback*> open_callbacks_;
177 172
178 // Map of client report phishing request to the corresponding callback that 173 // Map of client report phishing request to the corresponding callback that
179 // has to be invoked when the request is done. 174 // has to be invoked when the request is done.
175 struct ClientReportInfo;
180 std::map<const URLFetcher*, ClientReportInfo*> client_phishing_reports_; 176 std::map<const URLFetcher*, ClientReportInfo*> client_phishing_reports_;
181 177
182 // Used to asynchronously call the callbacks for GetModelFile and 178 // Used to asynchronously call the callbacks for GetModelFile and
183 // SendClientReportPhishingRequest. 179 // SendClientReportPhishingRequest.
184 ScopedRunnableMethodFactory<ClientSideDetectionService> method_factory_; 180 ScopedRunnableMethodFactory<ClientSideDetectionService> method_factory_;
185 181
186 // The client-side detection service object (this) might go away before some 182 // The client-side detection service object (this) might go away before some
187 // of the callbacks are done (e.g., asynchronous file operations). The 183 // of the callbacks are done (e.g., asynchronous file operations). The
188 // callback factory will revoke all pending callbacks if this goes away to 184 // callback factory will revoke all pending callbacks if this goes away to
189 // avoid a crash. 185 // avoid a crash.
190 base::ScopedCallbackFactory<ClientSideDetectionService> callback_factory_; 186 base::ScopedCallbackFactory<ClientSideDetectionService> callback_factory_;
191 187
192 // The context we use to issue network requests. 188 // The context we use to issue network requests.
193 scoped_refptr<URLRequestContextGetter> request_context_getter_; 189 scoped_refptr<URLRequestContextGetter> request_context_getter_;
194 190
195 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService); 191 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService);
196 }; 192 };
197 193
198 } // namepsace safe_browsing 194 } // namepsace safe_browsing
199 195
200 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_ 196 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698