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

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: Simpler AsyncLoader, fixed unit_tests, added connector::RefreshPolicies 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..59c41f86cd70d23ba6a6b785af1021e2eb870130 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,31 @@ 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:
+ // Used to trigger a Reload on |loader| on the FILE thread.
+ static void PostReloadOnFILE(scoped_refptr<AsynchronousPolicyLoader> loader);
Mattias Nissler (ping if slow) 2011/11/18 14:49:32 In these cases we usually s/FILE/FileThread/: $ g
Mattias Nissler (ping if slow) 2011/11/18 14:49:32 Pass loader as plain pointer and base::Bind will t
Joao da Silva 2011/11/18 15:39:18 Done.
Joao da Silva 2011/11/18 15:39:18 Done.
+
+ // Used to notify UI that a reload task has been submitted.
+ void OnReloadPosted();
+
+ // Callback from the loader. This is invoked whenever the loader has completed
+ // a reload of the policies.
+ void OnLoaderReloaded();
// The loader object used internally.
scoped_refptr<AsynchronousPolicyLoader> loader_;
- private:
+ // Number of refreshes requested whose reload is still pending. Used to only
+ // fire notifications when all pending refreshes are done.
+ int pending_refreshes_;
+
+ // Used to post tasks to self on UI.
+ base::WeakPtrFactory<AsynchronousPolicyProvider> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(AsynchronousPolicyProvider);
};

Powered by Google App Engine
This is Rietveld 408576698