| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/extensions/extension_function.h" | 9 #include "chrome/browser/extensions/extension_function.h" |
| 10 #include "chrome/common/extensions/extension_action.h" | 10 #include "chrome/common/extensions/extension_action.h" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 class DictionaryValue; | 13 class DictionaryValue; |
| 14 } | 14 } |
| 15 class TabContents; | 15 class TabContents; |
| 16 typedef TabContents TabContentsWrapper; | |
| 17 | 16 |
| 18 // Implementation of both the browserAction and pageAction APIs. | 17 // Implementation of both the browserAction and pageAction APIs. |
| 19 // | 18 // |
| 20 // Divergent behaviour between the two is minimal (pageAction has required | 19 // Divergent behaviour between the two is minimal (pageAction has required |
| 21 // tabIds while browserAction's are optional, they have different internal | 20 // tabIds while browserAction's are optional, they have different internal |
| 22 // browser notification requirements, and not all functions are defined for | 21 // browser notification requirements, and not all functions are defined for |
| 23 // both APIs). | 22 // both APIs). |
| 24 class ExtensionActionFunction : public SyncExtensionFunction { | 23 class ExtensionActionFunction : public SyncExtensionFunction { |
| 25 public: | 24 public: |
| 26 static bool ParseCSSColorString(const std::string& color_string, | 25 static bool ParseCSSColorString(const std::string& color_string, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 38 | 37 |
| 39 // All the extension action APIs take a single argument called details that | 38 // All the extension action APIs take a single argument called details that |
| 40 // is a dictionary. | 39 // is a dictionary. |
| 41 base::DictionaryValue* details_; | 40 base::DictionaryValue* details_; |
| 42 | 41 |
| 43 // The tab id the extension action function should apply to, if any, or | 42 // The tab id the extension action function should apply to, if any, or |
| 44 // kDefaultTabId if none was specified. | 43 // kDefaultTabId if none was specified. |
| 45 int tab_id_; | 44 int tab_id_; |
| 46 | 45 |
| 47 // Tab content for |tab_id_| if one exists. | 46 // Tab content for |tab_id_| if one exists. |
| 48 TabContentsWrapper* contents_; | 47 TabContents* contents_; |
| 49 | 48 |
| 50 // The extension action for the current extension. | 49 // The extension action for the current extension. |
| 51 ExtensionAction* extension_action_; | 50 ExtensionAction* extension_action_; |
| 52 }; | 51 }; |
| 53 | 52 |
| 54 // | 53 // |
| 55 // Implementations of each extension action API. | 54 // Implementations of each extension action API. |
| 56 // | 55 // |
| 57 // pageAction and browserAction bindings are created for these by extending them | 56 // pageAction and browserAction bindings are created for these by extending them |
| 58 // then declaring an EXTENSION_FUNCTION_NAME. | 57 // then declaring an EXTENSION_FUNCTION_NAME. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 130 |
| 132 // getBadgeBackgroundColor | 131 // getBadgeBackgroundColor |
| 133 class ExtensionActionGetBadgeBackgroundColorFunction | 132 class ExtensionActionGetBadgeBackgroundColorFunction |
| 134 : public ExtensionActionFunction { | 133 : public ExtensionActionFunction { |
| 135 protected: | 134 protected: |
| 136 virtual ~ExtensionActionGetBadgeBackgroundColorFunction() {} | 135 virtual ~ExtensionActionGetBadgeBackgroundColorFunction() {} |
| 137 virtual bool RunExtensionAction() OVERRIDE; | 136 virtual bool RunExtensionAction() OVERRIDE; |
| 138 }; | 137 }; |
| 139 | 138 |
| 140 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_
H_ | 139 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTIONS_API_
H_ |
| OLD | NEW |