| OLD | NEW |
| 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 "base/memory/weak_ptr.h" |
| 9 #include "chrome/browser/extensions/extension_action.h" | 9 #include "chrome/browser/extensions/extension_action.h" |
| 10 #include "chrome/browser/extensions/extension_function.h" | 10 #include "chrome/browser/extensions/extension_function.h" |
| 11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 class DictionaryValue; | 15 class DictionaryValue; |
| 16 } | 16 } |
| 17 |
| 18 namespace content { |
| 19 class WebContents; |
| 20 } |
| 21 |
| 17 namespace extensions { | 22 namespace extensions { |
| 18 class TabHelper; | 23 class TabHelper; |
| 19 } | 24 } |
| 20 class TabContents; | |
| 21 | 25 |
| 22 namespace extensions { | 26 namespace extensions { |
| 23 | 27 |
| 24 // This class manages reading and writing browser action values from storage. | 28 // This class manages reading and writing browser action values from storage. |
| 25 class ExtensionActionStorageManager | 29 class ExtensionActionStorageManager |
| 26 : public content::NotificationObserver, | 30 : public content::NotificationObserver, |
| 27 public base::SupportsWeakPtr<ExtensionActionStorageManager> { | 31 public base::SupportsWeakPtr<ExtensionActionStorageManager> { |
| 28 public: | 32 public: |
| 29 explicit ExtensionActionStorageManager(Profile* profile); | 33 explicit ExtensionActionStorageManager(Profile* profile); |
| 30 virtual ~ExtensionActionStorageManager(); | 34 virtual ~ExtensionActionStorageManager(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 extensions::TabHelper& tab_helper() const; | 77 extensions::TabHelper& tab_helper() const; |
| 74 | 78 |
| 75 // All the extension action APIs take a single argument called details that | 79 // All the extension action APIs take a single argument called details that |
| 76 // is a dictionary. | 80 // is a dictionary. |
| 77 base::DictionaryValue* details_; | 81 base::DictionaryValue* details_; |
| 78 | 82 |
| 79 // The tab id the extension action function should apply to, if any, or | 83 // The tab id the extension action function should apply to, if any, or |
| 80 // kDefaultTabId if none was specified. | 84 // kDefaultTabId if none was specified. |
| 81 int tab_id_; | 85 int tab_id_; |
| 82 | 86 |
| 83 // Tab content for |tab_id_| if one exists. | 87 // WebContents for |tab_id_| if one exists. |
| 84 TabContents* contents_; | 88 content::WebContents* contents_; |
| 85 | 89 |
| 86 // The extension action for the current extension. | 90 // The extension action for the current extension. |
| 87 ExtensionAction* extension_action_; | 91 ExtensionAction* extension_action_; |
| 88 }; | 92 }; |
| 89 | 93 |
| 90 // | 94 // |
| 91 // Implementations of each extension action API. | 95 // Implementations of each extension action API. |
| 92 // | 96 // |
| 93 // pageAction and browserAction bindings are created for these by extending them | 97 // pageAction and browserAction bindings are created for these by extending them |
| 94 // then declaring an EXTENSION_FUNCTION_NAME. | 98 // then declaring an EXTENSION_FUNCTION_NAME. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 171 |
| 168 // getBadgeBackgroundColor | 172 // getBadgeBackgroundColor |
| 169 class ExtensionActionGetBadgeBackgroundColorFunction | 173 class ExtensionActionGetBadgeBackgroundColorFunction |
| 170 : public ExtensionActionFunction { | 174 : public ExtensionActionFunction { |
| 171 protected: | 175 protected: |
| 172 virtual ~ExtensionActionGetBadgeBackgroundColorFunction() {} | 176 virtual ~ExtensionActionGetBadgeBackgroundColorFunction() {} |
| 173 virtual bool RunExtensionAction() OVERRIDE; | 177 virtual bool RunExtensionAction() OVERRIDE; |
| 174 }; | 178 }; |
| 175 | 179 |
| 176 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_
H_ | 180 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_
H_ |
| OLD | NEW |