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/synchronization/cancellation_flag.h" | 10 #include "base/synchronization/cancellation_flag.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 dict.Set(kEnabledExtensions, list); | 193 dict.Set(kEnabledExtensions, list); |
194 } | 194 } |
195 | 195 |
196 if (field_mask & ResettableSettingsSnapshot::SHORTCUTS) { | 196 if (field_mask & ResettableSettingsSnapshot::SHORTCUTS) { |
197 base::ListValue* list = new base::ListValue; | 197 base::ListValue* list = new base::ListValue; |
198 const std::vector<ShortcutCommand>& shortcuts = snapshot.shortcuts(); | 198 const std::vector<ShortcutCommand>& shortcuts = snapshot.shortcuts(); |
199 for (std::vector<ShortcutCommand>::const_iterator i = shortcuts.begin(); | 199 for (std::vector<ShortcutCommand>::const_iterator i = shortcuts.begin(); |
200 i != shortcuts.end(); ++i) { | 200 i != shortcuts.end(); ++i) { |
201 base::string16 arguments; | 201 base::string16 arguments; |
202 // Replace "\"" to simplify server-side analysis. | 202 // Replace "\"" to simplify server-side analysis. |
203 base::ReplaceChars(i->second, base::ASCIIToUTF16("\"").c_str(), | 203 base::ReplaceChars(i->second, base::ASCIIToUTF16("\""), |
204 base::ASCIIToUTF16("\'"), &arguments); | 204 base::ASCIIToUTF16("\'"), &arguments); |
205 list->AppendString(arguments); | 205 list->AppendString(arguments); |
206 } | 206 } |
207 dict.Set(kShortcuts, list); | 207 dict.Set(kShortcuts, list); |
208 } | 208 } |
209 | 209 |
210 COMPILE_ASSERT(ResettableSettingsSnapshot::ALL_FIELDS == 31, | 210 COMPILE_ASSERT(ResettableSettingsSnapshot::ALL_FIELDS == 31, |
211 serialize_new_field_here); | 211 serialize_new_field_here); |
212 | 212 |
213 std::string json; | 213 std::string json; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 extension_names += '\n'; | 347 extension_names += '\n'; |
348 extension_names += i->second; | 348 extension_names += i->second; |
349 } | 349 } |
350 if (!extension_names.empty()) { | 350 if (!extension_names.empty()) { |
351 AddPair(list.get(), | 351 AddPair(list.get(), |
352 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_EXTENSIONS), | 352 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_EXTENSIONS), |
353 extension_names); | 353 extension_names); |
354 } | 354 } |
355 return list.Pass(); | 355 return list.Pass(); |
356 } | 356 } |
OLD | NEW |