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

Unified Diff: chrome/browser/policy/asynchronous_policy_provider.h

Issue 8586030: Added ConfigurationPolicyProvider::RefreshPolicies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
Index: chrome/browser/policy/asynchronous_policy_provider.h
diff --git a/chrome/browser/policy/asynchronous_policy_provider.h b/chrome/browser/policy/asynchronous_policy_provider.h
index b0dbed3ac3876545c5679b17150f01543fca4638..4d0cd50fe816080d59c5d67906c202c44e7174b0 100644
--- a/chrome/browser/policy/asynchronous_policy_provider.h
+++ b/chrome/browser/policy/asynchronous_policy_provider.h
@@ -7,6 +7,7 @@
#pragma once
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "chrome/browser/policy/configuration_policy_provider.h"
@@ -37,17 +38,24 @@ class AsynchronousPolicyProvider
scoped_refptr<AsynchronousPolicyLoader> loader);
virtual ~AsynchronousPolicyProvider();
- // Force a policy reload from the underlying data source.
- void ForceReload();
-
- protected:
// ConfigurationPolicyProvider implementation.
virtual bool ProvideInternal(PolicyMap* map) OVERRIDE;
+ virtual void RefreshPolicies() OVERRIDE;
+
+ private:
+ // Callbacks from the loader. OnRefreshReload is invoked when an explicitly
+ // requested refresh is done, while OnUnexpectedReload is invoked when the
+ // loader refreshed its policies without being triggered.
+ void OnRefreshReload();
+ void OnUnexpectedReload();
// The loader object used internally.
scoped_refptr<AsynchronousPolicyLoader> loader_;
- private:
+ // Used to create and invalidate WeakPtrs from RefreshPolicies, to make sure
+ // that notifications are only issued after any pending reloads are done.
+ base::WeakPtrFactory<AsynchronousPolicyProvider> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(AsynchronousPolicyProvider);
};

Powered by Google App Engine
This is Rietveld 408576698