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 #include <utility> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 226 } |
227 | 227 |
228 void ExtensionManagementPrefUpdaterBase::AddStringToList( | 228 void ExtensionManagementPrefUpdaterBase::AddStringToList( |
229 const std::string& path, | 229 const std::string& path, |
230 const std::string& str) { | 230 const std::string& str) { |
231 base::ListValue* list_value = nullptr; | 231 base::ListValue* list_value = nullptr; |
232 if (!pref_->GetList(path, &list_value)) { | 232 if (!pref_->GetList(path, &list_value)) { |
233 list_value = new base::ListValue(); | 233 list_value = new base::ListValue(); |
234 pref_->Set(path, list_value); | 234 pref_->Set(path, list_value); |
235 } | 235 } |
236 CHECK( | 236 CHECK(list_value->AppendIfNotPresent(base::MakeUnique<base::Value>(str))); |
237 list_value->AppendIfNotPresent(base::MakeUnique<base::StringValue>(str))); | |
238 } | 237 } |
239 | 238 |
240 void ExtensionManagementPrefUpdaterBase::RemoveStringFromList( | 239 void ExtensionManagementPrefUpdaterBase::RemoveStringFromList( |
241 const std::string& path, | 240 const std::string& path, |
242 const std::string& str) { | 241 const std::string& str) { |
243 base::ListValue* list_value = nullptr; | 242 base::ListValue* list_value = nullptr; |
244 if (pref_->GetList(path, &list_value)) | 243 if (pref_->GetList(path, &list_value)) |
245 CHECK(list_value->Remove(base::StringValue(str), nullptr)); | 244 CHECK(list_value->Remove(base::Value(str), nullptr)); |
246 } | 245 } |
247 | 246 |
248 // ExtensionManagementPolicyUpdater -------------------------------------------- | 247 // ExtensionManagementPolicyUpdater -------------------------------------------- |
249 | 248 |
250 ExtensionManagementPolicyUpdater::ExtensionManagementPolicyUpdater( | 249 ExtensionManagementPolicyUpdater::ExtensionManagementPolicyUpdater( |
251 policy::MockConfigurationPolicyProvider* policy_provider) | 250 policy::MockConfigurationPolicyProvider* policy_provider) |
252 : provider_(policy_provider), policies_(new policy::PolicyBundle) { | 251 : provider_(policy_provider), policies_(new policy::PolicyBundle) { |
253 policies_->CopyFrom(provider_->policies()); | 252 policies_->CopyFrom(provider_->policies()); |
254 const base::Value* policy_value = | 253 const base::Value* policy_value = |
255 policies_->Get(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, | 254 policies_->Get(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, |
(...skipping 10 matching lines...) Expand all Loading... |
266 policies_ | 265 policies_ |
267 ->Get( | 266 ->Get( |
268 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string())) | 267 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string())) |
269 .Set(policy::key::kExtensionSettings, policy::POLICY_LEVEL_MANDATORY, | 268 .Set(policy::key::kExtensionSettings, policy::POLICY_LEVEL_MANDATORY, |
270 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, TakePref(), | 269 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, TakePref(), |
271 nullptr); | 270 nullptr); |
272 provider_->UpdatePolicy(std::move(policies_)); | 271 provider_->UpdatePolicy(std::move(policies_)); |
273 } | 272 } |
274 | 273 |
275 } // namespace extensions | 274 } // namespace extensions |
OLD | NEW |