Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/async_policy_provider.h" | 5 #include "components/policy/core/common/async_policy_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
| 13 #include "components/policy/core/common/async_policy_loader.h" | 13 #include "components/policy/core/common/async_policy_loader.h" |
| 14 #include "components/policy/core/common/policy_bundle.h" | 14 #include "components/policy/core/common/policy_bundle.h" |
| 15 #include "components/policy/core/common/schema_registry.h" | 15 #include "components/policy/core/common/schema_registry.h" |
| 16 | 16 |
| 17 namespace policy { | 17 namespace policy { |
| 18 | 18 |
| 19 AsyncPolicyProvider::AsyncPolicyProvider( | 19 AsyncPolicyProvider::AsyncPolicyProvider( |
| 20 SchemaRegistry* registry, | 20 SchemaRegistry* registry, |
| 21 scoped_ptr<AsyncPolicyLoader> loader) | 21 scoped_ptr<AsyncPolicyLoader> loader) |
| 22 : loader_(loader.Pass()), | 22 : loader_(loader.Pass()), |
| 23 weak_factory_(this) { | 23 weak_factory_(this) { |
| 24 // The loaders always read policies from local platform sources. | |
| 25 source_ = POLICY_SOURCE_PLATFORM; | |
|
bartfab (slow)
2015/09/14 14:42:26
Nit: #include "components/policy/core/common/polic
fhorschig
2015/09/16 13:52:04
Done.
| |
| 24 // Make an immediate synchronous load on startup. | 26 // Make an immediate synchronous load on startup. |
| 25 OnLoaderReloaded(loader_->InitialLoad(registry->schema_map())); | 27 OnLoaderReloaded(loader_->InitialLoad(registry->schema_map())); |
| 26 } | 28 } |
| 27 | 29 |
| 28 AsyncPolicyProvider::~AsyncPolicyProvider() { | 30 AsyncPolicyProvider::~AsyncPolicyProvider() { |
| 29 DCHECK(CalledOnValidThread()); | 31 DCHECK(CalledOnValidThread()); |
| 30 } | 32 } |
| 31 | 33 |
| 32 void AsyncPolicyProvider::Init(SchemaRegistry* registry) { | 34 void AsyncPolicyProvider::Init(SchemaRegistry* registry) { |
| 33 DCHECK(CalledOnValidThread()); | 35 DCHECK(CalledOnValidThread()); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 scoped_refptr<base::SingleThreadTaskRunner> runner, | 125 scoped_refptr<base::SingleThreadTaskRunner> runner, |
| 124 base::WeakPtr<AsyncPolicyProvider> weak_this, | 126 base::WeakPtr<AsyncPolicyProvider> weak_this, |
| 125 scoped_ptr<PolicyBundle> bundle) { | 127 scoped_ptr<PolicyBundle> bundle) { |
| 126 runner->PostTask(FROM_HERE, | 128 runner->PostTask(FROM_HERE, |
| 127 base::Bind(&AsyncPolicyProvider::OnLoaderReloaded, | 129 base::Bind(&AsyncPolicyProvider::OnLoaderReloaded, |
| 128 weak_this, | 130 weak_this, |
| 129 base::Passed(&bundle))); | 131 base::Passed(&bundle))); |
| 130 } | 132 } |
| 131 | 133 |
| 132 } // namespace policy | 134 } // namespace policy |
| OLD | NEW |