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

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: Address feedback. 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..d80fb9891f96dae9b5129f2625653e5b4f9a5d6a 100644
--- a/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm
@@ -17,14 +17,11 @@
#include "ui/base/cocoa/cocoa_base_utils.h"
#include "ui/base/l10n/l10n_util_mac.h"
#include "ui/base/material_design/material_design_controller.h"
-#include "ui/gfx/color_palette.h"
-#include "ui/gfx/image/image_skia_util_mac.h"
-#include "ui/gfx/paint_vector_icon.h"
-#include "ui/gfx/vector_icons_public.h"
ZoomDecoration::ZoomDecoration(LocationBarViewMac* owner)
: owner_(owner),
- bubble_(nil) {
+ bubble_(nil),
+ vector_icon_id_(gfx::VectorIconId::VECTOR_ICON_NONE) {
}
ZoomDecoration::~ZoomDecoration() {
@@ -98,36 +95,17 @@ 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;
+ vector_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;
+ vector_icon_id_ = gfx::VectorIconId::ZOOM_MINUS;
} else if (relative_zoom ==
ui_zoom::ZoomController::ZOOM_ABOVE_DEFAULT_ZOOM) {
- iconId = gfx::VectorIconId::ZOOM_PLUS;
+ vector_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));
- } 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
- // changing the zoom level and drives it back to 100%, there will be no
- // icon and the zoom bubble will still be visible. ShowBubble() asks the
- // autocomplete textfield for the zoom decoration's frame in order to
- // 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];
- }
- SetImage(theImage);
+ SetImage(GetMaterialIcon(location_bar_is_dark));
} else {
int image_id = IDR_ZOOM_NORMAL;
ui_zoom::ZoomController::RelativeZoom relative_zoom =
@@ -198,3 +176,7 @@ void ZoomDecoration::OnClose() {
owner_->OnDecorationsChanged();
}
}
+
+gfx::VectorIconId ZoomDecoration::GetMaterialVectorIconId() {
+ return vector_icon_id_;
+}

Powered by Google App Engine
This is Rietveld 408576698