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

Unified Diff: chrome/browser/extensions/extension_action_storage_manager.h

Issue 502033003: Move ExtensionActionStorageManager out of extension_action_api.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master for CQ Created 6 years, 4 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
Index: chrome/browser/extensions/extension_action_storage_manager.h
diff --git a/chrome/browser/extensions/extension_action_storage_manager.h b/chrome/browser/extensions/extension_action_storage_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..37b2ed5055d37c39d28cbf0a83a15649ac66bf12
--- /dev/null
+++ b/chrome/browser/extensions/extension_action_storage_manager.h
@@ -0,0 +1,68 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_STORAGE_MANAGER_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_STORAGE_MANAGER_H_
+
+#include <string>
+
+#include "base/memory/weak_ptr.h"
+#include "base/scoped_observer.h"
+#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
+#include "extensions/browser/extension_registry_observer.h"
+
+class ExtensionAction;
+
+namespace content {
+class BrowserContext;
+}
+
+namespace extensions {
+class ExtensionRegistry;
+class StateStore;
+
+// This class manages reading and writing browser action values from storage.
+class ExtensionActionStorageManager : public ExtensionActionAPI::Observer,
+ public ExtensionRegistryObserver {
+ public:
+ explicit ExtensionActionStorageManager(content::BrowserContext* context);
+ virtual ~ExtensionActionStorageManager();
+
+ private:
+ // ExtensionActionAPI::Observer:
+ virtual void OnExtensionActionUpdated(
+ ExtensionAction* extension_action,
+ content::WebContents* web_contents,
+ content::BrowserContext* browser_context) OVERRIDE;
+ virtual void OnExtensionActionAPIShuttingDown() OVERRIDE;
+
+ // ExtensionRegistryObserver:
+ virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
+ const Extension* extension) OVERRIDE;
+
+ // Reads/Writes the ExtensionAction's default values to/from storage.
+ void WriteToStorage(ExtensionAction* extension_action);
+ void ReadFromStorage(
+ const std::string& extension_id, scoped_ptr<base::Value> value);
+
+ // Returns the Extensions StateStore for the |browser_context_|.
+ // May return NULL.
+ StateStore* GetStateStore();
+
+ content::BrowserContext* browser_context_;
+
+ ScopedObserver<ExtensionActionAPI, ExtensionActionAPI::Observer>
+ extension_action_observer_;
+
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
+ extension_registry_observer_;
+
+ base::WeakPtrFactory<ExtensionActionStorageManager> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionActionStorageManager);
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_STORAGE_MANAGER_H_
« no previous file with comments | « chrome/browser/extensions/extension_action_manager.cc ('k') | chrome/browser/extensions/extension_action_storage_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698