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

Side by Side Diff: docs/page_action_ap_iv2.md

Issue 1309473002: WIP: Migrate Wiki content over to src/docs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
(Empty)
1 # Introduction
2
3 We currently have a page actions API, but it is very weird because we were learn ing what we liked as we were building it. We also now have a BrowserActions API that we like a lot more, but it stinks that it is very different from the page a ctions API.
Bons 2015/08/20 20:16:50 delete due to staleness?
4
5 This proposal is for a new version of the page actions API that is more like the browser actions one. Because the two APIs are so similar, please see [that docu ment](BrowserActions.md) for more details.
6
7 There can be at most one browser or page action per-extension.
8
9 The difference between browser actions and page actions is that page actions onl y have the lifetime of a particular document. They are shown for a specific tab, but always go away when that tab navigates.
10
11 ## Manifest
12
13 ```
14 {
15 "name": "My extension that has a page action",
16 "version": "1",
17 "page_action": {
18 "default_icon": "foo.png", // optional
19 "default_title": "Click here for foo", // required
20 "popup": "popup.html" // optional
21 }
22 }
23 ```
24
25 ## Programmatic API
26
27 ```
28 // Show the page action. The page action is shown whenever the tab is selected.
29 void chrome.pageAction.show(int tabId);
30
31 // Hide the page action.
32 void chrome.pageAction.hide(int tabId);
33
34 // Set the icon. Can be specified using either a path to a static icon inside
35 // the extension, or by using raw image data from an HTML5 canvas element
36 // (see: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas- element.html#imagedata)
37 // Either the imageData or path property must be set.
38 void chrome.pageAction.setIcon({optional ImageData imageData,
39 optional string path,
40 int tabId});
41
42 // Set the title of the page action. This is displayed in a tooltip over the
43 // page action.
44 void chrome.pageAction.setTitle({string title, int tabId});
45
46 // Set the badge background color. The |color| array is an array of four integer s
47 // in the range [0-255] that specify the ARGB color for the badge background.
48 void chrome.pageAction.setBadgeBackgroundColor({int[] color, int tabId});
49
50 // Set the badge text color. The |color| array is an array of four integers
51 // in the range [0-255] that specify the ARGB color for the text background.
52 void chrome.pageAction.setBadgeTextColor({int[] color, int tabId});
53
54 // Set the badge text. This can be any string, but practically speaking, it is
55 // limited to about 4 characters.
56 void chrome.pageAction.setBadgeText({string text, int tabId});
57
58 // Fired when the page action is clicked.
59 event chrome.pageAction.onClicked(Tab tab);
60 ```
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698