Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: chrome/browser/chromeos/policy/active_directory_policy_manager.h

Issue 2638623006: Merge {Device,User}ActiveDirectoryPolicyManager into a single class (Closed)
Patch Set: Polish Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_USER_ACTIVE_DIRECTORY_POLICY_MANAGER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_ACTIVE_DIRECTORY_POLICY_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_ACTIVE_DIRECTORY_POLICY_MANAGER_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_ACTIVE_DIRECTORY_POLICY_MANAGER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "components/policy/core/common/cloud/cloud_policy_store.h" 12 #include "components/policy/core/common/cloud/cloud_policy_store.h"
13 #include "components/policy/core/common/configuration_policy_provider.h" 13 #include "components/policy/core/common/configuration_policy_provider.h"
14 #include "components/signin/core/account_id/account_id.h" 14 #include "components/signin/core/account_id/account_id.h"
15 15
16 namespace policy { 16 namespace policy {
17 17
18 // ConfigurationPolicyProvider for policy from Active Directory. The policy is 18 // ConfigurationPolicyProvider for device or user policy from Active Directory.
19 // fetched from the Domain Controller by authpolicyd which stores it in session 19 // The choice of constructor determines whether device or user policy is
20 // manager and from where it is loaded by UserActiveDirectoryPolicyManager. 20 // provided. The policy is fetched from the Domain Controller by authpolicyd
21 // TODO(tnagel): This is a slightly modified copy of 21 // which stores it in session manager and from where it is loaded by
22 // DeviceActiveDirectoryPolicyManager ==> merge the two classes. 22 // ActiveDirectoryPolicyManager.
23 class UserActiveDirectoryPolicyManager : public ConfigurationPolicyProvider, 23 class ActiveDirectoryPolicyManager : public ConfigurationPolicyProvider,
24 public CloudPolicyStore::Observer { 24 public CloudPolicyStore::Observer {
25 public: 25 public:
26 UserActiveDirectoryPolicyManager(const AccountId& account_id, 26 // Device policy.
27 std::unique_ptr<CloudPolicyStore> store); 27 explicit ActiveDirectoryPolicyManager(
emaxx 2017/01/18 01:19:44 The intent could be made more explicit by exposing
Thiemo Nagel 2017/01/18 18:30:31 Good idea! Done.
28 ~UserActiveDirectoryPolicyManager() override; 28 std::unique_ptr<CloudPolicyStore> store);
29
30 // User policy for |account_id|.
31 ActiveDirectoryPolicyManager(const AccountId& account_id,
32 std::unique_ptr<CloudPolicyStore> store);
33
34 ~ActiveDirectoryPolicyManager() override;
29 35
30 // ConfigurationPolicyProvider: 36 // ConfigurationPolicyProvider:
31 void Init(SchemaRegistry* registry) override; 37 void Init(SchemaRegistry* registry) override;
32 void Shutdown() override; 38 void Shutdown() override;
33 bool IsInitializationComplete(PolicyDomain domain) const override; 39 bool IsInitializationComplete(PolicyDomain domain) const override;
34 void RefreshPolicies() override; 40 void RefreshPolicies() override;
35 41
36 // CloudPolicyStore::Observer: 42 // CloudPolicyStore::Observer:
37 void OnStoreLoaded(CloudPolicyStore* cloud_policy_store) override; 43 void OnStoreLoaded(CloudPolicyStore* cloud_policy_store) override;
38 void OnStoreError(CloudPolicyStore* cloud_policy_store) override; 44 void OnStoreError(CloudPolicyStore* cloud_policy_store) override;
39 45
40 CloudPolicyStore* store() const { return store_.get(); } 46 CloudPolicyStore* store() const { return store_.get(); }
41 47
42 private: 48 private:
43 // Publishes the policy that's currently cached in the store. 49 // Publishes the policy that's currently cached in the store.
44 void PublishPolicy(); 50 void PublishPolicy();
45 51
46 // Callback from authpolicyd. 52 // Callback from authpolicyd.
47 void OnPolicyRefreshed(bool success); 53 void OnPolicyRefreshed(bool success);
48 54
49 const AccountId account_id_; 55 const AccountId account_id_;
50 std::unique_ptr<CloudPolicyStore> store_; 56 std::unique_ptr<CloudPolicyStore> store_;
51 57
52 // Must be last member. 58 // Must be last member.
53 base::WeakPtrFactory<UserActiveDirectoryPolicyManager> weak_ptr_factory_; 59 base::WeakPtrFactory<ActiveDirectoryPolicyManager> weak_ptr_factory_;
54 60
55 DISALLOW_COPY_AND_ASSIGN(UserActiveDirectoryPolicyManager); 61 DISALLOW_COPY_AND_ASSIGN(ActiveDirectoryPolicyManager);
56 }; 62 };
57 63
58 } // namespace policy 64 } // namespace policy
59 65
60 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_ACTIVE_DIRECTORY_POLICY_MANAGER_H _ 66 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ACTIVE_DIRECTORY_POLICY_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/BUILD.gn ('k') | chrome/browser/chromeos/policy/active_directory_policy_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698