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

Unified Diff: chrome/browser/chromeos/policy/active_directory_policy_manager.h

Issue 2942373002: Extract AD policy scheduler into separate class (Closed)
Patch Set: Simplify public interface (and implementation) Created 3 years, 6 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/policy/active_directory_policy_manager.h
diff --git a/chrome/browser/chromeos/policy/active_directory_policy_manager.h b/chrome/browser/chromeos/policy/active_directory_policy_manager.h
index 9bf7935e70547556da3387e177da68710a16d6dd..598c545cf6225fad0ce45a7f84d26dab5e098ce9 100644
--- a/chrome/browser/chromeos/policy/active_directory_policy_manager.h
+++ b/chrome/browser/chromeos/policy/active_directory_policy_manager.h
@@ -7,12 +7,11 @@
#include <memory>
-#include "base/cancelable_callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/time/time.h"
#include "components/policy/core/common/cloud/cloud_policy_store.h"
#include "components/policy/core/common/configuration_policy_provider.h"
+#include "components/policy/core/common/policy_scheduler.h"
#include "components/signin/core/account_id/account_id.h"
namespace policy {
@@ -57,35 +56,20 @@ class ActiveDirectoryPolicyManager : public ConfigurationPolicyProvider,
// Publish the policy that's currently cached in the store.
void PublishPolicy();
- // Callback from authpolicyd.
- void OnPolicyRefreshed(bool success);
-
- // Schedule next policy refresh to run after |delay|. (Deletes any previously
- // scheduled refresh tasks.)
- void ScheduleRefresh(base::TimeDelta delay);
+ // Calls into authpolicyd to fetch policy. Reports success or failure via
+ // |callback|.
+ void DoRefresh(PolicyScheduler::TaskCallback callback);
- // Schedule next automatic policy refresh based on initial fetch delay or
- // refresh interval. (Deletes any previously scheduled refresh tasks.)
- void ScheduleAutomaticRefresh();
-
- // Actually execute the scheduled policy refresh.
- void RunScheduledRefresh();
+ // Called by scheduler with result of policy fetch.
+ void OnPolicyRefreshed(bool success);
const AccountId account_id_;
std::unique_ptr<CloudPolicyStore> store_;
- // Whether a policy refresh is in progress (and thus any further requests need
- // to be blocked).
- bool refresh_in_progress_ = false;
- // Whether a refresh had been blocked and thus the next refresh needs to be
- // scheduled at the shorter "retry" interval.
- bool retry_refresh_ = false;
- base::TimeTicks last_refresh_;
- const base::TimeTicks startup_ = base::TimeTicks::Now();
- std::unique_ptr<base::CancelableClosure> refresh_task_;
+ std::unique_ptr<PolicyScheduler> scheduler_;
// Must be last member.
- base::WeakPtrFactory<ActiveDirectoryPolicyManager> weak_ptr_factory_;
+ base::WeakPtrFactory<ActiveDirectoryPolicyManager> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ActiveDirectoryPolicyManager);
};
« 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