| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "components/safe_browsing/password_protection/password_protection_servi
ce.h" | 5 #include "components/safe_browsing/password_protection/password_protection_servi
ce.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 url_key, GURL(), CONTENT_SETTINGS_TYPE_PASSWORD_PROTECTION, | 343 url_key, GURL(), CONTENT_SETTINGS_TYPE_PASSWORD_PROTECTION, |
| 344 std::string(), nullptr)); | 344 std::string(), nullptr)); |
| 345 | 345 |
| 346 // Move on if we have no cached verdict for this deleted history row. | 346 // Move on if we have no cached verdict for this deleted history row. |
| 347 if (!verdict_dictionary.get() || verdict_dictionary->empty()) | 347 if (!verdict_dictionary.get() || verdict_dictionary->empty()) |
| 348 continue; | 348 continue; |
| 349 | 349 |
| 350 int verdict_count = static_cast<int>(verdict_dictionary->size()); | 350 int verdict_count = static_cast<int>(verdict_dictionary->size()); |
| 351 stored_verdict_count_ = GetStoredVerdictCount() - verdict_count; | 351 stored_verdict_count_ = GetStoredVerdictCount() - verdict_count; |
| 352 content_settings_->ClearSettingsForOneTypeWithPredicate( | 352 content_settings_->ClearSettingsForOneTypeWithPredicate( |
| 353 CONTENT_SETTINGS_TYPE_PASSWORD_PROTECTION, | 353 CONTENT_SETTINGS_TYPE_PASSWORD_PROTECTION, base::Time(), |
| 354 base::Bind(&OriginMatchPrimaryPattern, url_key)); | 354 base::Bind(&OriginMatchPrimaryPattern, url_key)); |
| 355 } | 355 } |
| 356 } | 356 } |
| 357 | 357 |
| 358 // static | 358 // static |
| 359 bool PasswordProtectionService::ParseVerdictEntry( | 359 bool PasswordProtectionService::ParseVerdictEntry( |
| 360 base::DictionaryValue* verdict_entry, | 360 base::DictionaryValue* verdict_entry, |
| 361 int* out_verdict_received_time, | 361 int* out_verdict_received_time, |
| 362 LoginReputationClientResponse* out_verdict) { | 362 LoginReputationClientResponse* out_verdict) { |
| 363 base::Value* binary_value = nullptr; | 363 base::Value* binary_value = nullptr; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 const std::vector<char> verdict_blob(serialized_proto.begin(), | 450 const std::vector<char> verdict_blob(serialized_proto.begin(), |
| 451 serialized_proto.end()); | 451 serialized_proto.end()); |
| 452 std::unique_ptr<base::Value> binary_value = | 452 std::unique_ptr<base::Value> binary_value = |
| 453 base::MakeUnique<base::Value>(verdict_blob); | 453 base::MakeUnique<base::Value>(verdict_blob); |
| 454 DCHECK_EQ(base::Value::Type::BINARY, binary_value->type()); | 454 DCHECK_EQ(base::Value::Type::BINARY, binary_value->type()); |
| 455 result->Set(kVerdictProto, std::move(binary_value)); | 455 result->Set(kVerdictProto, std::move(binary_value)); |
| 456 return result; | 456 return result; |
| 457 } | 457 } |
| 458 | 458 |
| 459 } // namespace safe_browsing | 459 } // namespace safe_browsing |
| OLD | NEW |