| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 const std::vector<GURL>& urls, | 67 const std::vector<GURL>& urls, |
| 68 const std::vector<SBFullHash>& full_hashes, | 68 const std::vector<SBFullHash>& full_hashes, |
| 69 Client* client, | 69 Client* client, |
| 70 safe_browsing_util::ListType check_type) | 70 safe_browsing_util::ListType check_type) |
| 71 : urls(urls), | 71 : urls(urls), |
| 72 url_results(urls.size(), SB_THREAT_TYPE_SAFE), | 72 url_results(urls.size(), SB_THREAT_TYPE_SAFE), |
| 73 full_hashes(full_hashes), | 73 full_hashes(full_hashes), |
| 74 full_hash_results(full_hashes.size(), SB_THREAT_TYPE_SAFE), | 74 full_hash_results(full_hashes.size(), SB_THREAT_TYPE_SAFE), |
| 75 client(client), | 75 client(client), |
| 76 need_get_hash(false), | 76 need_get_hash(false), |
| 77 check_type(check_type), | 77 check_type(check_type) { |
| 78 timeout_factory_(NULL) { | |
| 79 DCHECK_EQ(urls.empty(), !full_hashes.empty()) | 78 DCHECK_EQ(urls.empty(), !full_hashes.empty()) |
| 80 << "Exactly one of urls and full_hashes must be set"; | 79 << "Exactly one of urls and full_hashes must be set"; |
| 81 } | 80 } |
| 82 | 81 |
| 83 SafeBrowsingDatabaseManager::SafeBrowsingCheck::~SafeBrowsingCheck() {} | 82 SafeBrowsingDatabaseManager::SafeBrowsingCheck::~SafeBrowsingCheck() {} |
| 84 | 83 |
| 85 void SafeBrowsingDatabaseManager::Client::OnSafeBrowsingResult( | 84 void SafeBrowsingDatabaseManager::Client::OnSafeBrowsingResult( |
| 86 const SafeBrowsingCheck& check) { | 85 const SafeBrowsingCheck& check) { |
| 87 DCHECK_EQ(check.urls.size(), check.url_results.size()); | 86 DCHECK_EQ(check.urls.size(), check.url_results.size()); |
| 88 DCHECK_EQ(check.full_hashes.size(), check.full_hash_results.size()); | 87 DCHECK_EQ(check.full_hashes.size(), check.full_hash_results.size()); |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this)); | 1048 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this)); |
| 1050 checks_.insert(check); | 1049 checks_.insert(check); |
| 1051 | 1050 |
| 1052 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); | 1051 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); |
| 1053 | 1052 |
| 1054 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, | 1053 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 1055 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, | 1054 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, |
| 1056 check->timeout_factory_->GetWeakPtr(), check), | 1055 check->timeout_factory_->GetWeakPtr(), check), |
| 1057 check_timeout_); | 1056 check_timeout_); |
| 1058 } | 1057 } |
| OLD | NEW |