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

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

Issue 2652653007: Chromad: Refresh policy every 90 minutes (Closed)
Patch Set: Convert int constants to TimeDelta Created 3 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/policy/active_directory_policy_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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/cancelable_callback.h"
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/time/time.h"
12 #include "components/policy/core/common/cloud/cloud_policy_store.h" 14 #include "components/policy/core/common/cloud/cloud_policy_store.h"
13 #include "components/policy/core/common/configuration_policy_provider.h" 15 #include "components/policy/core/common/configuration_policy_provider.h"
14 #include "components/signin/core/account_id/account_id.h" 16 #include "components/signin/core/account_id/account_id.h"
15 17
16 namespace policy { 18 namespace policy {
17 19
18 // ConfigurationPolicyProvider for device or user policy from Active Directory. 20 // ConfigurationPolicyProvider for device or user policy from Active Directory.
19 // The choice of constructor determines whether device or user policy is 21 // The choice of constructor determines whether device or user policy is
20 // provided. The policy is fetched from the Domain Controller by authpolicyd 22 // 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 23 // which stores it in session manager and from where it is loaded by
(...skipping 23 matching lines...) Expand all
45 void OnStoreError(CloudPolicyStore* cloud_policy_store) override; 47 void OnStoreError(CloudPolicyStore* cloud_policy_store) override;
46 48
47 CloudPolicyStore* store() const { return store_.get(); } 49 CloudPolicyStore* store() const { return store_.get(); }
48 50
49 private: 51 private:
50 // |account_id| specifies the user to manage policy for. If |account_id| is 52 // |account_id| specifies the user to manage policy for. If |account_id| is
51 // empty, device policy is managed. 53 // empty, device policy is managed.
52 ActiveDirectoryPolicyManager(const AccountId& account_id, 54 ActiveDirectoryPolicyManager(const AccountId& account_id,
53 std::unique_ptr<CloudPolicyStore> store); 55 std::unique_ptr<CloudPolicyStore> store);
54 56
55 // Publishes the policy that's currently cached in the store. 57 // Publish the policy that's currently cached in the store.
56 void PublishPolicy(); 58 void PublishPolicy();
57 59
58 // Callback from authpolicyd. 60 // Callback from authpolicyd.
59 void OnPolicyRefreshed(bool success); 61 void OnPolicyRefreshed(bool success);
60 62
63 // Schedule next policy refresh to run after |delay|. (Deletes any previously
64 // scheduled refresh tasks.)
65 void ScheduleRefresh(base::TimeDelta delay);
66
67 // Schedule next automatic policy refresh based on initial fetch delay or
68 // refresh interval. (Deletes any previously scheduled refresh tasks.)
69 void ScheduleAutomaticRefresh();
70
71 // Actually execute the scheduled policy refresh.
72 void RunScheduledRefresh();
73
61 const AccountId account_id_; 74 const AccountId account_id_;
62 std::unique_ptr<CloudPolicyStore> store_; 75 std::unique_ptr<CloudPolicyStore> store_;
63 76
77 // Whether a policy refresh is in progress (and thus any further requests need
78 // to be blocked).
79 bool refresh_in_progress_ = false;
80 // Whether a refresh had been blocked and thus the next refresh needs to be
81 // scheduled at the shorter "retry" interval.
82 bool retry_refresh_ = false;
83 base::TimeTicks last_refresh_;
84 const base::TimeTicks startup_ = base::TimeTicks::Now();
85 std::unique_ptr<base::CancelableClosure> refresh_task_;
86
64 // Must be last member. 87 // Must be last member.
65 base::WeakPtrFactory<ActiveDirectoryPolicyManager> weak_ptr_factory_; 88 base::WeakPtrFactory<ActiveDirectoryPolicyManager> weak_ptr_factory_;
66 89
67 DISALLOW_COPY_AND_ASSIGN(ActiveDirectoryPolicyManager); 90 DISALLOW_COPY_AND_ASSIGN(ActiveDirectoryPolicyManager);
68 }; 91 };
69 92
70 } // namespace policy 93 } // namespace policy
71 94
72 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ACTIVE_DIRECTORY_POLICY_MANAGER_H_ 95 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ACTIVE_DIRECTORY_POLICY_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/policy/active_directory_policy_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698