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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 url_key, GURL(), CONTENT_SETTINGS_TYPE_PASSWORD_PROTECTION, | 350 url_key, GURL(), CONTENT_SETTINGS_TYPE_PASSWORD_PROTECTION, |
351 std::string(), nullptr)); | 351 std::string(), nullptr)); |
352 | 352 |
353 // Move on if we have no cached verdict for this deleted history row. | 353 // Move on if we have no cached verdict for this deleted history row. |
354 if (!verdict_dictionary.get() || verdict_dictionary->empty()) | 354 if (!verdict_dictionary.get() || verdict_dictionary->empty()) |
355 continue; | 355 continue; |
356 | 356 |
357 int verdict_count = static_cast<int>(verdict_dictionary->size()); | 357 int verdict_count = static_cast<int>(verdict_dictionary->size()); |
358 stored_verdict_count_ = GetStoredVerdictCount() - verdict_count; | 358 stored_verdict_count_ = GetStoredVerdictCount() - verdict_count; |
359 content_settings_->ClearSettingsForOneTypeWithPredicate( | 359 content_settings_->ClearSettingsForOneTypeWithPredicate( |
360 CONTENT_SETTINGS_TYPE_PASSWORD_PROTECTION, | 360 CONTENT_SETTINGS_TYPE_PASSWORD_PROTECTION, base::Time(), |
361 base::Bind(&OriginMatchPrimaryPattern, url_key)); | 361 base::Bind(&OriginMatchPrimaryPattern, url_key)); |
362 } | 362 } |
363 } | 363 } |
364 | 364 |
365 // static | 365 // static |
366 bool PasswordProtectionService::ParseVerdictEntry( | 366 bool PasswordProtectionService::ParseVerdictEntry( |
367 base::DictionaryValue* verdict_entry, | 367 base::DictionaryValue* verdict_entry, |
368 int* out_verdict_received_time, | 368 int* out_verdict_received_time, |
369 LoginReputationClientResponse* out_verdict) { | 369 LoginReputationClientResponse* out_verdict) { |
370 base::Value* binary_value = nullptr; | 370 base::Value* binary_value = nullptr; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 const std::vector<char> verdict_blob(serialized_proto.begin(), | 446 const std::vector<char> verdict_blob(serialized_proto.begin(), |
447 serialized_proto.end()); | 447 serialized_proto.end()); |
448 std::unique_ptr<base::Value> binary_value = | 448 std::unique_ptr<base::Value> binary_value = |
449 base::MakeUnique<base::Value>(verdict_blob); | 449 base::MakeUnique<base::Value>(verdict_blob); |
450 DCHECK_EQ(base::Value::Type::BINARY, binary_value->type()); | 450 DCHECK_EQ(base::Value::Type::BINARY, binary_value->type()); |
451 result->Set(kVerdictProto, std::move(binary_value)); | 451 result->Set(kVerdictProto, std::move(binary_value)); |
452 return result; | 452 return result; |
453 } | 453 } |
454 | 454 |
455 } // namespace safe_browsing | 455 } // namespace safe_browsing |
OLD | NEW |