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

Issue 12881003: ShortcutInfo::favicon is now a gfx::ImageFamily instead of gfx::Image. (Closed)

Created:
7 years, 9 months ago by Matt Giuca
Modified:
7 years, 8 months ago
CC:
chromium-reviews, tfarina, sail+watch_chromium.org, benwells, Robert Sesek, chrome-apps-syd-reviews_chromium.org
Base URL:
http://git.chromium.org/chromium/src.git@master
Visibility:
Public.

Description

ShortcutInfo::favicon is now a gfx::ImageFamily instead of gfx::Image. This fixes the bad usage where a single Image contained all icon images at the "100P" scale factor. Now each Image in the family contains a single representation. Updated all usages of ShortcutInfo::favicon to use the ImageFamily. Several places where the "get best size icon" algorithm was duplicated have been replaced with a call to ImageFamily::GetBest. BUG=189137 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=193558

Patch Set 1 #

Patch Set 2 : web_app_mac: Fix compile error (no Mac to test it on so I'm building in the dark). #

Total comments: 16

Patch Set 3 : Fixed Mac compile issues (hopefully), and unit_test failures on all platforms. #

Patch Set 4 : More Mac test fixing. #

Patch Set 5 : Added a custom iterator for IconFamily. #

Patch Set 6 : Better lookup algorithm for non-square images. Finds most appropriate aspect ratio before matching … #

Patch Set 7 : Added test suite for icon_family. #

Total comments: 1

Patch Set 8 : Fixed IconFamily::Get and associated tests. #

Patch Set 9 : Renamed IconFamily to ImageFamily, as it is more generic. #

Patch Set 10 : IconFamily now has gfx::Image instead of gfx::ImageSkia. #

Patch Set 11 : shell_integration_linux: Use gfx::Image::As1xPNGBytes() instead of manually encoding PNGs. #

Patch Set 12 : web_app_mac: Restore the call to EnsureRepsForSupportedScaleFactors. #

Patch Set 13 : Fix Windows build. #

Patch Set 14 : Rebase to latest HEAD. #

Patch Set 15 : Minor. #

Total comments: 7

Patch Set 16 : Use a constant instead of magic number. #

Total comments: 24

Patch Set 17 : Respond to reviewer feedback. #

Patch Set 18 : Rebase to HEAD (rename ImageFamily::Get to GetBest). #

Patch Set 19 : Fix mac build. #

Patch Set 20 : Reverting GetNativeImageNamed back to GetImageNamed (mac tests). #

Patch Set 21 : Revert Patch Set 20; that was not the culprit. #

Patch Set 22 : Fix UpdateIcon on Mac (get the correct image representation from NSImage). #

Total comments: 6

Patch Set 23 : Respond to reviewer feedback. #

Patch Set 24 : Rebase to HEAD. #

Total comments: 4

Patch Set 25 : CopyGdkPixbuf and TODO. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+127 lines, -141 lines) Patch
M chrome/browser/shell_integration.h View 1 2 3 4 5 6 7 8 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/shell_integration_linux.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 5 chunks +14 lines, -16 lines 0 comments Download
M chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h View 1 2 3 4 5 6 7 8 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +9 lines, -32 lines 0 comments Download
M chrome/browser/ui/views/create_application_shortcut_view.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 9 chunks +20 lines, -51 lines 0 comments Download
M chrome/browser/ui/views/extensions/native_app_window_views.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/ui/web_applications/web_app_ui.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 6 chunks +29 lines, -7 lines 0 comments Download
M chrome/browser/web_applications/web_app.h View 1 2 3 4 5 6 7 8 2 chunks +6 lines, -1 line 0 comments Download
M chrome/browser/web_applications/web_app_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2 chunks +20 lines, -16 lines 0 comments Download
M chrome/browser/web_applications/web_app_mac_unittest.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +7 lines, -5 lines 0 comments Download
M chrome/browser/web_applications/web_app_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 4 chunks +17 lines, -7 lines 0 comments Download

Messages

