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

Side by Side Diff: extensions/browser/extension_prefs.cc

Issue 2037703004: Remove ListValue::Append(new {Fundamental,String}Value(...)) pattern in //extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « extensions/browser/event_router.cc ('k') | extensions/browser/quota_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "extensions/browser/extension_prefs.h" 5 #include "extensions/browser/extension_prefs.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <iterator> 10 #include <iterator>
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 static base::ListValue* CreatePermissionList(const T& permissions) { 625 static base::ListValue* CreatePermissionList(const T& permissions) {
626 base::ListValue* values = new base::ListValue(); 626 base::ListValue* values = new base::ListValue();
627 for (typename T::const_iterator i = permissions.begin(); 627 for (typename T::const_iterator i = permissions.begin();
628 i != permissions.end(); ++i) { 628 i != permissions.end(); ++i) {
629 std::unique_ptr<base::Value> detail(i->ToValue()); 629 std::unique_ptr<base::Value> detail(i->ToValue());
630 if (detail) { 630 if (detail) {
631 base::DictionaryValue* tmp = new base::DictionaryValue(); 631 base::DictionaryValue* tmp = new base::DictionaryValue();
632 tmp->Set(i->name(), detail.release()); 632 tmp->Set(i->name(), detail.release());
633 values->Append(tmp); 633 values->Append(tmp);
634 } else { 634 } else {
635 values->Append(new base::StringValue(i->name())); 635 values->AppendString(i->name());
636 } 636 }
637 } 637 }
638 return values; 638 return values;
639 } 639 }
640 640
641 void ExtensionPrefs::SetExtensionPrefPermissionSet( 641 void ExtensionPrefs::SetExtensionPrefPermissionSet(
642 const std::string& extension_id, 642 const std::string& extension_id,
643 const std::string& pref_key, 643 const std::string& pref_key,
644 const PermissionSet& new_value) { 644 const PermissionSet& new_value) {
645 std::string api_pref = JoinPrefs(pref_key, kPrefAPIs); 645 std::string api_pref = JoinPrefs(pref_key, kPrefAPIs);
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1831 1831
1832 template <class ExtensionIdContainer> 1832 template <class ExtensionIdContainer>
1833 void ExtensionPrefs::SetExtensionPrefFromContainer( 1833 void ExtensionPrefs::SetExtensionPrefFromContainer(
1834 const char* pref, 1834 const char* pref,
1835 const ExtensionIdContainer& strings) { 1835 const ExtensionIdContainer& strings) {
1836 ListPrefUpdate update(prefs_, pref); 1836 ListPrefUpdate update(prefs_, pref);
1837 base::ListValue* list_of_values = update.Get(); 1837 base::ListValue* list_of_values = update.Get();
1838 list_of_values->Clear(); 1838 list_of_values->Clear();
1839 for (typename ExtensionIdContainer::const_iterator iter = strings.begin(); 1839 for (typename ExtensionIdContainer::const_iterator iter = strings.begin();
1840 iter != strings.end(); ++iter) { 1840 iter != strings.end(); ++iter) {
1841 list_of_values->Append(new base::StringValue(*iter)); 1841 list_of_values->AppendString(*iter);
1842 } 1842 }
1843 } 1843 }
1844 1844
1845 void ExtensionPrefs::PopulateExtensionInfoPrefs( 1845 void ExtensionPrefs::PopulateExtensionInfoPrefs(
1846 const Extension* extension, 1846 const Extension* extension,
1847 const base::Time install_time, 1847 const base::Time install_time,
1848 Extension::State initial_state, 1848 Extension::State initial_state,
1849 int install_flags, 1849 int install_flags,
1850 const std::string& install_parameter, 1850 const std::string& install_parameter,
1851 base::DictionaryValue* extension_dict) const { 1851 base::DictionaryValue* extension_dict) const {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1986 extension_pref_value_map_->RegisterExtension( 1986 extension_pref_value_map_->RegisterExtension(
1987 extension_id, install_time, is_enabled, is_incognito_enabled); 1987 extension_id, install_time, is_enabled, is_incognito_enabled);
1988 1988
1989 FOR_EACH_OBSERVER( 1989 FOR_EACH_OBSERVER(
1990 ExtensionPrefsObserver, 1990 ExtensionPrefsObserver,
1991 observer_list_, 1991 observer_list_,
1992 OnExtensionRegistered(extension_id, install_time, is_enabled)); 1992 OnExtensionRegistered(extension_id, install_time, is_enabled));
1993 } 1993 }
1994 1994
1995 } // namespace extensions 1995 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/event_router.cc ('k') | extensions/browser/quota_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698