| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 switch (threat) { | 81 switch (threat) { |
| 82 case safe_browsing_util::INVALID: | 82 case safe_browsing_util::INVALID: |
| 83 // |full_hashes| should never contain INVALID as a |list_id|. | 83 // |full_hashes| should never contain INVALID as a |list_id|. |
| 84 NOTREACHED(); | 84 NOTREACHED(); |
| 85 break; | 85 break; |
| 86 case safe_browsing_util::MALWARE: // Falls through. | 86 case safe_browsing_util::MALWARE: // Falls through. |
| 87 case safe_browsing_util::PHISH: // Falls through. | 87 case safe_browsing_util::PHISH: // Falls through. |
| 88 case safe_browsing_util::BINURL: // Falls through. | 88 case safe_browsing_util::BINURL: // Falls through. |
| 89 case safe_browsing_util::CSDWHITELIST: // Falls through. | 89 case safe_browsing_util::CSDWHITELIST: // Falls through. |
| 90 case safe_browsing_util::DOWNLOADWHITELIST: // Falls through. | 90 case safe_browsing_util::DOWNLOADWHITELIST: // Falls through. |
| 91 case safe_browsing_util::INCLUSIONWHITELIST: // Falls through. |
| 91 case safe_browsing_util::EXTENSIONBLACKLIST: // Falls through. | 92 case safe_browsing_util::EXTENSIONBLACKLIST: // Falls through. |
| 92 case safe_browsing_util::SIDEEFFECTFREEWHITELIST: // Falls through. | 93 case safe_browsing_util::SIDEEFFECTFREEWHITELIST: // Falls through. |
| 93 case safe_browsing_util::IPBLACKLIST: | 94 case safe_browsing_util::IPBLACKLIST: |
| 94 if (index) | 95 if (index) |
| 95 *index = i; | 96 *index = i; |
| 96 return threat; | 97 return threat; |
| 97 case safe_browsing_util::UNWANTEDURL: | 98 case safe_browsing_util::UNWANTEDURL: |
| 98 // UNWANTEDURL is considered less severe than other threats, keep | 99 // UNWANTEDURL is considered less severe than other threats, keep |
| 99 // looking. | 100 // looking. |
| 100 pending_threat = threat; | 101 pending_threat = threat; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 126 SBFullHashForString(patterns[i]), full_hashes, index); | 127 SBFullHashForString(patterns[i]), full_hashes, index); |
| 127 switch (threat) { | 128 switch (threat) { |
| 128 case safe_browsing_util::INVALID: | 129 case safe_browsing_util::INVALID: |
| 129 // Ignore patterns with no matching threat. | 130 // Ignore patterns with no matching threat. |
| 130 break; | 131 break; |
| 131 case safe_browsing_util::MALWARE: // Falls through. | 132 case safe_browsing_util::MALWARE: // Falls through. |
| 132 case safe_browsing_util::PHISH: // Falls through. | 133 case safe_browsing_util::PHISH: // Falls through. |
| 133 case safe_browsing_util::BINURL: // Falls through. | 134 case safe_browsing_util::BINURL: // Falls through. |
| 134 case safe_browsing_util::CSDWHITELIST: // Falls through. | 135 case safe_browsing_util::CSDWHITELIST: // Falls through. |
| 135 case safe_browsing_util::DOWNLOADWHITELIST: // Falls through. | 136 case safe_browsing_util::DOWNLOADWHITELIST: // Falls through. |
| 137 case safe_browsing_util::INCLUSIONWHITELIST: // Falls through. |
| 136 case safe_browsing_util::EXTENSIONBLACKLIST: // Falls through. | 138 case safe_browsing_util::EXTENSIONBLACKLIST: // Falls through. |
| 137 case safe_browsing_util::SIDEEFFECTFREEWHITELIST: // Falls through. | 139 case safe_browsing_util::SIDEEFFECTFREEWHITELIST: // Falls through. |
| 138 case safe_browsing_util::IPBLACKLIST: | 140 case safe_browsing_util::IPBLACKLIST: |
| 139 return threat; | 141 return threat; |
| 140 case safe_browsing_util::UNWANTEDURL: | 142 case safe_browsing_util::UNWANTEDURL: |
| 141 // UNWANTEDURL is considered less severe than other threats, keep | 143 // UNWANTEDURL is considered less severe than other threats, keep |
| 142 // looking. | 144 // looking. |
| 143 pending_threat = threat; | 145 pending_threat = threat; |
| 144 break; | 146 break; |
| 145 } | 147 } |
| (...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this)); | 1162 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this)); |
| 1161 checks_.insert(check); | 1163 checks_.insert(check); |
| 1162 | 1164 |
| 1163 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); | 1165 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); |
| 1164 | 1166 |
| 1165 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, | 1167 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 1166 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, | 1168 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, |
| 1167 check->timeout_factory_->GetWeakPtr(), check), | 1169 check->timeout_factory_->GetWeakPtr(), check), |
| 1168 check_timeout_); | 1170 check_timeout_); |
| 1169 } | 1171 } |
| OLD | NEW |