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

Side by Side 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: 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 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/cocoa/location_bar/zoom_decoration.h" 5 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h"
6 6
7 #include "base/i18n/number_formatting.h" 7 #include "base/i18n/number_formatting.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 zoom::ZoomController::RelativeZoom relative_zoom = 97 zoom::ZoomController::RelativeZoom relative_zoom =
98 zoom_controller->GetZoomRelativeToDefault(); 98 zoom_controller->GetZoomRelativeToDefault();
99 if (relative_zoom == zoom::ZoomController::ZOOM_BELOW_DEFAULT_ZOOM) { 99 if (relative_zoom == zoom::ZoomController::ZOOM_BELOW_DEFAULT_ZOOM) {
100 vector_icon_id_ = gfx::VectorIconId::ZOOM_MINUS; 100 vector_icon_id_ = gfx::VectorIconId::ZOOM_MINUS;
101 } else if (relative_zoom == zoom::ZoomController::ZOOM_ABOVE_DEFAULT_ZOOM) { 101 } else if (relative_zoom == zoom::ZoomController::ZOOM_ABOVE_DEFAULT_ZOOM) {
102 vector_icon_id_ = gfx::VectorIconId::ZOOM_PLUS; 102 vector_icon_id_ = gfx::VectorIconId::ZOOM_PLUS;
103 } 103 }
104 104
105 SetImage(GetMaterialIcon(location_bar_is_dark)); 105 SetImage(GetMaterialIcon(location_bar_is_dark));
106 106
107 tooltip_.reset([tooltip_string retain]); 107 tooltip_.reset(vector_icon_id_ == gfx::VectorIconId::VECTOR_ICON_NONE
Avi (use Gerrit) 2016/10/12 19:40:10 It's equivalent, but it feels better to do: toolt
shrike 2016/10/12 20:43:36 I like checking the icon id because it's explicit
108 ? @""
109 : [tooltip_string retain]);
108 110
109 SetVisible(true); 111 SetVisible(true);
110 [bubble_ onZoomChanged]; 112 [bubble_ onZoomChanged];
111 } 113 }
112 114
113 NSPoint ZoomDecoration::GetBubblePointInFrame(NSRect frame) { 115 NSPoint ZoomDecoration::GetBubblePointInFrame(NSRect frame) {
114 return NSMakePoint(NSMaxX(frame), NSMaxY(frame)); 116 return NSMakePoint(NSMaxX(frame), NSMaxY(frame));
115 } 117 }
116 118
117 bool ZoomDecoration::IsAtDefaultZoom() const { 119 bool ZoomDecoration::IsAtDefaultZoom() const {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // closed the decoration can be hidden. 161 // closed the decoration can be hidden.
160 if (IsAtDefaultZoom() && IsVisible()) { 162 if (IsAtDefaultZoom() && IsVisible()) {
161 SetVisible(false); 163 SetVisible(false);
162 owner_->OnDecorationsChanged(); 164 owner_->OnDecorationsChanged();
163 } 165 }
164 } 166 }
165 167
166 gfx::VectorIconId ZoomDecoration::GetMaterialVectorIconId() const { 168 gfx::VectorIconId ZoomDecoration::GetMaterialVectorIconId() const {
167 return vector_icon_id_; 169 return vector_icon_id_;
168 } 170 }
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