| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_ACTIVE_DIRECTORY_POLICY_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_ACTIVE_DIRECTORY_POLICY_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_ACTIVE_DIRECTORY_POLICY_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_ACTIVE_DIRECTORY_POLICY_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 10 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 12 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 11 #include "components/policy/core/common/configuration_policy_provider.h" | 13 #include "components/policy/core/common/configuration_policy_provider.h" |
| 12 | 14 |
| 13 namespace policy { | 15 namespace policy { |
| 14 | 16 |
| 15 // ConfigurationPolicyProvider for policy from Active Directory. The policy is | 17 // ConfigurationPolicyProvider for policy from Active Directory. The policy is |
| 16 // fetched from the Domain Controller by authpolicyd which stores it in session | 18 // fetched from the Domain Controller by authpolicyd which stores it in session |
| 17 // manager and from where it is loaded by DeviceActiveDirectoryPolicyManager. | 19 // manager and from where it is loaded by DeviceActiveDirectoryPolicyManager. |
| 18 // TODO(tnagel): Wire RefreshPolicies() through to authpolicyd. | |
| 19 class DeviceActiveDirectoryPolicyManager : public ConfigurationPolicyProvider, | 20 class DeviceActiveDirectoryPolicyManager : public ConfigurationPolicyProvider, |
| 20 public CloudPolicyStore::Observer { | 21 public CloudPolicyStore::Observer { |
| 21 public: | 22 public: |
| 22 explicit DeviceActiveDirectoryPolicyManager( | 23 explicit DeviceActiveDirectoryPolicyManager( |
| 23 std::unique_ptr<CloudPolicyStore> store); | 24 std::unique_ptr<CloudPolicyStore> store); |
| 24 ~DeviceActiveDirectoryPolicyManager() override; | 25 ~DeviceActiveDirectoryPolicyManager() override; |
| 25 | 26 |
| 26 // ConfigurationPolicyProvider: | 27 // ConfigurationPolicyProvider: |
| 27 void Init(SchemaRegistry* registry) override; | 28 void Init(SchemaRegistry* registry) override; |
| 28 void Shutdown() override; | 29 void Shutdown() override; |
| 29 bool IsInitializationComplete(PolicyDomain domain) const override; | 30 bool IsInitializationComplete(PolicyDomain domain) const override; |
| 30 void RefreshPolicies() override; | 31 void RefreshPolicies() override; |
| 31 | 32 |
| 32 // CloudPolicyStore::Observer: | 33 // CloudPolicyStore::Observer: |
| 33 void OnStoreLoaded(CloudPolicyStore* cloud_policy_store) override; | 34 void OnStoreLoaded(CloudPolicyStore* cloud_policy_store) override; |
| 34 void OnStoreError(CloudPolicyStore* cloud_policy_store) override; | 35 void OnStoreError(CloudPolicyStore* cloud_policy_store) override; |
| 35 | 36 |
| 36 const CloudPolicyStore* store() const { return store_.get(); } | 37 const CloudPolicyStore* store() const { return store_.get(); } |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 // Publishes the policy that's currently cached in the store. | 40 // Publishes the policy that's currently cached in the store. |
| 40 void PublishPolicy(); | 41 void PublishPolicy(); |
| 41 | 42 |
| 43 // Callback from authpolicyd. |
| 44 void OnPolicyRefreshed(bool success); |
| 45 |
| 42 std::unique_ptr<CloudPolicyStore> store_; | 46 std::unique_ptr<CloudPolicyStore> store_; |
| 47 |
| 48 // Must be last member. |
| 49 base::WeakPtrFactory<DeviceActiveDirectoryPolicyManager> weak_ptr_factory_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(DeviceActiveDirectoryPolicyManager); |
| 43 }; | 52 }; |
| 44 | 53 |
| 45 } // namespace policy | 54 } // namespace policy |
| 46 | 55 |
| 47 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_ACTIVE_DIRECTORY_POLICY_MANAGER
_H_ | 56 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_ACTIVE_DIRECTORY_POLICY_MANAGER
_H_ |
| OLD | NEW |