| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/policy/core/common/fake_async_policy_loader.h" | 5 #include "components/policy/core/common/fake_async_policy_loader.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
| 10 | 10 |
| 11 namespace policy { | 11 namespace policy { |
| 12 | 12 |
| 13 FakeAsyncPolicyLoader::FakeAsyncPolicyLoader( | 13 FakeAsyncPolicyLoader::FakeAsyncPolicyLoader( |
| 14 const scoped_refptr<base::SequencedTaskRunner>& task_runner) | 14 const scoped_refptr<base::SequencedTaskRunner>& task_runner) |
| 15 : AsyncPolicyLoader(task_runner) { | 15 : AsyncPolicyLoader(task_runner) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 scoped_ptr<PolicyBundle> FakeAsyncPolicyLoader::Load() { | 18 scoped_ptr<PolicyBundle> FakeAsyncPolicyLoader::Load() { |
| 19 scoped_ptr<PolicyBundle> result(new PolicyBundle()); | 19 scoped_ptr<PolicyBundle> result(new PolicyBundle()); |
| 20 result->CopyFrom(policy_bundle_); | 20 result->CopyFrom(policy_bundle_); |
| 21 return result.Pass(); | 21 return result; |
| 22 } | 22 } |
| 23 | 23 |
| 24 void FakeAsyncPolicyLoader::InitOnBackgroundThread() { | 24 void FakeAsyncPolicyLoader::InitOnBackgroundThread() { |
| 25 // Nothing to do. | 25 // Nothing to do. |
| 26 } | 26 } |
| 27 | 27 |
| 28 void FakeAsyncPolicyLoader::SetPolicies(const PolicyBundle& policy_bundle) { | 28 void FakeAsyncPolicyLoader::SetPolicies(const PolicyBundle& policy_bundle) { |
| 29 policy_bundle_.CopyFrom(policy_bundle); | 29 policy_bundle_.CopyFrom(policy_bundle); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void FakeAsyncPolicyLoader::PostReloadOnBackgroundThread(bool force) { | 32 void FakeAsyncPolicyLoader::PostReloadOnBackgroundThread(bool force) { |
| 33 task_runner()->PostTask(FROM_HERE, base::Bind(&AsyncPolicyLoader::Reload, | 33 task_runner()->PostTask(FROM_HERE, base::Bind(&AsyncPolicyLoader::Reload, |
| 34 base::Unretained(this), force)); | 34 base::Unretained(this), force)); |
| 35 } | 35 } |
| 36 | 36 |
| 37 } // namespace policy | 37 } // namespace policy |
| OLD | NEW |