Total messages: 45 (0 generated)
benwells
https://codereview.chromium.org/12881003/diff/3001/ui/gfx/icon_family.h File ui/gfx/icon_family.h (right): https://codereview.chromium.org/12881003/diff/3001/ui/gfx/icon_family.h#newcode40 ui/gfx/icon_family.h:40: // The icon SHOULD be square; if not, its ...
7 years, 9 months ago (2013-03-17 22:42:36 UTC) #1
Matt Giuca
https://codereview.chromium.org/12881003/diff/3001/ui/gfx/icon_family.h File ui/gfx/icon_family.h (right): https://codereview.chromium.org/12881003/diff/3001/ui/gfx/icon_family.h#newcode40 ui/gfx/icon_family.h:40: // The icon SHOULD be square; if not, its ...
7 years, 9 months ago (2013-03-17 22:51:18 UTC) #2
pkotwicz
Thanks a lot for looking into this! I have added a few comments. The comments ...
7 years, 9 months ago (2013-03-18 03:22:43 UTC) #3
Matt Giuca
https://codereview.chromium.org/12881003/diff/3001/chrome/browser/ui/web_applications/web_app_ui.cc File chrome/browser/ui/web_applications/web_app_ui.cc (right): https://codereview.chromium.org/12881003/diff/3001/chrome/browser/ui/web_applications/web_app_ui.cc#newcode381 chrome/browser/ui/web_applications/web_app_ui.cc:381: info->favicon.Add(favicon_tab_helper->GetFavicon()); On 2013/03/18 03:22:43, pkotwicz wrote: > Comment: Please ...
7 years, 9 months ago (2013-03-18 07:41:16 UTC) #4
pkotwicz
https://codereview.chromium.org/12881003/diff/3001/ui/gfx/icon_family.cc File ui/gfx/icon_family.cc (right): https://codereview.chromium.org/12881003/diff/3001/ui/gfx/icon_family.cc#newcode19 ui/gfx/icon_family.cc:19: const gfx::ImageSkia* imageskia = icon.ToImageSkia(); ImageSkia is ref counted ...
7 years, 9 months ago (2013-03-18 16:30:23 UTC) #5
sail
+rsesek who might be interested
7 years, 9 months ago (2013-03-18 17:38:22 UTC) #6
Matt Giuca
https://codereview.chromium.org/12881003/diff/3001/ui/gfx/icon_family.cc File ui/gfx/icon_family.cc (right): https://codereview.chromium.org/12881003/diff/3001/ui/gfx/icon_family.cc#newcode19 ui/gfx/icon_family.cc:19: const gfx::ImageSkia* imageskia = icon.ToImageSkia(); On 2013/03/18 16:30:23, pkotwicz ...
7 years, 9 months ago (2013-03-18 22:45:20 UTC) #7
Matt Giuca
pkotwicz: I've hit a stumbling block, and maybe you have an opinion about this. In ...
7 years, 9 months ago (2013-03-19 07:58:12 UTC) #8
Robert Sesek
I think it's good to abstract away multiresoultion file icons, but I think this problem ...
7 years, 9 months ago (2013-03-19 14:49:24 UTC) #9
Matt Giuca
On 2013/03/19 14:49:24, rsesek wrote: > I think it's good to abstract away multiresoultion file ...
7 years, 9 months ago (2013-03-20 00:31:34 UTC) #10
Matt Giuca
Hello again. I'm just thinking about the gfx::Image thing. The problem with it is that ...
7 years, 9 months ago (2013-03-20 08:46:07 UTC) #11
pkotwicz
gfx::Image should have a public getter for width and height. It is something that I ...
7 years, 9 months ago (2013-03-20 14:12:19 UTC) #12
Robert Sesek
On 2013/03/20 00:31:34, Matt Giuca wrote: > Well if you give it an Image it ...
7 years, 9 months ago (2013-03-20 15:35:29 UTC) #13
pkotwicz
https://codereview.chromium.org/12881003/diff/35015/chrome/browser/web_applications/web_app_mac.mm File chrome/browser/web_applications/web_app_mac.mm (right): https://codereview.chromium.org/12881003/diff/35015/chrome/browser/web_applications/web_app_mac.mm#newcode211 chrome/browser/web_applications/web_app_mac.mm:211: NSBitmapImageRep* image_rep = SkBitmapToImageRep(bitmap); There is one case where ...
7 years, 9 months ago (2013-03-20 22:19:52 UTC) #14
Matt Giuca
OK I am adding support for Width and Height to gfx::Image in a separate CL ...
7 years, 9 months ago (2013-03-22 07:55:49 UTC) #15
pkotwicz
The OnImageLoaded() exception sounds ok. To give some more background: EnsureRepsForSupportedScaleFactors() is used as protection ...
7 years, 9 months ago (2013-03-22 13:44:03 UTC) #16
Matt Giuca
pkotwicz: I'm still unsure about the multiple image representations in web_app_mac. I have restored the ...
7 years, 9 months ago (2013-03-27 03:25:44 UTC) #17
pkotwicz
Yes, you should be exporting them both into a single image set. However, AddBitmapImageRepToIconFamily() does ...
7 years, 9 months ago (2013-03-27 04:35:05 UTC) #18
Matt Giuca
On 2013/03/27 04:35:05, pkotwicz wrote: > Yes, you should be exporting them both into a ...
7 years, 9 months ago (2013-03-27 04:51:05 UTC) #19
pkotwicz
Sorry for not being clear and for the lengthiness of all of this. I am ...
7 years, 9 months ago (2013-03-27 05:16:56 UTC) #20
pkotwicz
Given that we do not support density information in AddBitmapImageRepToIconFamily(), there is no point in ...
7 years, 9 months ago (2013-03-27 05:20:22 UTC) #21
Matt Giuca
On 2013/03/27 05:20:22, pkotwicz wrote: > Given that we do not support density information in ...
7 years, 9 months ago (2013-03-27 05:44:48 UTC) #22
pkotwicz
1) I think that I am failing to communicate. Please ping me if you still ...
7 years, 9 months ago (2013-03-27 14:48:44 UTC) #23
Matt Giuca
On 2013/03/27 14:48:44, pkotwicz wrote: > 1) I think that I am failing to communicate. ...
7 years, 9 months ago (2013-03-27 23:44:49 UTC) #24
Matt Giuca
This is ready for review now. The prerequisite CL (https://codereview.chromium.org/12704026/) is in the CQ, so ...
7 years, 8 months ago (2013-04-04 01:24:21 UTC) #25
benwells
https://codereview.chromium.org/12881003/diff/90001/chrome/browser/ui/views/create_application_shortcut_view.cc File chrome/browser/ui/views/create_application_shortcut_view.cc (right): https://codereview.chromium.org/12881003/diff/90001/chrome/browser/ui/views/create_application_shortcut_view.cc#newcode445 chrome/browser/ui/views/create_application_shortcut_view.cc:445: const gfx::Image* icon = shortcut_info_.favicon.Get(0, 0); So the way ...
7 years, 8 months ago (2013-04-04 04:58:29 UTC) #26
Matt Giuca
https://codereview.chromium.org/12881003/diff/90001/chrome/browser/ui/views/create_application_shortcut_view.cc File chrome/browser/ui/views/create_application_shortcut_view.cc (right): https://codereview.chromium.org/12881003/diff/90001/chrome/browser/ui/views/create_application_shortcut_view.cc#newcode445 chrome/browser/ui/views/create_application_shortcut_view.cc:445: const gfx::Image* icon = shortcut_info_.favicon.Get(0, 0); On 2013/04/04 04:58:30, ...
7 years, 8 months ago (2013-04-04 05:15:35 UTC) #27
pkotwicz
LGTM with nits https://codereview.chromium.org/12881003/diff/94001/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac_unittest.mm File chrome/browser/ui/cocoa/omnibox/omnibox_view_mac_unittest.mm (right): https://codereview.chromium.org/12881003/diff/94001/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac_unittest.mm#newcode15 chrome/browser/ui/cocoa/omnibox/omnibox_view_mac_unittest.mm:15: #include "ui/gfx/image/image.h" Do you need this ...
7 years, 8 months ago (2013-04-04 18:34:40 UTC) #28
Robert Sesek
https://codereview.chromium.org/12881003/diff/94001/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc File chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc (right): https://codereview.chromium.org/12881003/diff/94001/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc#newcode94 chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc:94: GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(*icon->ToSkBitmap()); icon->ToGdkPixbuf. https://codereview.chromium.org/12881003/diff/94001/chrome/browser/ui/views/create_application_shortcut_view.cc File chrome/browser/ui/views/create_application_shortcut_view.cc (right): ...
7 years, 8 months ago (2013-04-04 18:39:01 UTC) #29
benwells
https://codereview.chromium.org/12881003/diff/90001/chrome/browser/ui/views/create_application_shortcut_view.cc File chrome/browser/ui/views/create_application_shortcut_view.cc (right): https://codereview.chromium.org/12881003/diff/90001/chrome/browser/ui/views/create_application_shortcut_view.cc#newcode445 chrome/browser/ui/views/create_application_shortcut_view.cc:445: const gfx::Image* icon = shortcut_info_.favicon.Get(0, 0); On 2013/04/04 05:15:36, ...
7 years, 8 months ago (2013-04-04 23:52:35 UTC) #30
Matt Giuca
On 2013/04/04 23:52:35, benwells wrote: > Ah, I see. Perhaps Get is unintuitive then. I ...
7 years, 8 months ago (2013-04-05 06:29:54 UTC) #31
Matt Giuca
https://codereview.chromium.org/12881003/diff/94001/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac_unittest.mm File chrome/browser/ui/cocoa/omnibox/omnibox_view_mac_unittest.mm (right): https://codereview.chromium.org/12881003/diff/94001/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac_unittest.mm#newcode15 chrome/browser/ui/cocoa/omnibox/omnibox_view_mac_unittest.mm:15: #include "ui/gfx/image/image.h" On 2013/04/04 18:34:40, pkotwicz wrote: > Do ...
7 years, 8 months ago (2013-04-05 06:30:12 UTC) #32
benwells
lgtm
7 years, 8 months ago (2013-04-05 06:38:03 UTC) #33
Matt Giuca
Adding sky for OWNERS.
7 years, 8 months ago (2013-04-06 11:49:58 UTC) #34
Matt Giuca
I had a bug in the Mac version which I've fixed in PS 22. Please ...
7 years, 8 months ago (2013-04-08 09:13:36 UTC) #35
Robert Sesek
https://codereview.chromium.org/12881003/diff/158001/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc File chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc (right): https://codereview.chromium.org/12881003/diff/158001/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc#newcode92 chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc:92: CHECK(!icon->IsEmpty()); Can remove this CHECK, since ToGdkPixbuf will do ...
7 years, 8 months ago (2013-04-08 13:16:39 UTC) #36
Matt Giuca
https://codereview.chromium.org/12881003/diff/158001/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc File chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc (right): https://codereview.chromium.org/12881003/diff/158001/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc#newcode92 chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc:92: CHECK(!icon->IsEmpty()); On 2013/04/08 13:16:39, rsesek wrote: > Can remove ...
7 years, 8 months ago (2013-04-09 00:00:45 UTC) #37
Matt Giuca
Robert and Scott: Friendly ping.
7 years, 8 months ago (2013-04-10 00:17:53 UTC) #38
sky
What files do you need me to review?
7 years, 8 months ago (2013-04-10 00:44:08 UTC) #39
Matt Giuca
On 2013/04/10 00:44:08, sky wrote: > What files do you need me to review? Unfortunately, ...
7 years, 8 months ago (2013-04-10 01:07:58 UTC) #40
Robert Sesek
LGTM https://codereview.chromium.org/12881003/diff/192001/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc File chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc (right): https://codereview.chromium.org/12881003/diff/192001/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc#newcode92 chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc:92: GdkPixbuf* pixbuf = icon->ToGdkPixbuf(); Actually, since you're keeping ...
7 years, 8 months ago (2013-04-10 13:20:17 UTC) #41
sky
LGTM
7 years, 8 months ago (2013-04-10 14:29:02 UTC) #42
Matt Giuca
https://codereview.chromium.org/12881003/diff/192001/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc File chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc (right): https://codereview.chromium.org/12881003/diff/192001/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc#newcode92 chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc:92: GdkPixbuf* pixbuf = icon->ToGdkPixbuf(); On 2013/04/10 13:20:17, rsesek wrote: ...
7 years, 8 months ago (2013-04-11 00:55:22 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mgiuca@chromium.org/12881003/205001
7 years, 8 months ago (2013-04-11 01:03:05 UTC) #44
commit-bot: I haz the power
7 years, 8 months ago (2013-04-11 03:33:03 UTC) #45
Message was sent while issue was closed.
Change committed as 193558

Powered by Google App Engine
This is Rietveld 408576698