| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const base::Value* value, | 55 const base::Value* value, |
| 56 PrefHashStoreTransaction::ValueState value_state, | 56 PrefHashStoreTransaction::ValueState value_state, |
| 57 bool is_personal) { | 57 bool is_personal) { |
| 58 TPIncident_ValueState proto_value_state = MapValueState(value_state); | 58 TPIncident_ValueState proto_value_state = MapValueState(value_state); |
| 59 if (proto_value_state != TPIncident::UNKNOWN) { | 59 if (proto_value_state != TPIncident::UNKNOWN) { |
| 60 scoped_ptr<TPIncident> incident( | 60 scoped_ptr<TPIncident> incident( |
| 61 new ClientIncidentReport_IncidentData_TrackedPreferenceIncident()); | 61 new ClientIncidentReport_IncidentData_TrackedPreferenceIncident()); |
| 62 incident->set_path(pref_path); | 62 incident->set_path(pref_path); |
| 63 if (!value || | 63 if (!value || |
| 64 (!value->GetAsString(incident->mutable_atomic_value()) && | 64 (!value->GetAsString(incident->mutable_atomic_value()) && |
| 65 !base::JSONWriter::Write(value, incident->mutable_atomic_value()))) { | 65 !base::JSONWriter::Write(*value, incident->mutable_atomic_value()))) { |
| 66 incident->clear_atomic_value(); | 66 incident->clear_atomic_value(); |
| 67 } | 67 } |
| 68 incident->set_value_state(proto_value_state); | 68 incident->set_value_state(proto_value_state); |
| 69 incident_receiver_->AddIncidentForProfile( | 69 incident_receiver_->AddIncidentForProfile( |
| 70 profile_, make_scoped_ptr(new TrackedPreferenceIncident(incident.Pass(), | 70 profile_, make_scoped_ptr(new TrackedPreferenceIncident(incident.Pass(), |
| 71 is_personal))); | 71 is_personal))); |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 void PreferenceValidationDelegate::OnSplitPreferenceValidation( | 75 void PreferenceValidationDelegate::OnSplitPreferenceValidation( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 90 incident->add_split_key(*scan); | 90 incident->add_split_key(*scan); |
| 91 } | 91 } |
| 92 incident->set_value_state(proto_value_state); | 92 incident->set_value_state(proto_value_state); |
| 93 incident_receiver_->AddIncidentForProfile( | 93 incident_receiver_->AddIncidentForProfile( |
| 94 profile_, make_scoped_ptr(new TrackedPreferenceIncident(incident.Pass(), | 94 profile_, make_scoped_ptr(new TrackedPreferenceIncident(incident.Pass(), |
| 95 is_personal))); | 95 is_personal))); |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace safe_browsing | 99 } // namespace safe_browsing |
| OLD | NEW |