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

Side by Side Diff: chrome/browser/cocoa/location_bar/page_action_decoration.mm

Issue 3047031: [Mac] Give page actions a default image when preview enabled. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: comment about icons updating. Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/cocoa/location_bar/page_action_decoration.h" 5 #import "chrome/browser/cocoa/location_bar/page_action_decoration.h"
6 6
7 #include "base/sys_string_conversions.h" 7 #include "base/sys_string_conversions.h"
8 #import "chrome/browser/cocoa/extensions/extension_action_context_menu.h" 8 #import "chrome/browser/cocoa/extensions/extension_action_context_menu.h"
9 #import "chrome/browser/cocoa/extensions/extension_popup_controller.h" 9 #import "chrome/browser/cocoa/extensions/extension_popup_controller.h"
10 #import "chrome/browser/cocoa/location_bar/location_bar_view_mac.h" 10 #import "chrome/browser/cocoa/location_bar/location_bar_view_mac.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 else 134 else
135 icon_path = page_action_->default_icon_path(); 135 icon_path = page_action_->default_icon_path();
136 136
137 if (!icon_path.empty()) { 137 if (!icon_path.empty()) {
138 PageActionMap::iterator iter = page_action_icons_.find(icon_path); 138 PageActionMap::iterator iter = page_action_icons_.find(icon_path);
139 if (iter != page_action_icons_.end()) 139 if (iter != page_action_icons_.end())
140 skia_icon = iter->second; 140 skia_icon = iter->second;
141 } 141 }
142 } 142 }
143 143
144 if (!skia_icon.isNull()) 144 if (!skia_icon.isNull()) {
145 SetImage(gfx::SkBitmapToNSImage(skia_icon)); 145 SetImage(gfx::SkBitmapToNSImage(skia_icon));
146 } else if (!GetImage()) {
147 // During install the action can be displayed before the icons
148 // have come in. Rather than deal with this in multiple places,
149 // provide a placeholder image. This will be replaced when an
150 // icon comes in.
151 const NSSize default_size = NSMakeSize(Extension::kPageActionIconMaxSize,
152 Extension::kPageActionIconMaxSize);
153 SetImage([[NSImage alloc] initWithSize:default_size]);
154 }
146 } 155 }
147 if (IsVisible() != visible) { 156 if (IsVisible() != visible) {
148 SetVisible(visible); 157 SetVisible(visible);
149 NotificationService::current()->Notify( 158 NotificationService::current()->Notify(
150 NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, 159 NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED,
151 Source<ExtensionAction>(page_action_), 160 Source<ExtensionAction>(page_action_),
152 Details<TabContents>(contents)); 161 Details<TabContents>(contents));
153 } 162 }
154 } 163 }
155 164
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 if (popup && ![popup isClosing]) 206 if (popup && ![popup isClosing])
198 [popup close]; 207 [popup close];
199 208
200 break; 209 break;
201 } 210 }
202 default: 211 default:
203 NOTREACHED() << "Unexpected notification"; 212 NOTREACHED() << "Unexpected notification";
204 break; 213 break;
205 } 214 }
206 } 215 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698