OLD | NEW |
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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 // // permission supports detail, permission detail will be stored in value. | 621 // // permission supports detail, permission detail will be stored in value. |
622 // ... | 622 // ... |
623 // ] | 623 // ] |
624 template<typename T> | 624 template<typename T> |
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 std::unique_ptr<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(std::move(tmp)); |
634 } else { | 634 } else { |
635 values->AppendString(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, |
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |