Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(489)

Unified Diff: components/policy/core/common/fake_async_policy_loader.cc

Issue 858303003: Removing FakePolicyWatcher and introducing FakeAsyncPolicyLoader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweaked the set of #include-s. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..21260b30bee3293b6792584243f5697fcd45fcbb
--- /dev/null
+++ b/components/policy/core/common/fake_async_policy_loader.cc
@@ -0,0 +1,36 @@
+// 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"
+
+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::SetPolicies(const PolicyBundle& policy_bundle) {
+ policy_bundle_.CopyFrom(policy_bundle);
+}
+
+void FakeAsyncPolicyLoader::PostReloadOnBackgroundThread(bool force) {
+ task_runner()->PostTask(FROM_HERE, base::Bind(&AsyncPolicyLoader::Reload,
+ base::Unretained(this), force));
+}
+
+} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698