Closed Bug 1119890 Opened 10 years ago Closed 8 years ago

Provide a way for PageActions.jsm to specify multiple icons sizes

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1270742

People

(Reporter: mkaply, Unassigned, Mentored)

Details

(Keywords: dev-doc-needed, Whiteboard: [lang=js])

Currently the PageActions add API takes one icon parameter. It's up to the caller to determine the proper icon to pass to the API based on the screen resolution.

We should allow multiple sizes to be passed, like:

icon64: '64.png", icon128: "icon128.png", etc. and then the PageActions jsm would use the proper icon.

See:

https://github.com/leibovic/fennec_rss/blob/master/bootstrap.js#L344

for examples.
Mentor: margaret.leibovic, wjohnston
OS: Mac OS X → Android
Hardware: x86 → All
Whiteboard: [lang=js]
We're just begging for a more uniform way to expose multiple icon sizes/densities across all of our JSM APIs.
Keywords: dev-doc-needed
See chrome's implementation as well:

https://developer.chrome.com/extensions/manifest/icons
Does this fit into the web extensions work?
Flags: needinfo?(mwein)
Yes it does, thanks!
Flags: needinfo?(mwein)
Blocks: 1263005
Once bug 1270742 lands, we'll be able to use ExtensionUtils.jsm to do this. 

I'm moving the relevant code that desktop uses (found in ext-utils.js) into ExtensionUtils.jsm, and then making some additions/modifications so Android can also use it. This is the code for how I'm using IconDetails with PageActions.jsm in ext-pageAction.js:
  
  this.icons = IconDetails.normalize({path: options.default_icon}, extension);
  
  ...  

  let {icon} = IconDetails.getURL(this.icons, context.contentWindow, this.extension, 18);
  let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
  return IconDetails.convertImageURLToDataURL(icon, context, browserWindow).then(dataURI => {
     let options = {
        icon = dataURI,
        ...
     }
     let id = PageActions.add(this.options);
     
     ...
    }
  });

Let me know if you have any questions.  I think we can close this bug once bug 1270742 lands.
No longer blocks: webext-android, 1263005
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
I meant to undo marking this bug as a duplicate before submitting my commit but I forgot to.  If there aren't any objections, however, I'm going to leave it marked that way.
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.