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 "chrome/browser/extensions/extension_management_test_util.h" | 5 #include "chrome/browser/extensions/extension_management_test_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
8 | 9 |
9 #include "components/crx_file/id_util.h" | 10 #include "components/crx_file/id_util.h" |
10 #include "components/policy/core/common/configuration_policy_provider.h" | 11 #include "components/policy/core/common/configuration_policy_provider.h" |
11 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 12 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
12 #include "components/policy/core/common/policy_bundle.h" | 13 #include "components/policy/core/common/policy_bundle.h" |
13 #include "components/policy/core/common/policy_map.h" | 14 #include "components/policy/core/common/policy_map.h" |
14 #include "components/policy/core/common/policy_namespace.h" | 15 #include "components/policy/core/common/policy_namespace.h" |
15 #include "components/policy/core/common/policy_types.h" | 16 #include "components/policy/core/common/policy_types.h" |
16 #include "policy/policy_constants.h" | 17 #include "policy/policy_constants.h" |
17 | 18 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 210 } |
210 | 211 |
211 // Private section functions --------------------------------------------------- | 212 // Private section functions --------------------------------------------------- |
212 | 213 |
213 void ExtensionManagementPrefUpdaterBase::SetPref(base::DictionaryValue* pref) { | 214 void ExtensionManagementPrefUpdaterBase::SetPref(base::DictionaryValue* pref) { |
214 pref_.reset(pref); | 215 pref_.reset(pref); |
215 } | 216 } |
216 | 217 |
217 scoped_ptr<base::DictionaryValue> | 218 scoped_ptr<base::DictionaryValue> |
218 ExtensionManagementPrefUpdaterBase::TakePref() { | 219 ExtensionManagementPrefUpdaterBase::TakePref() { |
219 return pref_.Pass(); | 220 return std::move(pref_); |
220 } | 221 } |
221 | 222 |
222 void ExtensionManagementPrefUpdaterBase::ClearList(const std::string& path) { | 223 void ExtensionManagementPrefUpdaterBase::ClearList(const std::string& path) { |
223 pref_->Set(path, new base::ListValue()); | 224 pref_->Set(path, new base::ListValue()); |
224 } | 225 } |
225 | 226 |
226 void ExtensionManagementPrefUpdaterBase::AddStringToList( | 227 void ExtensionManagementPrefUpdaterBase::AddStringToList( |
227 const std::string& path, | 228 const std::string& path, |
228 const std::string& str) { | 229 const std::string& str) { |
229 base::ListValue* list_value = nullptr; | 230 base::ListValue* list_value = nullptr; |
(...skipping 28 matching lines...) Expand all Loading... |
258 else | 259 else |
259 SetPref(new base::DictionaryValue); | 260 SetPref(new base::DictionaryValue); |
260 } | 261 } |
261 | 262 |
262 ExtensionManagementPolicyUpdater::~ExtensionManagementPolicyUpdater() { | 263 ExtensionManagementPolicyUpdater::~ExtensionManagementPolicyUpdater() { |
263 policies_->Get(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, | 264 policies_->Get(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, |
264 std::string())) | 265 std::string())) |
265 .Set(policy::key::kExtensionSettings, policy::POLICY_LEVEL_MANDATORY, | 266 .Set(policy::key::kExtensionSettings, policy::POLICY_LEVEL_MANDATORY, |
266 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, | 267 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, |
267 TakePref().release(), nullptr); | 268 TakePref().release(), nullptr); |
268 provider_->UpdatePolicy(policies_.Pass()); | 269 provider_->UpdatePolicy(std::move(policies_)); |
269 } | 270 } |
270 | 271 |
271 } // namespace extensions | 272 } // namespace extensions |
OLD | NEW |