| 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_PAGE_ACTIONS_AP
I_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_PAGE_ACTIONS_AP
I_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_PAGE_ACTIONS_AP
I_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_PAGE_ACTIONS_AP
I_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/extensions/api/extension_action/extension_actions_api.h
" | 9 #include "chrome/browser/extensions/api/extension_action/extension_actions_api.h
" |
| 10 #include "chrome/browser/extensions/extension_function.h" | 10 #include "chrome/browser/extensions/extension_function.h" |
| 11 | 11 |
| 12 class TabContentsWrapper; | |
| 13 | |
| 14 // Base class for page action APIs. | |
| 15 class PageActionFunction : public ExtensionActionFunction { | |
| 16 protected: | |
| 17 virtual ~PageActionFunction() {} | |
| 18 bool SetVisible(bool visible); | |
| 19 virtual bool RunImpl() OVERRIDE; | |
| 20 | |
| 21 TabContentsWrapper* contents_; | |
| 22 }; | |
| 23 | |
| 24 // Base class for deprecated page actions APIs | 12 // Base class for deprecated page actions APIs |
| 25 class PageActionsFunction : public SyncExtensionFunction { | 13 class PageActionsFunction : public SyncExtensionFunction { |
| 26 protected: | 14 protected: |
| 27 PageActionsFunction(); | 15 PageActionsFunction(); |
| 28 virtual ~PageActionsFunction(); | 16 virtual ~PageActionsFunction(); |
| 29 bool SetPageActionEnabled(bool enable); | 17 bool SetPageActionEnabled(bool enable); |
| 30 }; | 18 }; |
| 31 | 19 |
| 32 // Implement chrome.pageActions.enableForTab(). | 20 // Implement chrome.pageActions.enableForTab(). |
| 33 class EnablePageActionsFunction : public PageActionsFunction { | 21 class EnablePageActionsFunction : public PageActionsFunction { |
| 34 virtual ~EnablePageActionsFunction() {} | 22 virtual ~EnablePageActionsFunction() {} |
| 35 virtual bool RunImpl() OVERRIDE; | 23 virtual bool RunImpl() OVERRIDE; |
| 36 DECLARE_EXTENSION_FUNCTION_NAME("pageActions.enableForTab") | 24 DECLARE_EXTENSION_FUNCTION_NAME("pageActions.enableForTab") |
| 37 }; | 25 }; |
| 38 | 26 |
| 39 // Implement chrome.pageActions.disableForTab(). | 27 // Implement chrome.pageActions.disableForTab(). |
| 40 class DisablePageActionsFunction : public PageActionsFunction { | 28 class DisablePageActionsFunction : public PageActionsFunction { |
| 41 virtual ~DisablePageActionsFunction() {} | 29 virtual ~DisablePageActionsFunction() {} |
| 42 virtual bool RunImpl() OVERRIDE; | 30 virtual bool RunImpl() OVERRIDE; |
| 43 DECLARE_EXTENSION_FUNCTION_NAME("pageActions.disableForTab") | 31 DECLARE_EXTENSION_FUNCTION_NAME("pageActions.disableForTab") |
| 44 }; | 32 }; |
| 45 | 33 |
| 46 // Implement chrome.pageAction.show(). | 34 // |
| 47 class PageActionShowFunction : public PageActionFunction { | 35 // pageAction.* aliases for supported extensionActions APIs. |
| 36 // |
| 37 |
| 38 class PageActionShowFunction : public ExtensionActionShowFunction { |
| 48 virtual ~PageActionShowFunction() {} | 39 virtual ~PageActionShowFunction() {} |
| 49 virtual bool RunExtensionAction() OVERRIDE; | |
| 50 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.show") | 40 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.show") |
| 51 }; | 41 }; |
| 52 | 42 |
| 53 // Implement chrome.pageAction.hide(). | 43 class PageActionHideFunction : public ExtensionActionHideFunction { |
| 54 class PageActionHideFunction : public PageActionFunction { | |
| 55 virtual ~PageActionHideFunction() {} | 44 virtual ~PageActionHideFunction() {} |
| 56 virtual bool RunExtensionAction() OVERRIDE; | |
| 57 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.hide") | 45 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.hide") |
| 58 }; | 46 }; |
| 59 | 47 |
| 60 // Implement chrome.pageAction.setIcon(). | 48 class PageActionSetIconFunction : public ExtensionActionSetIconFunction { |
| 61 class PageActionSetIconFunction : public PageActionFunction { | |
| 62 virtual ~PageActionSetIconFunction() {} | 49 virtual ~PageActionSetIconFunction() {} |
| 63 virtual bool RunExtensionAction() OVERRIDE; | |
| 64 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setIcon") | 50 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setIcon") |
| 65 }; | 51 }; |
| 66 | 52 |
| 67 // Implement chrome.pageAction.setTitle(). | 53 class PageActionSetTitleFunction : public ExtensionActionSetTitleFunction { |
| 68 class PageActionSetTitleFunction : public PageActionFunction { | |
| 69 virtual ~PageActionSetTitleFunction() {} | 54 virtual ~PageActionSetTitleFunction() {} |
| 70 virtual bool RunExtensionAction() OVERRIDE; | |
| 71 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setTitle") | 55 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setTitle") |
| 72 }; | 56 }; |
| 73 | 57 |
| 74 // Implement chrome.pageAction.setPopup(). | 58 class PageActionSetPopupFunction : public ExtensionActionSetPopupFunction { |
| 75 class PageActionSetPopupFunction : public PageActionFunction { | |
| 76 virtual ~PageActionSetPopupFunction() {} | 59 virtual ~PageActionSetPopupFunction() {} |
| 77 virtual bool RunExtensionAction() OVERRIDE; | |
| 78 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setPopup") | 60 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setPopup") |
| 79 }; | 61 }; |
| 80 | 62 |
| 81 // Implement chrome.pageAction.setBadgeBackgroundColor(). | 63 class PageActionGetTitleFunction : public ExtensionActionGetTitleFunction { |
| 82 class PageActionSetBadgeBackgroundColorFunction : public PageActionFunction { | |
| 83 virtual ~PageActionSetBadgeBackgroundColorFunction() {} | |
| 84 virtual bool RunExtensionAction() OVERRIDE; | |
| 85 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeBackgroundColor") | |
| 86 }; | |
| 87 | |
| 88 // Implement chrome.pageAction.setBadgeTextColor(). | |
| 89 class PageActionSetBadgeTextColorFunction : public PageActionFunction { | |
| 90 virtual ~PageActionSetBadgeTextColorFunction() {} | |
| 91 virtual bool RunExtensionAction() OVERRIDE; | |
| 92 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeTextColor") | |
| 93 }; | |
| 94 | |
| 95 // Implement chrome.pageActions.setBadgeText(). | |
| 96 class PageActionSetBadgeTextFunction : public PageActionFunction { | |
| 97 virtual ~PageActionSetBadgeTextFunction() {} | |
| 98 virtual bool RunExtensionAction() OVERRIDE; | |
| 99 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeText") | |
| 100 }; | |
| 101 | |
| 102 // Implement chrome.pageAction.getTitle(). | |
| 103 class PageActionGetTitleFunction : public PageActionFunction { | |
| 104 virtual ~PageActionGetTitleFunction() {} | 64 virtual ~PageActionGetTitleFunction() {} |
| 105 virtual bool RunExtensionAction() OVERRIDE; | |
| 106 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.getTitle") | 65 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.getTitle") |
| 107 }; | 66 }; |
| 108 | 67 |
| 109 // Implement chrome.pageAction.getPopup(). | 68 class PageActionGetPopupFunction : public ExtensionActionGetPopupFunction { |
| 110 class PageActionGetPopupFunction : public PageActionFunction { | |
| 111 virtual ~PageActionGetPopupFunction() {} | 69 virtual ~PageActionGetPopupFunction() {} |
| 112 virtual bool RunExtensionAction() OVERRIDE; | |
| 113 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.getPopup") | 70 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.getPopup") |
| 114 }; | 71 }; |
| 115 | 72 |
| 116 // Implement chrome.pageAction.getBadgeText(). | |
| 117 class PageActionGetBadgeTextFunction : public PageActionFunction { | |
| 118 virtual ~PageActionGetBadgeTextFunction() {} | |
| 119 virtual bool RunExtensionAction() OVERRIDE; | |
| 120 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.getBadgeText") | |
| 121 }; | |
| 122 | |
| 123 // Implement chrome.pageAction.getBadgeBackgroundColor(). | |
| 124 class PageActionGetBadgeBackgroundColorFunction : public PageActionFunction { | |
| 125 virtual ~PageActionGetBadgeBackgroundColorFunction() {} | |
| 126 virtual bool RunExtensionAction() OVERRIDE; | |
| 127 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.getBadgeBackgroundColor") | |
| 128 }; | |
| 129 | |
| 130 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_PAGE_ACTIONS
_API_H_ | 73 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_PAGE_ACTIONS
_API_H_ |
| OLD | NEW |