OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/profile_resetter/resettable_settings_snapshot.h" | 5 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 dict.SetString(kDefaultSearchEnginePath, snapshot.dse_url()); | 131 dict.SetString(kDefaultSearchEnginePath, snapshot.dse_url()); |
132 | 132 |
133 if (field_mask & ResettableSettingsSnapshot::EXTENSIONS) { | 133 if (field_mask & ResettableSettingsSnapshot::EXTENSIONS) { |
134 ListValue* list = new ListValue; | 134 ListValue* list = new ListValue; |
135 const ResettableSettingsSnapshot::ExtensionList& extensions = | 135 const ResettableSettingsSnapshot::ExtensionList& extensions = |
136 snapshot.enabled_extensions(); | 136 snapshot.enabled_extensions(); |
137 for (ResettableSettingsSnapshot::ExtensionList::const_iterator i = | 137 for (ResettableSettingsSnapshot::ExtensionList::const_iterator i = |
138 extensions.begin(); i != extensions.end(); ++i) { | 138 extensions.begin(); i != extensions.end(); ++i) { |
139 // Replace "\"" to simplify server-side analysis. | 139 // Replace "\"" to simplify server-side analysis. |
140 std::string ext_name; | 140 std::string ext_name; |
141 ReplaceChars(i->second, "\"", "\'", &ext_name); | 141 base::ReplaceChars(i->second, "\"", "\'", &ext_name); |
142 list->AppendString(i->first + ";" + ext_name); | 142 list->AppendString(i->first + ";" + ext_name); |
143 } | 143 } |
144 dict.Set(kEnabledExtensions, list); | 144 dict.Set(kEnabledExtensions, list); |
145 } | 145 } |
146 | 146 |
147 COMPILE_ASSERT(ResettableSettingsSnapshot::ALL_FIELDS == 15, | 147 COMPILE_ASSERT(ResettableSettingsSnapshot::ALL_FIELDS == 15, |
148 serialize_new_field_here); | 148 serialize_new_field_here); |
149 | 149 |
150 std::string json; | 150 std::string json; |
151 base::JSONWriter::Write(&dict, &json); | 151 base::JSONWriter::Write(&dict, &json); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 (extension_names += i->second) += '\n'; | 257 (extension_names += i->second) += '\n'; |
258 } | 258 } |
259 if (!extension_names.empty()) { | 259 if (!extension_names.empty()) { |
260 extension_names.erase(extension_names.end() - 1); | 260 extension_names.erase(extension_names.end() - 1); |
261 AddPair(list, | 261 AddPair(list, |
262 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_EXTENSIONS), | 262 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_EXTENSIONS), |
263 extension_names); | 263 extension_names); |
264 } | 264 } |
265 return list; | 265 return list; |
266 } | 266 } |
OLD | NEW |