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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 } | 324 } |
325 | 325 |
326 bool SafeBrowsingDatabaseManager::IsMalwareKillSwitchOn() { | 326 bool SafeBrowsingDatabaseManager::IsMalwareKillSwitchOn() { |
327 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 327 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
328 if (!enabled_ || !MakeDatabaseAvailable()) { | 328 if (!enabled_ || !MakeDatabaseAvailable()) { |
329 return true; | 329 return true; |
330 } | 330 } |
331 return database_->IsMalwareIPMatchKillSwitchOn(); | 331 return database_->IsMalwareIPMatchKillSwitchOn(); |
332 } | 332 } |
333 | 333 |
| 334 bool SafeBrowsingDatabaseManager::MatchMalwareIP( |
| 335 const std::string& ip_address) { |
| 336 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 337 if (!enabled_ || !MakeDatabaseAvailable()) { |
| 338 return false; // Fail open. |
| 339 } |
| 340 // TODO(noelutz): integrate with the other CL. |
| 341 return false; |
| 342 } |
| 343 |
334 bool SafeBrowsingDatabaseManager::CheckBrowseUrl(const GURL& url, | 344 bool SafeBrowsingDatabaseManager::CheckBrowseUrl(const GURL& url, |
335 Client* client) { | 345 Client* client) { |
336 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 346 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
337 if (!enabled_) | 347 if (!enabled_) |
338 return true; | 348 return true; |
339 | 349 |
340 if (!CanCheckUrl(url)) | 350 if (!CanCheckUrl(url)) |
341 return true; | 351 return true; |
342 | 352 |
343 std::vector<SBThreatType> expected_threats; | 353 std::vector<SBThreatType> expected_threats; |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this)); | 1104 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this)); |
1095 checks_.insert(check); | 1105 checks_.insert(check); |
1096 | 1106 |
1097 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); | 1107 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); |
1098 | 1108 |
1099 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, | 1109 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, |
1100 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, | 1110 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, |
1101 check->timeout_factory_->GetWeakPtr(), check), | 1111 check->timeout_factory_->GetWeakPtr(), check), |
1102 check_timeout_); | 1112 check_timeout_); |
1103 } | 1113 } |
OLD | NEW |