From 54a3726af604436641e90cd60a7ccba25d161d5a Mon Sep 17 00:00:00 2001 From: "shess@chromium.org" Date: Fri, 30 Jul 2010 21:37:44 +0000 Subject: [Mac] Give page actions a default image when preview enabled. During install it is possible to display (or layout) the action before the images have come in. Provide a default image for this case. BUG=50771 TEST=See bug. Review URL: http://codereview.chromium.org/3047031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54386 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/cocoa/location_bar/page_action_decoration.mm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'chrome/browser') diff --git a/chrome/browser/cocoa/location_bar/page_action_decoration.mm b/chrome/browser/cocoa/location_bar/page_action_decoration.mm index 1813bb8..31e1c23 100644 --- a/chrome/browser/cocoa/location_bar/page_action_decoration.mm +++ b/chrome/browser/cocoa/location_bar/page_action_decoration.mm @@ -141,8 +141,17 @@ void PageActionDecoration::UpdateVisibility( } } - if (!skia_icon.isNull()) + if (!skia_icon.isNull()) { SetImage(gfx::SkBitmapToNSImage(skia_icon)); + } else if (!GetImage()) { + // During install the action can be displayed before the icons + // have come in. Rather than deal with this in multiple places, + // provide a placeholder image. This will be replaced when an + // icon comes in. + const NSSize default_size = NSMakeSize(Extension::kPageActionIconMaxSize, + Extension::kPageActionIconMaxSize); + SetImage([[NSImage alloc] initWithSize:default_size]); + } } if (IsVisible() != visible) { SetVisible(visible); -- cgit v1.1