| 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 "components/policy/core/common/policy_provider_android.h" | 5 #include "components/policy/core/common/policy_provider_android.h" |
| 6 #include "components/policy/core/common/policy_provider_android_delegate.h" | 6 #include "components/policy/core/common/policy_provider_android_delegate.h" |
| 7 | 7 |
| 8 namespace policy { | 8 namespace policy { |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| 11 | 11 |
| 12 bool g_wait_for_policies = false; | 12 bool g_wait_for_policies = false; |
| 13 | 13 |
| 14 } // namespace | 14 } // namespace |
| 15 | 15 |
| 16 PolicyProviderAndroid::PolicyProviderAndroid() | 16 PolicyProviderAndroid::PolicyProviderAndroid() |
| 17 : delegate_(NULL), | 17 : delegate_(NULL), |
| 18 initialized_(!g_wait_for_policies) {} | 18 initialized_(!g_wait_for_policies) {} |
| 19 | 19 |
| 20 PolicyProviderAndroid::~PolicyProviderAndroid() {} | 20 PolicyProviderAndroid::~PolicyProviderAndroid() {} |
| 21 | 21 |
| 22 const Schema* PolicyProviderAndroid::GetChromeSchema() const { |
| 23 PolicyNamespace ns(POLICY_DOMAIN_CHROME, std::string()); |
| 24 return schema_map()->GetSchema(ns); |
| 25 } |
| 26 |
| 22 // static | 27 // static |
| 23 void PolicyProviderAndroid::SetShouldWaitForPolicy( | 28 void PolicyProviderAndroid::SetShouldWaitForPolicy( |
| 24 bool should_wait_for_policy) { | 29 bool should_wait_for_policy) { |
| 25 g_wait_for_policies = should_wait_for_policy; | 30 g_wait_for_policies = should_wait_for_policy; |
| 26 } | 31 } |
| 27 | 32 |
| 28 void PolicyProviderAndroid::SetDelegate( | 33 void PolicyProviderAndroid::SetDelegate( |
| 29 PolicyProviderAndroidDelegate* delegate) { | 34 PolicyProviderAndroidDelegate* delegate) { |
| 30 delegate_ = delegate; | 35 delegate_ = delegate; |
| 31 } | 36 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 52 delegate_->RefreshPolicies(); | 57 delegate_->RefreshPolicies(); |
| 53 } else { | 58 } else { |
| 54 // If we don't have a delegate, pass a copy of the current policies. | 59 // If we don't have a delegate, pass a copy of the current policies. |
| 55 scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); | 60 scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); |
| 56 bundle->CopyFrom(policies()); | 61 bundle->CopyFrom(policies()); |
| 57 UpdatePolicy(bundle.Pass()); | 62 UpdatePolicy(bundle.Pass()); |
| 58 } | 63 } |
| 59 } | 64 } |
| 60 | 65 |
| 61 } // namespace policy | 66 } // namespace policy |
| OLD | NEW |