Fix chrome.downloads.getFileIcon for hi-dpi and clarify docs.
commit77a7c431b7852e5ca16a729b1c2805347a1692eb
authorbenjhayden@chromium.org <benjhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Fri, 17 Jan 2014 17:58:20 +0000 (17 17:58 +0000)
committerbenjhayden@chromium.org <benjhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Fri, 17 Jan 2014 17:58:20 +0000 (17 17:58 +0000)
treeaa1701160d7a6d4b1c7b9d0ec2a6741cf533ab3e
parent07af85b6b3d6331635ef0436f4d8117f2ac188b9
Fix chrome.downloads.getFileIcon for hi-dpi and clarify docs.

BUG=334358

TEST:
On a Pixel, install a downloads extension such as this.
https://chrome.google.com/webstore/detail/download-manager-button/jglgknilkoejnnjngnmoobbhdckpdmem
Either right-click on the browser action button and Inspect Popup, or open the background page console.
If there are no downloads, download a file so that there's a file icon to inspect. One easy way to download a file is to open this data url and click the link:
data:text/html,<a href="data:application/octet-stream," download=test-137043005.txt>download an empty file
Copy this javascript into the Developer Tools console:
chrome.downloads.search({limit:1}, function(items) {matchMedia('screen and (-webkit-min-device-pixel-ratio: 1.5)').addListener(function() {chrome.downloads.getFileIcon(items[0].id, function(icon) {console.log('dpr', devicePixelRatio, icon);});});});
This javascript finds a DownloadItem and listens for the devicePixelRatio to change, then fetches the file icon for the new devicePixelRatio.
Type Ctrl+Shift+- and Ctrl+Shift+= to decrease and increase the screen resolution until the console logs at least one line that begins with 'dpr 1' and another line that begins with 'dpr 2'. You might need to increase and/or decrease the resolution several times. The rest of the 'dpr 1' line should be different from the rest of the 'dpr 2' line. If the rest of those lines are the same, then this fix is broken.

Review URL: https://codereview.chromium.org/137043005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245550 0039d316-1c4b-4281-b951-d872f2087c98
chrome/browser/download/download_file_icon_extractor.h
chrome/browser/extensions/api/downloads/downloads_api.cc
chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
chrome/common/extensions/api/downloads.idl