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 explicit UserActiveDirectoryPolicyManager( | |
emaxx
2016/12/28 19:09:20
nit: Remove explicit.
Thiemo Nagel
2016/12/29 15:08:27
Done.
| |
27 const AccountId& account_id, | |
28 std::unique_ptr<CloudPolicyStore> store); | |
29 ~UserActiveDirectoryPolicyManager() override; | |
30 | |
31 // ConfigurationPolicyProvider: | |
32 void Init(SchemaRegistry* registry) override; | |
33 void Shutdown() override; | |
34 bool IsInitializationComplete(PolicyDomain domain) const override; | |
35 void RefreshPolicies() override; | |
36 | |
37 // CloudPolicyStore::Observer: | |
38 void OnStoreLoaded(CloudPolicyStore* cloud_policy_store) override; | |
39 void OnStoreError(CloudPolicyStore* cloud_policy_store) override; | |
40 | |
41 CloudPolicyStore* store() const { return store_.get(); } | |
42 | |
43 private: | |
44 // Publishes the policy that's currently cached in the store. | |
45 void PublishPolicy(); | |
46 | |
47 // Callback from authpolicyd. | |
48 void OnPolicyRefreshed(bool success); | |
49 | |
50 const AccountId account_id_; | |
51 std::unique_ptr<CloudPolicyStore> store_; | |
52 | |
53 // Must be last member. | |
54 base::WeakPtrFactory<UserActiveDirectoryPolicyManager> weak_ptr_factory_; | |
55 | |
56 DISALLOW_COPY_AND_ASSIGN(UserActiveDirectoryPolicyManager); | |
57 }; | |
58 | |
59 } // namespace policy | |
60 | |
61 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_ACTIVE_DIRECTORY_POLICY_MANAGER_H _ | |
OLD | NEW |