OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_ACTIVE_DIRECTORY_POLICY_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_ACTIVE_DIRECTORY_POLICY_MANAGER_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 13 #include "components/policy/core/common/configuration_policy_provider.h" |
| 14 #include "components/signin/core/account_id/account_id.h" |
| 15 |
| 16 namespace policy { |
| 17 |
| 18 // ConfigurationPolicyProvider for policy from Active Directory. The policy is |
| 19 // fetched from the Domain Controller by authpolicyd which stores it in session |
| 20 // manager and from where it is loaded by UserActiveDirectoryPolicyManager. |
| 21 // TODO(tnagel): This is a slightly modified copy of |
| 22 // DeviceActiveDirectoryPolicyManager ==> merge the two classes. |
| 23 class UserActiveDirectoryPolicyManager : public ConfigurationPolicyProvider, |
| 24 public CloudPolicyStore::Observer { |
| 25 public: |
| 26 UserActiveDirectoryPolicyManager(const AccountId& account_id, |
| 27 std::unique_ptr<CloudPolicyStore> store); |
| 28 ~UserActiveDirectoryPolicyManager() override; |
| 29 |
| 30 // ConfigurationPolicyProvider: |
| 31 void Init(SchemaRegistry* registry) override; |
| 32 void Shutdown() override; |
| 33 bool IsInitializationComplete(PolicyDomain domain) const override; |
| 34 void RefreshPolicies() override; |
| 35 |
| 36 // CloudPolicyStore::Observer: |
| 37 void OnStoreLoaded(CloudPolicyStore* cloud_policy_store) override; |
| 38 void OnStoreError(CloudPolicyStore* cloud_policy_store) override; |
| 39 |
| 40 CloudPolicyStore* store() const { return store_.get(); } |
| 41 |
| 42 private: |
| 43 // Publishes the policy that's currently cached in the store. |
| 44 void PublishPolicy(); |
| 45 |
| 46 // Callback from authpolicyd. |
| 47 void OnPolicyRefreshed(bool success); |
| 48 |
| 49 const AccountId account_id_; |
| 50 std::unique_ptr<CloudPolicyStore> store_; |
| 51 |
| 52 // Must be last member. |
| 53 base::WeakPtrFactory<UserActiveDirectoryPolicyManager> weak_ptr_factory_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(UserActiveDirectoryPolicyManager); |
| 56 }; |
| 57 |
| 58 } // namespace policy |
| 59 |
| 60 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_ACTIVE_DIRECTORY_POLICY_MANAGER_H
_ |
OLD | NEW |