OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/chromeos/extensions/device_local_account_external_polic
y_loader.h" | 5 #include "chrome/browser/chromeos/extensions/device_local_account_external_polic
y_loader.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 DeviceLocalAccountExternalPolicyLoader::GetExternalCacheForTesting() { | 86 DeviceLocalAccountExternalPolicyLoader::GetExternalCacheForTesting() { |
87 return external_cache_.get(); | 87 return external_cache_.get(); |
88 } | 88 } |
89 | 89 |
90 DeviceLocalAccountExternalPolicyLoader:: | 90 DeviceLocalAccountExternalPolicyLoader:: |
91 ~DeviceLocalAccountExternalPolicyLoader() { | 91 ~DeviceLocalAccountExternalPolicyLoader() { |
92 DCHECK(!external_cache_); | 92 DCHECK(!external_cache_); |
93 } | 93 } |
94 | 94 |
95 void DeviceLocalAccountExternalPolicyLoader::UpdateExtensionListFromStore() { | 95 void DeviceLocalAccountExternalPolicyLoader::UpdateExtensionListFromStore() { |
96 scoped_ptr<base::DictionaryValue> prefs(new base::DictionaryValue); | 96 std::unique_ptr<base::DictionaryValue> prefs(new base::DictionaryValue); |
97 const policy::PolicyMap& policy_map = store_->policy_map(); | 97 const policy::PolicyMap& policy_map = store_->policy_map(); |
98 // TODO(binjin): Use two policy handlers here after | 98 // TODO(binjin): Use two policy handlers here after |
99 // ExtensionManagementPolicyHandler is introduced. | 99 // ExtensionManagementPolicyHandler is introduced. |
100 extensions::ExtensionInstallForcelistPolicyHandler policy_handler; | 100 extensions::ExtensionInstallForcelistPolicyHandler policy_handler; |
101 if (policy_handler.CheckPolicySettings(policy_map, NULL)) { | 101 if (policy_handler.CheckPolicySettings(policy_map, NULL)) { |
102 PrefValueMap pref_value_map; | 102 PrefValueMap pref_value_map; |
103 policy_handler.ApplyPolicySettings(policy_map, &pref_value_map); | 103 policy_handler.ApplyPolicySettings(policy_map, &pref_value_map); |
104 const base::Value* value = NULL; | 104 const base::Value* value = NULL; |
105 const base::DictionaryValue* dict = NULL; | 105 const base::DictionaryValue* dict = NULL; |
106 if (pref_value_map.GetValue(extensions::pref_names::kInstallForceList, | 106 if (pref_value_map.GetValue(extensions::pref_names::kInstallForceList, |
107 &value) && | 107 &value) && |
108 value->GetAsDictionary(&dict)) { | 108 value->GetAsDictionary(&dict)) { |
109 prefs.reset(dict->DeepCopy()); | 109 prefs.reset(dict->DeepCopy()); |
110 } | 110 } |
111 } | 111 } |
112 | 112 |
113 external_cache_->UpdateExtensionsList(std::move(prefs)); | 113 external_cache_->UpdateExtensionsList(std::move(prefs)); |
114 } | 114 } |
115 | 115 |
116 } // namespace chromeos | 116 } // namespace chromeos |
OLD | NEW |