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

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

Issue 11615011: Small modifications to safebrowsing code to make it simpler to add the extension (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 7 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/safe_browsing/download_protection_service.h" 5 #include "chrome/browser/safe_browsing/download_protection_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 class DownloadUrlSBClient : public DownloadSBClient { 291 class DownloadUrlSBClient : public DownloadSBClient {
292 public: 292 public:
293 DownloadUrlSBClient( 293 DownloadUrlSBClient(
294 const DownloadProtectionService::DownloadInfo& info, 294 const DownloadProtectionService::DownloadInfo& info,
295 const DownloadProtectionService::CheckDownloadCallback& callback, 295 const DownloadProtectionService::CheckDownloadCallback& callback,
296 const scoped_refptr<SafeBrowsingUIManager>& ui_manager, 296 const scoped_refptr<SafeBrowsingUIManager>& ui_manager,
297 const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager) 297 const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager)
298 : DownloadSBClient(info, callback, ui_manager, 298 : DownloadSBClient(info, callback, ui_manager,
299 DOWNLOAD_URL_CHECKS_TOTAL, 299 DOWNLOAD_URL_CHECKS_TOTAL,
300 DOWNLOAD_URL_CHECKS_MALWARE), 300 DOWNLOAD_URL_CHECKS_MALWARE),
301 database_manager_(database_manager) { } 301 database_manager_(database_manager) {
302 }
302 303
303 virtual void StartCheck() OVERRIDE { 304 virtual void StartCheck() OVERRIDE {
304 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 305 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
305 if (!database_manager_ || database_manager_->CheckDownloadUrl( 306 if (database_manager_->CheckDownloadUrl(info_.download_url_chain, this)) {
Scott Hess - ex-Googler 2013/01/17 19:24:42 Per earlier discussion, I think you need to put ba
not at google - send to devlin 2013/01/18 01:02:42 Done.
306 info_.download_url_chain, this)) {
307 CheckDone(SB_THREAT_TYPE_SAFE); 307 CheckDone(SB_THREAT_TYPE_SAFE);
308 } else { 308 } else {
309 AddRef(); // SafeBrowsingService takes a pointer not a scoped_refptr. 309 AddRef(); // SafeBrowsingService takes a pointer not a scoped_refptr.
310 } 310 }
311 } 311 }
312 312
313 virtual bool IsDangerous(SBThreatType threat_type) const OVERRIDE { 313 virtual bool IsDangerous(SBThreatType threat_type) const OVERRIDE {
314 return threat_type == SB_THREAT_TYPE_BINARY_MALWARE_URL; 314 return threat_type == SB_THREAT_TYPE_BINARY_MALWARE_URL;
315 } 315 }
316 316
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 std::string url = kDownloadRequestUrl; 983 std::string url = kDownloadRequestUrl;
984 std::string api_key = google_apis::GetAPIKey(); 984 std::string api_key = google_apis::GetAPIKey();
985 if (!api_key.empty()) { 985 if (!api_key.empty()) {
986 base::StringAppendF(&url, "?key=%s", 986 base::StringAppendF(&url, "?key=%s",
987 net::EscapeQueryParamValue(api_key, true).c_str()); 987 net::EscapeQueryParamValue(api_key, true).c_str());
988 } 988 }
989 return url; 989 return url;
990 } 990 }
991 991
992 } // namespace safe_browsing 992 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698