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

Unified Diff: chrome/common/extensions/api/browser_action.json

Issue 10855154: Update browserAction.setIcon and pageAction.setIcon for hidpi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/api/browser_action.json
diff --git a/chrome/common/extensions/api/browser_action.json b/chrome/common/extensions/api/browser_action.json
index 379bacb15f80e750aa7e8baa2b270334151c94cb..fc901e010fb6bee78c4a333632e5db31c2192111 100644
--- a/chrome/common/extensions/api/browser_action.json
+++ b/chrome/common/extensions/api/browser_action.json
@@ -17,6 +17,13 @@
},
"minItems": 4,
"maxItems": 4
+ },
+ {
+ "id": "ImageDataType",
+ "type": "object",
+ "isInstanceOf": "ImageData",
+ "additionalProperties": { "type": "any" },
+ "description": "Pixel data for an image. Must be an ImageData object (for example, from a <code>canvas</code> element)."
Jeffrey Yasskin 2012/08/21 20:10:38 Ok, we should document that here. Would you like t
tbarzic 2012/08/22 00:12:49 ok, I'll add something tomorrow.
tbarzic 2012/08/22 18:43:16 On second thought, I'm not too sure this is the be
}
],
"functions": [
@@ -73,22 +80,38 @@
{
"name": "setIcon",
"type": "function",
- "description": "Sets the icon for the browser action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element. Either the <b>path</b> or the <b>imageData</b> property must be specified.",
+ "description": "Sets the icon for the browser action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the <b>path</b> or the <b>imageData</b> property must be specified.",
"parameters": [
{
"name": "details",
"type": "object",
"properties": {
"imageData": {
- "type": "object",
- "isInstanceOf": "ImageData",
- "additionalProperties": { "type": "any" },
- "description": "Pixel data for an image. Must be an ImageData object (for example, from a <code>canvas</code> element).",
+ "choices": [
+ { "$ref": "ImageDataType" },
+ {
+ "type": "object",
+ "properties": {
+ "19": {"$ref": "ImageDataType", "optional": true},
+ "38": {"$ref": "ImageDataType", "optional": true}
+ }
+ }
+ ],
+ "description": "Either ImageData object or dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image should be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}'",
Jeffrey Yasskin 2012/08/21 20:10:38 Great comment! Nits: It would be nice to call out
tbarzic 2012/08/22 00:12:49 Done.
"optional": true
},
"path": {
- "type": "string",
- "description": "Relative path to an image in the extension to show in the browser action.",
+ "choices": [
+ { "type": "string" },
+ {
+ "type": "object",
+ "properties": {
+ "19": {"type": "string", "optional": true},
+ "38": {"type": "string", "optional": true}
+ }
+ }
+ ],
+ "description": "Either relative image path or dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image should be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}'",
Jeffrey Yasskin 2012/08/21 20:10:38 Same nits as above.
tbarzic 2012/08/22 00:12:49 Done.
"optional": true
},
"tabId": {

Powered by Google App Engine
This is Rietveld 408576698