Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Side by Side Diff: chrome/browser/extensions/extension_page_actions_module.h

Issue 545068: Allow extensions to add, remove, or change their page action popup. (Closed)
Patch Set: Rebase, to run trybots with test data in place. Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 7
8 #include "chrome/browser/extensions/extension_function.h" 8 #include "chrome/browser/extensions/extension_function.h"
9 9
10 class TabContents; 10 class TabContents;
11 class ExtensionAction; 11 class ExtensionAction;
12 12
13 // Base class for page action APIs.
13 class PageActionFunction : public SyncExtensionFunction { 14 class PageActionFunction : public SyncExtensionFunction {
14 protected: 15 protected:
15 virtual ~PageActionFunction() {} 16 virtual ~PageActionFunction() {}
16 bool SetPageActionEnabled(bool enable); 17 bool SetPageActionEnabled(bool enable);
17 18
18 bool InitCommon(int tab_id); 19 bool InitCommon(int tab_id);
19 bool SetVisible(bool visible); 20 bool SetVisible(bool visible);
20 21
21 ExtensionAction* page_action_; 22 ExtensionAction* page_action_;
22 TabContents* contents_; 23 TabContents* contents_;
23 }; 24 };
24 25
26 // Implement chrome.pageActions.enableForTab().
25 class EnablePageActionFunction : public PageActionFunction { 27 class EnablePageActionFunction : public PageActionFunction {
26 ~EnablePageActionFunction() {} 28 ~EnablePageActionFunction() {}
27 virtual bool RunImpl(); 29 virtual bool RunImpl();
28 DECLARE_EXTENSION_FUNCTION_NAME("pageActions.enableForTab") 30 DECLARE_EXTENSION_FUNCTION_NAME("pageActions.enableForTab")
29 }; 31 };
30 32
33 // Implement chrome.pageActions.disableForTab().
31 class DisablePageActionFunction : public PageActionFunction { 34 class DisablePageActionFunction : public PageActionFunction {
32 ~DisablePageActionFunction() {} 35 ~DisablePageActionFunction() {}
33 virtual bool RunImpl(); 36 virtual bool RunImpl();
34 DECLARE_EXTENSION_FUNCTION_NAME("pageActions.disableForTab") 37 DECLARE_EXTENSION_FUNCTION_NAME("pageActions.disableForTab")
35 }; 38 };
36 39
40 // Implement chrome.pageActions.show().
37 class PageActionShowFunction : public PageActionFunction { 41 class PageActionShowFunction : public PageActionFunction {
38 ~PageActionShowFunction() {} 42 ~PageActionShowFunction() {}
39 virtual bool RunImpl(); 43 virtual bool RunImpl();
40 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.show") 44 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.show")
41 }; 45 };
42 46
47 // Implement chrome.pageActions.hide().
43 class PageActionHideFunction : public PageActionFunction { 48 class PageActionHideFunction : public PageActionFunction {
44 ~PageActionHideFunction() {} 49 ~PageActionHideFunction() {}
45 virtual bool RunImpl(); 50 virtual bool RunImpl();
46 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.hide") 51 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.hide")
47 }; 52 };
48 53
54 // Implement chrome.pageActions.setIcon().
49 class PageActionSetIconFunction : public PageActionFunction { 55 class PageActionSetIconFunction : public PageActionFunction {
50 ~PageActionSetIconFunction() {} 56 ~PageActionSetIconFunction() {}
51 virtual bool RunImpl(); 57 virtual bool RunImpl();
52 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setIcon") 58 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setIcon")
53 }; 59 };
54 60
61 // Implement chrome.pageActions.setTitle().
55 class PageActionSetTitleFunction : public PageActionFunction { 62 class PageActionSetTitleFunction : public PageActionFunction {
56 ~PageActionSetTitleFunction() {} 63 ~PageActionSetTitleFunction() {}
57 virtual bool RunImpl(); 64 virtual bool RunImpl();
58 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setTitle") 65 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setTitle")
59 }; 66 };
60 67
68 // Implement chrome.pageActions.setPopup().
69 class PageActionSetPopupFunction : public PageActionFunction {
70 ~PageActionSetPopupFunction() {}
71 virtual bool RunImpl();
72 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setPopup")
73 };
74
75 // Implement chrome.pageActions.setBadgeBackgroundColor().
61 class PageActionSetBadgeBackgroundColorFunction : public PageActionFunction { 76 class PageActionSetBadgeBackgroundColorFunction : public PageActionFunction {
62 ~PageActionSetBadgeBackgroundColorFunction() {} 77 ~PageActionSetBadgeBackgroundColorFunction() {}
63 virtual bool RunImpl(); 78 virtual bool RunImpl();
64 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeBackgroundColor") 79 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeBackgroundColor")
65 }; 80 };
66 81
82 // Implement chrome.pageActions.setBadgeTextColor().
67 class PageActionSetBadgeTextColorFunction : public PageActionFunction { 83 class PageActionSetBadgeTextColorFunction : public PageActionFunction {
68 ~PageActionSetBadgeTextColorFunction() {} 84 ~PageActionSetBadgeTextColorFunction() {}
69 virtual bool RunImpl(); 85 virtual bool RunImpl();
70 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeTextColor") 86 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeTextColor")
71 }; 87 };
72 88
89 // Implement chrome.pageActions.setBadgeText().
73 class PageActionSetBadgeTextFunction : public PageActionFunction { 90 class PageActionSetBadgeTextFunction : public PageActionFunction {
74 ~PageActionSetBadgeTextFunction() {} 91 ~PageActionSetBadgeTextFunction() {}
75 virtual bool RunImpl(); 92 virtual bool RunImpl();
76 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeText") 93 DECLARE_EXTENSION_FUNCTION_NAME("pageAction.setBadgeText")
77 }; 94 };
78 95
79 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PAGE_ACTIONS_MODULE_H_ 96 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PAGE_ACTIONS_MODULE_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_function_dispatcher.cc ('k') | chrome/browser/extensions/extension_page_actions_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698