summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/location_bar
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-30 21:37:44 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-30 21:37:44 +0000
commit54a3726af604436641e90cd60a7ccba25d161d5a (patch)
tree17261612a180584f3a38068ce8917c5f6b35ef1e /chrome/browser/cocoa/location_bar
parent937df951109b543a70e5474ee12f20df7b52a8d5 (diff)
downloadchromium_src-54a3726af604436641e90cd60a7ccba25d161d5a.zip
chromium_src-54a3726af604436641e90cd60a7ccba25d161d5a.tar.gz
chromium_src-54a3726af604436641e90cd60a7ccba25d161d5a.tar.bz2
[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
Diffstat (limited to 'chrome/browser/cocoa/location_bar')
-rw-r--r--chrome/browser/cocoa/location_bar/page_action_decoration.mm11
1 files changed, 10 insertions, 1 deletions
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);