| Index: components/policy/core/common/fake_async_policy_loader.cc
|
| diff --git a/components/policy/core/common/fake_async_policy_loader.cc b/components/policy/core/common/fake_async_policy_loader.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bef82868cb33c41be19fbdcc2751a3e38693e413
|
| --- /dev/null
|
| +++ b/components/policy/core/common/fake_async_policy_loader.cc
|
| @@ -0,0 +1,45 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "components/policy/core/common/fake_async_policy_loader.h"
|
| +
|
| +#include "base/bind.h"
|
| +#include "base/location.h"
|
| +#include "base/sequenced_task_runner.h"
|
| +
|
| +namespace policy {
|
| +
|
| +FakeAsyncPolicyLoader::FakeAsyncPolicyLoader(
|
| + scoped_refptr<base::SequencedTaskRunner> task_runner)
|
| + : AsyncPolicyLoader(task_runner) {
|
| +}
|
| +
|
| +scoped_ptr<PolicyBundle> FakeAsyncPolicyLoader::Load() {
|
| + scoped_ptr<PolicyBundle> result(new PolicyBundle());
|
| + result->CopyFrom(policy_bundle_);
|
| + return result.Pass();
|
| +}
|
| +
|
| +void FakeAsyncPolicyLoader::InitOnBackgroundThread() {
|
| + // Nothing to do.
|
| +}
|
| +
|
| +void FakeAsyncPolicyLoader::ClearPolicies() {
|
| + policy_bundle_.Clear();
|
| +}
|
| +
|
| +void FakeAsyncPolicyLoader::AddPolicies(const PolicyNamespace& ns,
|
| + const base::DictionaryValue& policies,
|
| + PolicyLevel level,
|
| + PolicyScope scope) {
|
| + PolicyMap& policy_map = policy_bundle_.Get(ns);
|
| + policy_map.LoadFrom(&policies, level, scope);
|
| +}
|
| +
|
| +void FakeAsyncPolicyLoader::PostReloadOnBackgroundThread(bool force) {
|
| + task_runner()->PostTask(FROM_HERE, base::Bind(&AsyncPolicyLoader::Reload,
|
| + base::Unretained(this), force));
|
| +}
|
| +
|
| +} // namespace policy
|
|
|