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

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

Issue 2628703002: [Mac] Hide Zoom Decoration for Default Zoom (Closed)
Patch Set: Fixed tests Created 3 years, 11 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 58adbacc169be7d80bf28dcc4bdcf4483d793ef1..8f1f9211d3241edb10469621743556014249a6dc 100644
--- a/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm
@@ -18,7 +18,6 @@
#include "components/zoom/zoom_controller.h"
#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"
ZoomDecoration::ZoomDecoration(LocationBarViewMac* owner)
: owner_(owner),
@@ -41,21 +40,21 @@ bool ZoomDecoration::UpdateIfNecessary(zoom::ZoomController* zoom_controller,
return true;
}
+ SetVisible(ShouldShowDecoration() && !zoom_controller->IsAtDefaultZoom());
+
base::string16 zoom_percent =
base::FormatPercent(zoom_controller->GetZoomPercent());
- // In Material Design there is no icon at the default zoom factor (100%), so
- // don't display a tooltip either.
+ // There is no icon at the default zoom factor (100%), so don't display a
+ // tooltip either.
NSString* tooltip_string =
zoom_controller->IsAtDefaultZoom()
? @""
: l10n_util::GetNSStringF(IDS_TOOLTIP_ZOOM, zoom_percent);
- if (IsVisible() && [tooltip_ isEqualToString:tooltip_string] &&
- !default_zoom_changed) {
+ if ([tooltip_ isEqualToString:tooltip_string] && !default_zoom_changed)
return false;
- }
- ShowAndUpdateUI(zoom_controller, tooltip_string, location_bar_is_dark);
+ UpdateUI(zoom_controller, tooltip_string, location_bar_is_dark);
return true;
}
@@ -95,13 +94,13 @@ void ZoomDecoration::HideUI() {
SetVisible(false);
}
-void ZoomDecoration::ShowAndUpdateUI(zoom::ZoomController* zoom_controller,
- NSString* tooltip_string,
- bool location_bar_is_dark) {
+void ZoomDecoration::UpdateUI(zoom::ZoomController* zoom_controller,
+ NSString* tooltip_string,
+ bool location_bar_is_dark) {
vector_icon_id_ = gfx::VectorIconId::VECTOR_ICON_NONE;
zoom::ZoomController::RelativeZoom relative_zoom =
zoom_controller->GetZoomRelativeToDefault();
- // In Material Design there is no icon at the default zoom factor.
+ // There is no icon at the default zoom factor.
if (relative_zoom == zoom::ZoomController::ZOOM_BELOW_DEFAULT_ZOOM) {
vector_icon_id_ = gfx::VectorIconId::ZOOM_MINUS;
} else if (relative_zoom == zoom::ZoomController::ZOOM_ABOVE_DEFAULT_ZOOM) {
@@ -112,7 +111,6 @@ void ZoomDecoration::ShowAndUpdateUI(zoom::ZoomController* zoom_controller,
tooltip_.reset([tooltip_string retain]);
- SetVisible(true);
[bubble_ onZoomChanged];
}

Powered by Google App Engine
This is Rietveld 408576698