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/database_manager.h" | 5 #include "chrome/browser/safe_browsing/database_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 } | 215 } |
216 | 216 |
217 SafeBrowsingDatabaseManager::~SafeBrowsingDatabaseManager() { | 217 SafeBrowsingDatabaseManager::~SafeBrowsingDatabaseManager() { |
218 // We should have already been shut down. If we're still enabled, then the | 218 // We should have already been shut down. If we're still enabled, then the |
219 // database isn't going to be closed properly, which could lead to corruption. | 219 // database isn't going to be closed properly, which could lead to corruption. |
220 DCHECK(!enabled_); | 220 DCHECK(!enabled_); |
221 } | 221 } |
222 | 222 |
223 bool SafeBrowsingDatabaseManager::CanCheckUrl(const GURL& url) const { | 223 bool SafeBrowsingDatabaseManager::CanCheckUrl(const GURL& url) const { |
224 return url.SchemeIs(content::kFtpScheme) || | 224 return url.SchemeIs(content::kFtpScheme) || |
225 url.SchemeIs(content::kHttpScheme) || | 225 url.SchemeIs(url::kHttpScheme) || |
226 url.SchemeIs(content::kHttpsScheme); | 226 url.SchemeIs(url::kHttpsScheme); |
227 } | 227 } |
228 | 228 |
229 bool SafeBrowsingDatabaseManager::CheckDownloadUrl( | 229 bool SafeBrowsingDatabaseManager::CheckDownloadUrl( |
230 const std::vector<GURL>& url_chain, | 230 const std::vector<GURL>& url_chain, |
231 Client* client) { | 231 Client* client) { |
232 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 232 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
233 if (!enabled_ || !enable_download_protection_) | 233 if (!enabled_ || !enable_download_protection_) |
234 return true; | 234 return true; |
235 | 235 |
236 // We need to check the database for url prefix, and later may fetch the url | 236 // We need to check the database for url prefix, and later may fetch the url |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this)); | 1014 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this)); |
1015 checks_.insert(check); | 1015 checks_.insert(check); |
1016 | 1016 |
1017 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); | 1017 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); |
1018 | 1018 |
1019 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, | 1019 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, |
1020 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, | 1020 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, |
1021 check->timeout_factory_->GetWeakPtr(), check), | 1021 check->timeout_factory_->GetWeakPtr(), check), |
1022 check_timeout_); | 1022 check_timeout_); |
1023 } | 1023 } |
OLD | NEW |