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

Unified Diff: chrome/browser/extensions/api/storage/managed_value_store_cache.h

Issue 60823003: Introduced a ForwardingPolicyProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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/extensions/api/storage/managed_value_store_cache.h
diff --git a/chrome/browser/extensions/api/storage/managed_value_store_cache.h b/chrome/browser/extensions/api/storage/managed_value_store_cache.h
index 6e2700d3c877ef03663d5f2de5a7ef6939d599a1..b5116759adc063d78e4622778f451230e10b7aca 100644
--- a/chrome/browser/extensions/api/storage/managed_value_store_cache.h
+++ b/chrome/browser/extensions/api/storage/managed_value_store_cache.h
@@ -9,16 +9,13 @@
#include <string>
#include "base/basictypes.h"
-#include "base/callback_forward.h"
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "base/memory/weak_ptr.h"
#include "chrome/browser/extensions/api/storage/settings_observer.h"
#include "chrome/browser/extensions/api/storage/value_store_cache.h"
-#include "chrome/browser/extensions/event_router.h"
#include "chrome/browser/policy/policy_service.h"
class Profile;
@@ -37,8 +34,7 @@ class SettingsStorageFactory;
// which extensions listen for storage.onChanged(), and sends the appropriate
// updates to the corresponding PolicyValueStore on the FILE thread.
class ManagedValueStoreCache : public ValueStoreCache,
- public policy::PolicyService::Observer,
- public EventRouter::Observer {
+ public policy::PolicyService::Observer {
public:
// |factory| is used to create databases for the PolicyValueStores.
// |observers| is the list of SettingsObservers to notify when a ValueStore
@@ -63,6 +59,7 @@ class ManagedValueStoreCache : public ValueStoreCache,
virtual void DeleteStorageSoon(const std::string& extension_id) OVERRIDE;
// PolicyService::Observer implementation:
+ virtual void OnPolicyServiceInitialized(policy::PolicyDomain domain) OVERRIDE;
virtual void OnPolicyUpdated(const policy::PolicyNamespace& ns,
const policy::PolicyMap& previous,
const policy::PolicyMap& current) OVERRIDE;
@@ -72,70 +69,15 @@ class ManagedValueStoreCache : public ValueStoreCache,
void UpdatePolicyOnFILE(const std::string& extension_id,
scoped_ptr<policy::PolicyMap> current_policy);
- // EventRouter::Observer implementation:
- virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE;
-
- // Posted by OnListenerAdded() to load or create a PolicyValueStore for the
- // given |extension_id|.
- void CreateForExtensionOnFILE(const std::string& extension_id);
-
// Returns an existing PolicyValueStore for |extension_id|, or NULL.
PolicyValueStore* GetStoreFor(const std::string& extension_id);
- // Creates a new PolicyValueStore for |extension_id|. This may open an
- // existing database, or create a new one. This also sends the current policy
- // for |extension_id| to the database. When |notify_if_changed| is true,
- // a notification is sent with the changes between the current policy and the
- // previously stored policy, if there are any.
- //
- // Since this is used on FILE but must retrieve the current policy, this
- // method first posts GetInitialPolicy() to UI and then resumes in
- // CreateStoreWithInitialPolicy(). If |continuation| is not null then it
- // will be invoked after the store is created.
- //
- // CreateStoreFor() can be safely invoked from any method on the FILE thread.
- // It posts to UI used |weak_this_on_ui_|, so that the task is dropped if
- // ShutdownOnUI() has been invoked. Otherwise, GetInitialPolicy() executes
- // on UI and can safely post CreateStoreWithInitialPolicy to FILE.
- // CreateStoreWithInitialPolicy then guarantees that a store for
- // |extension_id| exists or is created, and then executes the |continuation|;
- // so when the |continuation| executes, a store for |extension_id| is
- // guaranteed to exist.
- void CreateStoreFor(const std::string& extension_id,
- bool notify_if_changed,
- const base::Closure& continuation);
-
- // Helper for CreateStoreFor, invoked on UI.
- void GetInitialPolicy(const std::string& extension_id,
- bool notify_if_changed,
- const base::Closure& continuation);
-
- // Helper for CreateStoreFor, invoked on FILE.
- void CreateStoreWithInitialPolicy(const std::string& extension_id,
- bool notify_if_changed,
- scoped_ptr<policy::PolicyMap> policy,
- const base::Closure& continuation);
-
- // Helper method to get the PolicyService for |profile_|.
- policy::PolicyService* GetPolicyService();
-
- // Used to create a WeakPtr valid on the UI thread, so that FILE tasks can
- // post back to UI.
- base::WeakPtrFactory<ManagedValueStoreCache> weak_factory_;
-
- // A WeakPtr to |this| that is valid on UI. This is used by tasks on the FILE
- // thread to post back to UI.
- base::WeakPtr<ManagedValueStoreCache> weak_this_on_ui_;
-
// The profile that owns the extension system being used. This is used to
// get the PolicyService, the EventRouter and the ExtensionService.
Profile* profile_;
- // The EventRouter is created before the SettingsFrontend (which owns the
- // instance of this class), and the SettingsFrontend is also destroyed before
- // the EventRouter is. |event_router_| is thus valid for the lifetime of this
- // object, until ShutdownOnUI() is invoked. Lives on UI.
- EventRouter* event_router_;
+ // The |profile_|'s PolicyService.
+ policy::PolicyService* policy_service_;
// Observes extension loading and unloading, and keeps the Profile's
// PolicyService aware of the current list of extensions.

Powered by Google App Engine
This is Rietveld 408576698