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

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

Issue 8375039: Create a content::UrlFetcher interface that lives in content/public/common and convert users to i... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 9 years, 1 month 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 servers for 5 // Helper class which handles communication with the SafeBrowsing servers for
6 // improved binary download protection. 6 // improved binary download protection.
7 7
8 #ifndef CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_
9 #define CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ 9 #define CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_
10 #pragma once 10 #pragma once
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 typedef base::Callback<void(DownloadCheckResult)> CheckDownloadCallback; 59 typedef base::Callback<void(DownloadCheckResult)> CheckDownloadCallback;
60 60
61 // Creates a download service. The service is initially disabled. You need 61 // Creates a download service. The service is initially disabled. You need
62 // to call SetEnabled() to start it. We keep scoped references to both of 62 // to call SetEnabled() to start it. We keep scoped references to both of
63 // these objects. 63 // these objects.
64 DownloadProtectionService( 64 DownloadProtectionService(
65 SafeBrowsingService* sb_service, 65 SafeBrowsingService* sb_service,
66 net::URLRequestContextGetter* request_context_getter); 66 net::URLRequestContextGetter* request_context_getter);
67 67
68 // From the content::URLFetcherDelegate interface. 68 // From the content::URLFetcherDelegate interface.
69 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; 69 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE;
70 70
71 // Checks whether the given client download is likely to be 71 // Checks whether the given client download is likely to be
72 // malicious or not. If this method returns true it means the 72 // malicious or not. If this method returns true it means the
73 // download is safe or we're unable to tell whether it is safe or 73 // download is safe or we're unable to tell whether it is safe or
74 // not. In this case the callback will never be called. If this 74 // not. In this case the callback will never be called. If this
75 // method returns false we will asynchronously check whether the 75 // method returns false we will asynchronously check whether the
76 // download is safe and call the callback when we have the response. 76 // download is safe and call the callback when we have the response.
77 // This method should be called on the UI thread. The callback will 77 // This method should be called on the UI thread. The callback will
78 // be called on the UI thread and will always be called asynchronously. 78 // be called on the UI thread and will always be called asynchronously.
79 virtual bool CheckClientDownload(const DownloadInfo& info, 79 virtual bool CheckClientDownload(const DownloadInfo& info,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 // This pointer may be NULL if SafeBrowsing is disabled. 139 // This pointer may be NULL if SafeBrowsing is disabled.
140 scoped_refptr<SafeBrowsingService> sb_service_; 140 scoped_refptr<SafeBrowsingService> sb_service_;
141 141
142 // The context we use to issue network requests. 142 // The context we use to issue network requests.
143 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 143 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
144 144
145 // Map of client download request to the corresponding callback that 145 // Map of client download request to the corresponding callback that
146 // has to be invoked when the request is done. This map contains all 146 // has to be invoked when the request is done. This map contains all
147 // pending server requests. 147 // pending server requests.
148 std::map<const URLFetcher*, CheckDownloadCallback> download_requests_; 148 typedef std::map<const content::URLFetcher*, CheckDownloadCallback>
149 DownloadRequests;
150 DownloadRequests download_requests_;
149 151
150 // Keeps track of the state of the service. 152 // Keeps track of the state of the service.
151 bool enabled_; 153 bool enabled_;
152 154
153 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService); 155 DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService);
154 }; 156 };
155 } // namespace safe_browsing 157 } // namespace safe_browsing
156 158
157 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_ 159 #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698