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); |
}; |