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

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

Issue 6298004: Fix a possible crash in 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
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 void HandlePhishingVerdict(const URLFetcher* source, 158 void HandlePhishingVerdict(const URLFetcher* source,
159 const GURL& url, 159 const GURL& url,
160 const net::URLRequestStatus& status, 160 const net::URLRequestStatus& status,
161 int response_code, 161 int response_code,
162 const ResponseCookies& cookies, 162 const ResponseCookies& cookies,
163 const std::string& data); 163 const std::string& data);
164 164
165 FilePath model_path_; 165 FilePath model_path_;
166 ModelStatus model_status_; 166 ModelStatus model_status_;
167 base::PlatformFile model_file_; 167 base::PlatformFile model_file_;
168 URLFetcher* model_fetcher_; 168 scoped_ptr<URLFetcher> model_fetcher_;
169 scoped_ptr<std::string> tmp_model_string_; 169 scoped_ptr<std::string> tmp_model_string_;
170 std::vector<OpenModelDoneCallback*> open_callbacks_; 170 std::vector<OpenModelDoneCallback*> open_callbacks_;
171 171
172 // Map of client report phishing request to the corresponding callback that 172 // Map of client report phishing request to the corresponding callback that
173 // has to be invoked when the request is done. 173 // has to be invoked when the request is done.
174 struct ClientReportInfo; 174 struct ClientReportInfo;
175 std::map<const URLFetcher*, ClientReportInfo*> client_phishing_reports_; 175 std::map<const URLFetcher*, ClientReportInfo*> client_phishing_reports_;
176 176
177 // Used to asynchronously call the callbacks for GetModelFile and 177 // Used to asynchronously call the callbacks for GetModelFile and
178 // SendClientReportPhishingRequest. 178 // SendClientReportPhishingRequest.
179 ScopedRunnableMethodFactory<ClientSideDetectionService> method_factory_; 179 ScopedRunnableMethodFactory<ClientSideDetectionService> method_factory_;
180 180
181 // The client-side detection service object (this) might go away before some 181 // The client-side detection service object (this) might go away before some
182 // of the callbacks are done (e.g., asynchronous file operations). The 182 // of the callbacks are done (e.g., asynchronous file operations). The
183 // callback factory will revoke all pending callbacks if this goes away to 183 // callback factory will revoke all pending callbacks if this goes away to
184 // avoid a crash. 184 // avoid a crash.
185 base::ScopedCallbackFactory<ClientSideDetectionService> callback_factory_; 185 base::ScopedCallbackFactory<ClientSideDetectionService> callback_factory_;
186 186
187 // The context we use to issue network requests. 187 // The context we use to issue network requests.
188 scoped_refptr<URLRequestContextGetter> request_context_getter_; 188 scoped_refptr<URLRequestContextGetter> request_context_getter_;
189 189
190 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService); 190 DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService);
191 }; 191 };
192 192
193 } // namepsace safe_browsing 193 } // namepsace safe_browsing
194 194
195 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_ 195 #endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698