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

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

Issue 2259523003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 std::unique_ptr<TPIncident> incident( 60 std::unique_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_, base::WrapUnique(new TrackedPreferenceIncident( 70 profile_, base::MakeUnique<TrackedPreferenceIncident>(
71 std::move(incident), is_personal))); 71 std::move(incident), is_personal));
72 } 72 }
73 } 73 }
74 74
75 void PreferenceValidationDelegate::OnSplitPreferenceValidation( 75 void PreferenceValidationDelegate::OnSplitPreferenceValidation(
76 const std::string& pref_path, 76 const std::string& pref_path,
77 const base::DictionaryValue* /* dict_value */, 77 const base::DictionaryValue* /* dict_value */,
78 const std::vector<std::string>& invalid_keys, 78 const std::vector<std::string>& invalid_keys,
79 PrefHashStoreTransaction::ValueState value_state, 79 PrefHashStoreTransaction::ValueState value_state,
80 bool is_personal) { 80 bool is_personal) {
81 TPIncident_ValueState proto_value_state = MapValueState(value_state); 81 TPIncident_ValueState proto_value_state = MapValueState(value_state);
82 if (proto_value_state != TPIncident::UNKNOWN) { 82 if (proto_value_state != TPIncident::UNKNOWN) {
83 std::unique_ptr<ClientIncidentReport_IncidentData_TrackedPreferenceIncident> 83 std::unique_ptr<ClientIncidentReport_IncidentData_TrackedPreferenceIncident>
84 incident( 84 incident(
85 new ClientIncidentReport_IncidentData_TrackedPreferenceIncident()); 85 new ClientIncidentReport_IncidentData_TrackedPreferenceIncident());
86 incident->set_path(pref_path); 86 incident->set_path(pref_path);
87 for (std::vector<std::string>::const_iterator scan(invalid_keys.begin()); 87 for (std::vector<std::string>::const_iterator scan(invalid_keys.begin());
88 scan != invalid_keys.end(); 88 scan != invalid_keys.end();
89 ++scan) { 89 ++scan) {
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_, base::WrapUnique(new TrackedPreferenceIncident( 94 profile_, base::MakeUnique<TrackedPreferenceIncident>(
95 std::move(incident), is_personal))); 95 std::move(incident), is_personal));
96 } 96 }
97 } 97 }
98 98
99 } // namespace safe_browsing 99 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698