OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/incident_reporting/preference_validation_
delegate.h" | 5 #include "chrome/browser/safe_browsing/incident_reporting/preference_validation_
delegate.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 PreferenceValidationDelegate::PreferenceValidationDelegate( | 55 PreferenceValidationDelegate::PreferenceValidationDelegate( |
56 Profile* profile, | 56 Profile* profile, |
57 std::unique_ptr<IncidentReceiver> incident_receiver) | 57 std::unique_ptr<IncidentReceiver> incident_receiver) |
58 : profile_(profile), incident_receiver_(std::move(incident_receiver)) {} | 58 : profile_(profile), incident_receiver_(std::move(incident_receiver)) {} |
59 | 59 |
60 PreferenceValidationDelegate::~PreferenceValidationDelegate() { | 60 PreferenceValidationDelegate::~PreferenceValidationDelegate() { |
61 } | 61 } |
62 | 62 |
63 void PreferenceValidationDelegate::OnAtomicPreferenceValidation( | 63 void PreferenceValidationDelegate::OnAtomicPreferenceValidation( |
64 const std::string& pref_path, | 64 const std::string& pref_path, |
65 std::unique_ptr<base::Value> value, | 65 const base::Optional<base::Value>& value, |
66 ValueState value_state, | 66 ValueState value_state, |
67 ValueState external_validation_value_state, | 67 ValueState external_validation_value_state, |
68 bool is_personal) { | 68 bool is_personal) { |
69 TPIncident_ValueState proto_value_state = | 69 TPIncident_ValueState proto_value_state = |
70 MapValueState(value_state, external_validation_value_state); | 70 MapValueState(value_state, external_validation_value_state); |
71 if (proto_value_state != TPIncident::UNKNOWN) { | 71 if (proto_value_state != TPIncident::UNKNOWN) { |
72 std::unique_ptr<TPIncident> incident( | 72 std::unique_ptr<TPIncident> incident( |
73 new ClientIncidentReport_IncidentData_TrackedPreferenceIncident()); | 73 new ClientIncidentReport_IncidentData_TrackedPreferenceIncident()); |
74 incident->set_path(pref_path); | 74 incident->set_path(pref_path); |
75 if (!value || | 75 if (!value || |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 } | 113 } |
114 incident->set_value_state(proto_value_state); | 114 incident->set_value_state(proto_value_state); |
115 incident_receiver_->AddIncidentForProfile( | 115 incident_receiver_->AddIncidentForProfile( |
116 profile_, base::MakeUnique<TrackedPreferenceIncident>( | 116 profile_, base::MakeUnique<TrackedPreferenceIncident>( |
117 std::move(incident), is_personal)); | 117 std::move(incident), is_personal)); |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 } // namespace safe_browsing | 121 } // namespace safe_browsing |
OLD | NEW |