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

Unified Diff: chrome/browser/extensions/api/extension_action/extension_actions_api.h

Issue 10837155: Persist browserAction settings to the extension StateStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: yoyo Created 8 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/api/extension_action/extension_actions_api.h
diff --git a/chrome/browser/extensions/api/extension_action/extension_actions_api.h b/chrome/browser/extensions/api/extension_action/extension_actions_api.h
index ac43e187367c02c3f0442c9c6edc7f86aa234253..962a96117fa4c26ff92bd36ebe096189f23f3a1c 100644
--- a/chrome/browser/extensions/api/extension_action/extension_actions_api.h
+++ b/chrome/browser/extensions/api/extension_action/extension_actions_api.h
@@ -5,8 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_H_
+#include "base/memory/weak_ptr.h"
#include "chrome/browser/extensions/extension_function.h"
#include "chrome/common/extensions/extension_action.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
namespace base {
class DictionaryValue;
@@ -16,6 +19,34 @@ class TabHelper;
}
class TabContents;
+namespace extensions {
+
+// This class manages reading and writing browser action values from storage.
+class ExtensionActionStorageManager
+ : public content::NotificationObserver,
+ public base::SupportsWeakPtr<ExtensionActionStorageManager> {
+ public:
+ explicit ExtensionActionStorageManager(Profile* profile);
+ ~ExtensionActionStorageManager();
+
+ private:
+ // NotificationObserver:
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) 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);
+
+ Profile* profile_;
+ content::NotificationRegistrar registrar_;
+};
+
+} // namespace extensions
+
+
// Implementation of the browserAction, pageAction, and scriptBadge APIs.
//
// Divergent behaviour between the three is minimal (pageAction and scriptBadge

Powered by Google App Engine
This is Rietveld 408576698