Chromium Code Reviews| 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_ACTIVE_DIRECTORY_POLICY_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_ACTIVE_DIRECTORY_POLICY_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_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 "base/time/time.h" | |
| 12 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 13 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 13 #include "components/policy/core/common/configuration_policy_provider.h" | 14 #include "components/policy/core/common/configuration_policy_provider.h" |
| 14 #include "components/signin/core/account_id/account_id.h" | 15 #include "components/signin/core/account_id/account_id.h" |
| 15 | 16 |
| 16 namespace policy { | 17 namespace policy { |
| 17 | 18 |
| 18 // ConfigurationPolicyProvider for device or user policy from Active Directory. | 19 // ConfigurationPolicyProvider for device or user policy from Active Directory. |
| 19 // The choice of constructor determines whether device or user policy is | 20 // The choice of constructor determines whether device or user policy is |
| 20 // provided. The policy is fetched from the Domain Controller by authpolicyd | 21 // provided. The policy is fetched from the Domain Controller by authpolicyd |
| 21 // which stores it in session manager and from where it is loaded by | 22 // which stores it in session manager and from where it is loaded by |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 45 void OnStoreError(CloudPolicyStore* cloud_policy_store) override; | 46 void OnStoreError(CloudPolicyStore* cloud_policy_store) override; |
| 46 | 47 |
| 47 CloudPolicyStore* store() const { return store_.get(); } | 48 CloudPolicyStore* store() const { return store_.get(); } |
| 48 | 49 |
| 49 private: | 50 private: |
| 50 // |account_id| specifies the user to manage policy for. If |account_id| is | 51 // |account_id| specifies the user to manage policy for. If |account_id| is |
| 51 // empty, device policy is managed. | 52 // empty, device policy is managed. |
| 52 ActiveDirectoryPolicyManager(const AccountId& account_id, | 53 ActiveDirectoryPolicyManager(const AccountId& account_id, |
| 53 std::unique_ptr<CloudPolicyStore> store); | 54 std::unique_ptr<CloudPolicyStore> store); |
| 54 | 55 |
| 55 // Publishes the policy that's currently cached in the store. | 56 // Publish the policy that's currently cached in the store. |
| 56 void PublishPolicy(); | 57 void PublishPolicy(); |
| 57 | 58 |
| 58 // Callback from authpolicyd. | 59 // Callback from authpolicyd. |
| 59 void OnPolicyRefreshed(bool success); | 60 void OnPolicyRefreshed(bool success); |
| 60 | 61 |
| 62 // Schedule the next policy refresh. | |
| 63 void ScheduleRefresh(); | |
| 64 | |
| 65 // Actually execute the scheduled policy refresh. | |
| 66 void RunScheduledRefresh(int task_number); | |
| 67 | |
| 61 const AccountId account_id_; | 68 const AccountId account_id_; |
| 62 std::unique_ptr<CloudPolicyStore> store_; | 69 std::unique_ptr<CloudPolicyStore> store_; |
| 63 | 70 |
| 71 base::TimeDelta refresh_interval_; | |
| 72 base::TimeDelta min_scheduling_delay_; | |
| 73 base::TimeTicks last_refresh_; | |
| 74 bool refresh_in_progress_ = false; | |
| 75 int task_number_ = 0; | |
|
emaxx
2017/01/24 15:54:26
Worth adding a comment for this member.
Also, mayb
Thiemo Nagel
2017/01/26 20:14:18
Obsolete.
| |
| 76 | |
| 64 // Must be last member. | 77 // Must be last member. |
| 65 base::WeakPtrFactory<ActiveDirectoryPolicyManager> weak_ptr_factory_; | 78 base::WeakPtrFactory<ActiveDirectoryPolicyManager> weak_ptr_factory_; |
| 66 | 79 |
| 67 DISALLOW_COPY_AND_ASSIGN(ActiveDirectoryPolicyManager); | 80 DISALLOW_COPY_AND_ASSIGN(ActiveDirectoryPolicyManager); |
| 68 }; | 81 }; |
| 69 | 82 |
| 70 } // namespace policy | 83 } // namespace policy |
| 71 | 84 |
| 72 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ACTIVE_DIRECTORY_POLICY_MANAGER_H_ | 85 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ACTIVE_DIRECTORY_POLICY_MANAGER_H_ |
| OLD | NEW |