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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_H_
7 7
8 #include "base/memory/weak_ptr.h"
8 #include "chrome/browser/extensions/extension_function.h" 9 #include "chrome/browser/extensions/extension_function.h"
9 #include "chrome/common/extensions/extension_action.h" 10 #include "chrome/common/extensions/extension_action.h"
11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h"
10 13
11 namespace base { 14 namespace base {
12 class DictionaryValue; 15 class DictionaryValue;
13 } 16 }
14 namespace extensions { 17 namespace extensions {
15 class TabHelper; 18 class TabHelper;
16 } 19 }
17 class TabContents; 20 class TabContents;
18 21
22 namespace extensions {
23
24 // This class manages reading and writing browser action values from storage.
25 class ExtensionActionStorageManager
26 : public content::NotificationObserver,
27 public base::SupportsWeakPtr<ExtensionActionStorageManager> {
28 public:
29 explicit ExtensionActionStorageManager(Profile* profile);
30 ~ExtensionActionStorageManager();
31
32 private:
33 // NotificationObserver:
34 virtual void Observe(int type,
35 const content::NotificationSource& source,
36 const content::NotificationDetails& details) OVERRIDE;
37
38 // Reads/Writes the ExtensionAction's default values to/from storage.
39 void WriteToStorage(ExtensionAction* extension_action);
40 void ReadFromStorage(
41 const std::string& extension_id, scoped_ptr<base::Value> value);
42
43 Profile* profile_;
44 content::NotificationRegistrar registrar_;
45 };
46
47 } // namespace extensions
48
49
19 // Implementation of the browserAction, pageAction, and scriptBadge APIs. 50 // Implementation of the browserAction, pageAction, and scriptBadge APIs.
20 // 51 //
21 // Divergent behaviour between the three is minimal (pageAction and scriptBadge 52 // Divergent behaviour between the three is minimal (pageAction and scriptBadge
22 // have required tabIds while browserAction's are optional, they have different 53 // have required tabIds while browserAction's are optional, they have different
23 // internal browser notification requirements, and not all functions are defined 54 // internal browser notification requirements, and not all functions are defined
24 // for all APIs). 55 // for all APIs).
25 class ExtensionActionFunction : public SyncExtensionFunction { 56 class ExtensionActionFunction : public SyncExtensionFunction {
26 public: 57 public:
27 static bool ParseCSSColorString(const std::string& color_string, 58 static bool ParseCSSColorString(const std::string& color_string,
28 SkColor* result); 59 SkColor* result);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 167
137 // getBadgeBackgroundColor 168 // getBadgeBackgroundColor
138 class ExtensionActionGetBadgeBackgroundColorFunction 169 class ExtensionActionGetBadgeBackgroundColorFunction
139 : public ExtensionActionFunction { 170 : public ExtensionActionFunction {
140 protected: 171 protected:
141 virtual ~ExtensionActionGetBadgeBackgroundColorFunction() {} 172 virtual ~ExtensionActionGetBadgeBackgroundColorFunction() {}
142 virtual bool RunExtensionAction() OVERRIDE; 173 virtual bool RunExtensionAction() OVERRIDE;
143 }; 174 };
144 175
145 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_ H_ 176 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698