Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 CHECK(database_manager_); | |
|
Scott Hess - ex-Googler
2013/01/11 23:44:05
Are you certain? The code in DownloadProtectionSe
not at google - send to devlin
2013/01/14 23:00:55
Yeah, don't know why I made this change.
| |
| 303 } | |
| 302 | 304 |
| 303 virtual void StartCheck() OVERRIDE { | 305 virtual void StartCheck() OVERRIDE { |
| 304 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 306 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 305 if (!database_manager_ || database_manager_->CheckDownloadUrl( | 307 if (database_manager_->CheckDownloadUrl(info_.download_url_chain, this)) { |
| 306 info_.download_url_chain, this)) { | |
| 307 CheckDone(SB_THREAT_TYPE_SAFE); | 308 CheckDone(SB_THREAT_TYPE_SAFE); |
| 308 } else { | 309 } else { |
| 309 AddRef(); // SafeBrowsingService takes a pointer not a scoped_refptr. | 310 AddRef(); // SafeBrowsingService takes a pointer not a scoped_refptr. |
| 310 } | 311 } |
| 311 } | 312 } |
| 312 | 313 |
| 313 virtual bool IsDangerous(SBThreatType threat_type) const OVERRIDE { | 314 virtual bool IsDangerous(SBThreatType threat_type) const OVERRIDE { |
| 314 return threat_type == SB_THREAT_TYPE_BINARY_MALWARE_URL; | 315 return threat_type == SB_THREAT_TYPE_BINARY_MALWARE_URL; |
| 315 } | 316 } |
| 316 | 317 |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 983 std::string url = kDownloadRequestUrl; | 984 std::string url = kDownloadRequestUrl; |
| 984 std::string api_key = google_apis::GetAPIKey(); | 985 std::string api_key = google_apis::GetAPIKey(); |
| 985 if (!api_key.empty()) { | 986 if (!api_key.empty()) { |
| 986 base::StringAppendF(&url, "?key=%s", | 987 base::StringAppendF(&url, "?key=%s", |
| 987 net::EscapeQueryParamValue(api_key, true).c_str()); | 988 net::EscapeQueryParamValue(api_key, true).c_str()); |
| 988 } | 989 } |
| 989 return url; | 990 return url; |
| 990 } | 991 } |
| 991 | 992 |
| 992 } // namespace safe_browsing | 993 } // namespace safe_browsing |
| OLD | NEW |