| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_EXTENSION_PAGE_ACTIONS_MODULE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PAGE_ACTIONS_MODULE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PAGE_ACTIONS_MODULE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PAGE_ACTIONS_MODULE_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 | 10 |
| 11 class TabContentsWrapper; | 11 class TabContentsWrapper; |
| 12 class ExtensionAction; | 12 class ExtensionAction; |
| 13 | 13 |
| 14 // Base class for page action APIs. | 14 // Base class for page action APIs. |
| 15 class PageActionFunction : public SyncExtensionFunction { | 15 class PageActionFunction : public SyncExtensionFunction { |
| 16 protected: | 16 protected: |
| 17 virtual ~PageActionFunction() {} | 17 virtual ~PageActionFunction() {} |
| 18 bool SetPageActionEnabled(bool enable); | 18 bool SetPageActionEnabled(bool enable); |
| 19 | 19 |
| 20 bool InitCommon(int tab_id); | 20 bool InitCommon(int tab_id); |
| 21 bool SetVisible(bool visible); | 21 bool SetVisible(bool visible); |
| 22 | 22 |
| 23 ExtensionAction* page_action_; | 23 ExtensionAction* page_action_; |
| 24 TabContentsWrapper* contents_; | 24 TabContentsWrapper* contents_; |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 // Implement chrome.pageActions.enableForTab(). | 27 // Implement chrome.pageActions.enableForTab(). |
| 28 class EnablePageActionFunction : public PageActionFunction { | 28 class EnablePageActionFunction : public PageActionFunction { |
| 29 ~EnablePageActionFunction() {} | 29 virtual ~EnablePageActionFunction() {} |
| 30 virtual bool RunImpl(); | 30 virtual bool RunImpl(); |
| 31 DECLARE_EXTENSION_FUNCTION_NAME("pageActions.enableForTab") | 31 DECLARE_EXTENSION_FUNCTION_NAME("pageActions.enableForTab") |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 // Implement chrome.pageActions.disableForTab(). | 34 // Implement chrome.pageActions.disableForTab(). |
| 35 class DisablePageActionFunction : public PageActionFunction { | 35 class DisablePageActionFunction : public PageActionFunction { |
| 36 ~DisablePageActionFunction() {} | 36 virtual ~DisablePageActionFunction() {} |
| 37 virtual bool RunImpl(); | 37 virtual bool RunImpl(); |
| 38 DECLARE_EXTENSION_FUNCTION_NAME("pageActions.disableForTab") | 38 DECLARE_EXTENSION_FUNCTION_NAME("pageActions.disableForTab") |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // Implement chrome.pageActions.show(). | 41 // Implement chrome.pageActions.show(). |
| 42 class PageActionShowFunction : public PageActionFunction { | 42 class PageActionShowFunction : public PageActionFunction { |
| 43 ~PageActionShowFunction() {} | 43 virtual ~PageActionShowFunction() {} |
| 44 virtual bool RunImpl(); | 44 virtual bool RunImpl(); |
| 45 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.show") | 45 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.show") |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 // Implement chrome.pageActions.hide(). | 48 // Implement chrome.pageActions.hide(). |
| 49 class PageActionHideFunction : public PageActionFunction { | 49 class PageActionHideFunction : public PageActionFunction { |
| 50 ~PageActionHideFunction() {} | 50 virtual ~PageActionHideFunction() {} |
| 51 virtual bool RunImpl(); | 51 virtual bool RunImpl(); |
| 52 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.hide") | 52 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.hide") |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 // Implement chrome.pageActions.setIcon(). | 55 // Implement chrome.pageActions.setIcon(). |
| 56 class PageActionSetIconFunction : public PageActionFunction { | 56 class PageActionSetIconFunction : public PageActionFunction { |
| 57 ~PageActionSetIconFunction() {} | 57 virtual ~PageActionSetIconFunction() {} |
| 58 virtual bool RunImpl(); | 58 virtual bool RunImpl(); |
| 59 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setIcon") | 59 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setIcon") |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 // Implement chrome.pageActions.setTitle(). | 62 // Implement chrome.pageActions.setTitle(). |
| 63 class PageActionSetTitleFunction : public PageActionFunction { | 63 class PageActionSetTitleFunction : public PageActionFunction { |
| 64 ~PageActionSetTitleFunction() {} | 64 virtual ~PageActionSetTitleFunction() {} |
| 65 virtual bool RunImpl(); | 65 virtual bool RunImpl(); |
| 66 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setTitle") | 66 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setTitle") |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 // Implement chrome.pageActions.setPopup(). | 69 // Implement chrome.pageActions.setPopup(). |
| 70 class PageActionSetPopupFunction : public PageActionFunction { | 70 class PageActionSetPopupFunction : public PageActionFunction { |
| 71 ~PageActionSetPopupFunction() {} | 71 virtual ~PageActionSetPopupFunction() {} |
| 72 virtual bool RunImpl(); | 72 virtual bool RunImpl(); |
| 73 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setPopup") | 73 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setPopup") |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 // Implement chrome.pageActions.setBadgeBackgroundColor(). | 76 // Implement chrome.pageActions.setBadgeBackgroundColor(). |
| 77 class PageActionSetBadgeBackgroundColorFunction : public PageActionFunction { | 77 class PageActionSetBadgeBackgroundColorFunction : public PageActionFunction { |
| 78 ~PageActionSetBadgeBackgroundColorFunction() {} | 78 virtual ~PageActionSetBadgeBackgroundColorFunction() {} |
| 79 virtual bool RunImpl(); | 79 virtual bool RunImpl(); |
| 80 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeBackgroundColor") | 80 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeBackgroundColor") |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 // Implement chrome.pageActions.setBadgeTextColor(). | 83 // Implement chrome.pageActions.setBadgeTextColor(). |
| 84 class PageActionSetBadgeTextColorFunction : public PageActionFunction { | 84 class PageActionSetBadgeTextColorFunction : public PageActionFunction { |
| 85 ~PageActionSetBadgeTextColorFunction() {} | 85 virtual ~PageActionSetBadgeTextColorFunction() {} |
| 86 virtual bool RunImpl(); | 86 virtual bool RunImpl(); |
| 87 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeTextColor") | 87 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeTextColor") |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 // Implement chrome.pageActions.setBadgeText(). | 90 // Implement chrome.pageActions.setBadgeText(). |
| 91 class PageActionSetBadgeTextFunction : public PageActionFunction { | 91 class PageActionSetBadgeTextFunction : public PageActionFunction { |
| 92 ~PageActionSetBadgeTextFunction() {} | 92 virtual ~PageActionSetBadgeTextFunction() {} |
| 93 virtual bool RunImpl(); | 93 virtual bool RunImpl(); |
| 94 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeText") | 94 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeText") |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PAGE_ACTIONS_MODULE_H_ | 97 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PAGE_ACTIONS_MODULE_H_ |
| OLD | NEW |