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

Unified Diff: chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm

Issue 1821823004: [Mac][Material Design] Update Omnibox dropdown on Mac to MD (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up for review. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm b/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm
index 8b5b27be631f9f5502c140957b970087e715fc73..7cdd8c5a74c3595fb67853d9c4a471350aefa620 100644
--- a/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm
@@ -98,23 +98,26 @@ void ZoomDecoration::ShowAndUpdateUI(ui_zoom::ZoomController* zoom_controller,
NSString* tooltip_string,
bool location_bar_is_dark) {
if (ui::MaterialDesignController::IsModeMaterial()) {
- gfx::VectorIconId iconId = gfx::VectorIconId::VECTOR_ICON_NONE;
+ gfx::VectorIconId icon_id = gfx::VectorIconId::VECTOR_ICON_NONE;
ui_zoom::ZoomController::RelativeZoom relative_zoom =
zoom_controller->GetZoomRelativeToDefault();
if (relative_zoom == ui_zoom::ZoomController::ZOOM_BELOW_DEFAULT_ZOOM) {
- iconId = gfx::VectorIconId::ZOOM_MINUS;
+ icon_id = gfx::VectorIconId::ZOOM_MINUS;
} else if (relative_zoom ==
ui_zoom::ZoomController::ZOOM_ABOVE_DEFAULT_ZOOM) {
- iconId = gfx::VectorIconId::ZOOM_PLUS;
+ icon_id = gfx::VectorIconId::ZOOM_PLUS;
}
- NSImage* theImage = nil;
- if (iconId != gfx::VectorIconId::VECTOR_ICON_NONE) {
- SkColor vectorIconColor = location_bar_is_dark ? SK_ColorWHITE
- : gfx::kChromeIconGrey;
- theImage = NSImageFromImageSkia(gfx::CreateVectorIcon(iconId,
- 16,
- vectorIconColor));
+ NSImage* the_image = nil;
+ const int kIconSize = 16;
+ if (icon_id != gfx::VectorIconId::VECTOR_ICON_NONE) {
+ SkColor vector_icon_color =
+ location_bar_is_dark ? SkColorSetA(SK_ColorWHITE, 0xCC)
+ : gfx::kChromeIconGrey;
+ the_image =
+ NSImageFromImageSkia(gfx::CreateVectorIcon(icon_id,
+ kIconSize,
+ vector_icon_color));
} else {
// Under Material Design there is no icon for ZOOM_NORMAL. This means
// it should be OK to set a nil image. However if the user is actively
@@ -124,10 +127,11 @@ void ZoomDecoration::ShowAndUpdateUI(ui_zoom::ZoomController* zoom_controller,
// position the bubble, but when the decoration's image is nil it has
// no frame. The result is the bubble positioned incorrectly. So, we have
// to set an empty image.
- theImage =
- [[[NSImage alloc] initWithSize:NSMakeSize(16, 16)] autorelease];
+ NSSize icon_size = NSMakeSize(kIconSize, kIconSize);
+ the_image =
+ [[[NSImage alloc] initWithSize:icon_size] autorelease];
tapted 2016/04/28 14:29:44 this might fit on the line above now
shrike 2016/04/28 21:05:35 Almost - the semi-colon end up being over the limi
}
- SetImage(theImage);
+ SetImage(the_image);
} else {
int image_id = IDR_ZOOM_NORMAL;
ui_zoom::ZoomController::RelativeZoom relative_zoom =

Powered by Google App Engine
This is Rietveld 408576698