| 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; | 12 class TabContentsWrapper; |
| 13 | 13 |
| 14 // Base class for page action APIs. | 14 // Base class for page action APIs. |
| 15 class PageActionFunction : public ExtensionActionFunction { | 15 class PageActionFunction : public ExtensionActionFunction { |
| 16 protected: | 16 protected: |
| 17 virtual ~PageActionFunction() {} | 17 virtual ~PageActionFunction() {} |
| 18 bool SetVisible(bool visible); | 18 bool SetVisible(bool visible); |
| 19 |
| 20 // ExtensionFunction: |
| 19 virtual bool RunImpl() OVERRIDE; | 21 virtual bool RunImpl() OVERRIDE; |
| 20 | 22 |
| 21 TabContentsWrapper* contents_; | 23 TabContentsWrapper* contents_; |
| 22 }; | 24 }; |
| 23 | 25 |
| 24 // Base class for deprecated page actions APIs | 26 // Base class for deprecated page actions APIs |
| 25 class PageActionsFunction : public SyncExtensionFunction { | 27 class PageActionsFunction : public SyncExtensionFunction { |
| 26 protected: | 28 protected: |
| 27 PageActionsFunction(); | 29 PageActionsFunction(); |
| 28 virtual ~PageActionsFunction(); | 30 virtual ~PageActionsFunction(); |
| 29 bool SetPageActionEnabled(bool enable); | 31 bool SetPageActionEnabled(bool enable); |
| 30 }; | 32 }; |
| 31 | 33 |
| 32 // Implement chrome.pageActions.enableForTab(). | 34 // Implement chrome.pageActions.enableForTab(). |
| 33 class EnablePageActionsFunction : public PageActionsFunction { | 35 class EnablePageActionsFunction : public PageActionsFunction { |
| 36 public: |
| 37 DECLARE_EXTENSION_FUNCTION_NAME("pageActions.enableForTab") |
| 38 |
| 39 protected: |
| 34 virtual ~EnablePageActionsFunction() {} | 40 virtual ~EnablePageActionsFunction() {} |
| 41 |
| 42 // ExtensionFunction: |
| 35 virtual bool RunImpl() OVERRIDE; | 43 virtual bool RunImpl() OVERRIDE; |
| 36 DECLARE_EXTENSION_FUNCTION_NAME("pageActions.enableForTab") | |
| 37 }; | 44 }; |
| 38 | 45 |
| 39 // Implement chrome.pageActions.disableForTab(). | 46 // Implement chrome.pageActions.disableForTab(). |
| 40 class DisablePageActionsFunction : public PageActionsFunction { | 47 class DisablePageActionsFunction : public PageActionsFunction { |
| 48 public: |
| 49 DECLARE_EXTENSION_FUNCTION_NAME("pageActions.disableForTab") |
| 50 |
| 51 protected: |
| 41 virtual ~DisablePageActionsFunction() {} | 52 virtual ~DisablePageActionsFunction() {} |
| 53 |
| 54 // ExtensionFunction: |
| 42 virtual bool RunImpl() OVERRIDE; | 55 virtual bool RunImpl() OVERRIDE; |
| 43 DECLARE_EXTENSION_FUNCTION_NAME("pageActions.disableForTab") | |
| 44 }; | 56 }; |
| 45 | 57 |
| 46 // Implement chrome.pageAction.show(). | 58 // Implement chrome.pageAction.show(). |
| 47 class PageActionShowFunction : public PageActionFunction { | 59 class PageActionShowFunction : public PageActionFunction { |
| 60 public: |
| 61 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.show") |
| 62 |
| 63 protected: |
| 48 virtual ~PageActionShowFunction() {} | 64 virtual ~PageActionShowFunction() {} |
| 65 |
| 66 // ExtensionActionFunction: |
| 49 virtual bool RunExtensionAction() OVERRIDE; | 67 virtual bool RunExtensionAction() OVERRIDE; |
| 50 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.show") | |
| 51 }; | 68 }; |
| 52 | 69 |
| 53 // Implement chrome.pageAction.hide(). | 70 // Implement chrome.pageAction.hide(). |
| 54 class PageActionHideFunction : public PageActionFunction { | 71 class PageActionHideFunction : public PageActionFunction { |
| 72 public: |
| 73 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.hide") |
| 74 |
| 75 protected: |
| 55 virtual ~PageActionHideFunction() {} | 76 virtual ~PageActionHideFunction() {} |
| 77 |
| 78 // ExtensionActionFunction: |
| 56 virtual bool RunExtensionAction() OVERRIDE; | 79 virtual bool RunExtensionAction() OVERRIDE; |
| 57 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.hide") | |
| 58 }; | 80 }; |
| 59 | 81 |
| 60 // Implement chrome.pageAction.setIcon(). | 82 // Implement chrome.pageAction.setIcon(). |
| 61 class PageActionSetIconFunction : public PageActionFunction { | 83 class PageActionSetIconFunction : public PageActionFunction { |
| 84 public: |
| 85 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setIcon") |
| 86 |
| 87 protected: |
| 62 virtual ~PageActionSetIconFunction() {} | 88 virtual ~PageActionSetIconFunction() {} |
| 89 |
| 90 // ExtensionActionFunction: |
| 63 virtual bool RunExtensionAction() OVERRIDE; | 91 virtual bool RunExtensionAction() OVERRIDE; |
| 64 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setIcon") | |
| 65 }; | 92 }; |
| 66 | 93 |
| 67 // Implement chrome.pageAction.setTitle(). | 94 // Implement chrome.pageAction.setTitle(). |
| 68 class PageActionSetTitleFunction : public PageActionFunction { | 95 class PageActionSetTitleFunction : public PageActionFunction { |
| 96 public: |
| 97 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setTitle") |
| 98 |
| 99 protected: |
| 69 virtual ~PageActionSetTitleFunction() {} | 100 virtual ~PageActionSetTitleFunction() {} |
| 101 |
| 102 // ExtensionActionFunction: |
| 70 virtual bool RunExtensionAction() OVERRIDE; | 103 virtual bool RunExtensionAction() OVERRIDE; |
| 71 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setTitle") | |
| 72 }; | 104 }; |
| 73 | 105 |
| 74 // Implement chrome.pageAction.setPopup(). | 106 // Implement chrome.pageAction.setPopup(). |
| 75 class PageActionSetPopupFunction : public PageActionFunction { | 107 class PageActionSetPopupFunction : public PageActionFunction { |
| 108 public: |
| 109 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setPopup") |
| 110 |
| 111 protected: |
| 76 virtual ~PageActionSetPopupFunction() {} | 112 virtual ~PageActionSetPopupFunction() {} |
| 113 |
| 114 // ExtensionActionFunction: |
| 77 virtual bool RunExtensionAction() OVERRIDE; | 115 virtual bool RunExtensionAction() OVERRIDE; |
| 78 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setPopup") | |
| 79 }; | 116 }; |
| 80 | 117 |
| 81 // Implement chrome.pageAction.setBadgeBackgroundColor(). | 118 // Implement chrome.pageAction.setBadgeBackgroundColor(). |
| 82 class PageActionSetBadgeBackgroundColorFunction : public PageActionFunction { | 119 class PageActionSetBadgeBackgroundColorFunction : public PageActionFunction { |
| 120 public: |
| 121 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeBackgroundColor") |
| 122 |
| 123 protected: |
| 83 virtual ~PageActionSetBadgeBackgroundColorFunction() {} | 124 virtual ~PageActionSetBadgeBackgroundColorFunction() {} |
| 125 |
| 126 // ExtensionActionFunction: |
| 84 virtual bool RunExtensionAction() OVERRIDE; | 127 virtual bool RunExtensionAction() OVERRIDE; |
| 85 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeBackgroundColor") | |
| 86 }; | 128 }; |
| 87 | 129 |
| 88 // Implement chrome.pageAction.setBadgeTextColor(). | 130 // Implement chrome.pageAction.setBadgeTextColor(). |
| 89 class PageActionSetBadgeTextColorFunction : public PageActionFunction { | 131 class PageActionSetBadgeTextColorFunction : public PageActionFunction { |
| 132 public: |
| 133 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeTextColor") |
| 134 |
| 135 protected: |
| 90 virtual ~PageActionSetBadgeTextColorFunction() {} | 136 virtual ~PageActionSetBadgeTextColorFunction() {} |
| 137 |
| 138 // ExtensionActionFunction: |
| 91 virtual bool RunExtensionAction() OVERRIDE; | 139 virtual bool RunExtensionAction() OVERRIDE; |
| 92 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeTextColor") | |
| 93 }; | 140 }; |
| 94 | 141 |
| 95 // Implement chrome.pageActions.setBadgeText(). | 142 // Implement chrome.pageActions.setBadgeText(). |
| 96 class PageActionSetBadgeTextFunction : public PageActionFunction { | 143 class PageActionSetBadgeTextFunction : public PageActionFunction { |
| 144 public: |
| 145 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeText") |
| 146 |
| 147 protected: |
| 97 virtual ~PageActionSetBadgeTextFunction() {} | 148 virtual ~PageActionSetBadgeTextFunction() {} |
| 149 |
| 150 // ExtensionActionFunction: |
| 98 virtual bool RunExtensionAction() OVERRIDE; | 151 virtual bool RunExtensionAction() OVERRIDE; |
| 99 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeText") | |
| 100 }; | 152 }; |
| 101 | 153 |
| 102 // Implement chrome.pageAction.getTitle(). | 154 // Implement chrome.pageAction.getTitle(). |
| 103 class PageActionGetTitleFunction : public PageActionFunction { | 155 class PageActionGetTitleFunction : public PageActionFunction { |
| 156 public: |
| 157 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.getTitle") |
| 158 |
| 159 protected: |
| 104 virtual ~PageActionGetTitleFunction() {} | 160 virtual ~PageActionGetTitleFunction() {} |
| 161 |
| 162 // ExtensionActionFunction: |
| 105 virtual bool RunExtensionAction() OVERRIDE; | 163 virtual bool RunExtensionAction() OVERRIDE; |
| 106 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.getTitle") | |
| 107 }; | 164 }; |
| 108 | 165 |
| 109 // Implement chrome.pageAction.getPopup(). | 166 // Implement chrome.pageAction.getPopup(). |
| 110 class PageActionGetPopupFunction : public PageActionFunction { | 167 class PageActionGetPopupFunction : public PageActionFunction { |
| 168 public: |
| 169 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.getPopup") |
| 170 |
| 171 protected: |
| 111 virtual ~PageActionGetPopupFunction() {} | 172 virtual ~PageActionGetPopupFunction() {} |
| 173 |
| 174 // ExtensionActionFunction: |
| 112 virtual bool RunExtensionAction() OVERRIDE; | 175 virtual bool RunExtensionAction() OVERRIDE; |
| 113 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.getPopup") | |
| 114 }; | 176 }; |
| 115 | 177 |
| 116 // Implement chrome.pageAction.getBadgeText(). | 178 // Implement chrome.pageAction.getBadgeText(). |
| 117 class PageActionGetBadgeTextFunction : public PageActionFunction { | 179 class PageActionGetBadgeTextFunction : public PageActionFunction { |
| 180 public: |
| 181 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.getBadgeText") |
| 182 |
| 183 protected: |
| 118 virtual ~PageActionGetBadgeTextFunction() {} | 184 virtual ~PageActionGetBadgeTextFunction() {} |
| 185 |
| 186 // ExtensionActionFunction: |
| 119 virtual bool RunExtensionAction() OVERRIDE; | 187 virtual bool RunExtensionAction() OVERRIDE; |
| 120 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.getBadgeText") | |
| 121 }; | 188 }; |
| 122 | 189 |
| 123 // Implement chrome.pageAction.getBadgeBackgroundColor(). | 190 // Implement chrome.pageAction.getBadgeBackgroundColor(). |
| 124 class PageActionGetBadgeBackgroundColorFunction : public PageActionFunction { | 191 class PageActionGetBadgeBackgroundColorFunction : public PageActionFunction { |
| 192 public: |
| 193 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.getBadgeBackgroundColor") |
| 194 |
| 195 protected: |
| 125 virtual ~PageActionGetBadgeBackgroundColorFunction() {} | 196 virtual ~PageActionGetBadgeBackgroundColorFunction() {} |
| 197 |
| 198 // ExtensionActionFunction: |
| 126 virtual bool RunExtensionAction() OVERRIDE; | 199 virtual bool RunExtensionAction() OVERRIDE; |
| 127 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.getBadgeBackgroundColor") | |
| 128 }; | 200 }; |
| 129 | 201 |
| 130 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_PAGE_ACTIONS
_API_H_ | 202 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_PAGE_ACTIONS
_API_H_ |
| OLD | NEW |