Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Side by Side Diff: chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/profile_resetter/resettable_settings_snapshot.cc ('k') | chrome/browser/safe_json_parser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698