| 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 if (!MakeDatabaseAvailable()) { | 351 if (!MakeDatabaseAvailable()) { |
| 352 QueuedCheck queued_check(safe_browsing_util::MALWARE, // or PHISH | 352 QueuedCheck queued_check(safe_browsing_util::MALWARE, // or PHISH |
| 353 client, | 353 client, |
| 354 url, | 354 url, |
| 355 expected_threats, | 355 expected_threats, |
| 356 start); | 356 start); |
| 357 queued_checks_.push_back(queued_check); | 357 queued_checks_.push_back(queued_check); |
| 358 return false; | 358 return false; |
| 359 } | 359 } |
| 360 | 360 |
| 361 std::string list; | |
| 362 std::vector<SBPrefix> prefix_hits; | 361 std::vector<SBPrefix> prefix_hits; |
| 363 std::vector<SBFullHashResult> full_hits; | 362 std::vector<SBFullHashResult> full_hits; |
| 364 | 363 |
| 365 bool prefix_match = | 364 bool prefix_match = |
| 366 database_->ContainsBrowseUrl(url, &list, &prefix_hits, &full_hits, | 365 database_->ContainsBrowseUrl(url, &prefix_hits, &full_hits, |
| 367 sb_service_->protocol_manager()->last_update()); | 366 sb_service_->protocol_manager()->last_update()); |
| 368 | 367 |
| 369 UMA_HISTOGRAM_TIMES("SB2.FilterCheck", base::TimeTicks::Now() - start); | 368 UMA_HISTOGRAM_TIMES("SB2.FilterCheck", base::TimeTicks::Now() - start); |
| 370 | 369 |
| 371 if (!prefix_match) | 370 if (!prefix_match) |
| 372 return true; // URL is okay. | 371 return true; // URL is okay. |
| 373 | 372 |
| 374 // Needs to be asynchronous, since we could be in the constructor of a | 373 // Needs to be asynchronous, since we could be in the constructor of a |
| 375 // ResourceDispatcherHost event handler which can't pause there. | 374 // ResourceDispatcherHost event handler which can't pause there. |
| 376 SafeBrowsingCheck* check = new SafeBrowsingCheck(std::vector<GURL>(1, url), | 375 SafeBrowsingCheck* check = new SafeBrowsingCheck(std::vector<GURL>(1, url), |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this)); | 1014 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this)); |
| 1016 checks_.insert(check); | 1015 checks_.insert(check); |
| 1017 | 1016 |
| 1018 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); | 1017 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); |
| 1019 | 1018 |
| 1020 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, | 1019 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 1021 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, | 1020 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, |
| 1022 check->timeout_factory_->GetWeakPtr(), check), | 1021 check->timeout_factory_->GetWeakPtr(), check), |
| 1023 check_timeout_); | 1022 check_timeout_); |
| 1024 } | 1023 } |
| OLD | NEW |