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

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

Issue 2415453004: [Mac] Don't show tooltip when zoom decoration is hidden. (Closed)
Patch Set: More fixes. Created 4 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/zoom_decoration_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 992baaeb3cd70d22d8c2218d850c2d6cd9ad396a..78af75adc58a6c73e09dd01ed134131809f5a5a6 100644
--- a/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm
@@ -42,15 +42,19 @@ bool ZoomDecoration::UpdateIfNecessary(zoom::ZoomController* zoom_controller,
base::string16 zoom_percent =
base::FormatPercent(zoom_controller->GetZoomPercent());
- NSString* zoom_string =
- l10n_util::GetNSStringF(IDS_TOOLTIP_ZOOM, zoom_percent);
-
- if (IsVisible() && [tooltip_ isEqualToString:zoom_string] &&
+ // In Material Design 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) {
return false;
}
- ShowAndUpdateUI(zoom_controller, zoom_string, location_bar_is_dark);
+ ShowAndUpdateUI(zoom_controller, tooltip_string, location_bar_is_dark);
return true;
}
@@ -96,6 +100,7 @@ void ZoomDecoration::ShowAndUpdateUI(zoom::ZoomController* zoom_controller,
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.
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) {
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/zoom_decoration_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698