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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm

Issue 2688603003: [Mac] Fix for zoom decoration regression (Closed)
Patch Set: Created 3 years, 10 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 21 matching lines...) Expand all
32 bool default_zoom_changed, 32 bool default_zoom_changed,
33 bool location_bar_is_dark) { 33 bool location_bar_is_dark) {
34 if (!ShouldShowDecoration()) { 34 if (!ShouldShowDecoration()) {
35 if (!IsVisible() && !bubble_) 35 if (!IsVisible() && !bubble_)
36 return false; 36 return false;
37 37
38 HideUI(); 38 HideUI();
39 return true; 39 return true;
40 } 40 }
41 41
42 BOOL old_visibility = IsVisible();
42 SetVisible(ShouldShowDecoration() && !zoom_controller->IsAtDefaultZoom()); 43 SetVisible(ShouldShowDecoration() && !zoom_controller->IsAtDefaultZoom());
43 44
44 base::string16 zoom_percent = 45 base::string16 zoom_percent =
45 base::FormatPercent(zoom_controller->GetZoomPercent()); 46 base::FormatPercent(zoom_controller->GetZoomPercent());
46 // There is no icon at the default zoom factor (100%), so don't display a 47 // There is no icon at the default zoom factor (100%), so don't display a
47 // tooltip either. 48 // tooltip either.
48 NSString* tooltip_string = 49 NSString* tooltip_string =
49 zoom_controller->IsAtDefaultZoom() 50 zoom_controller->IsAtDefaultZoom()
50 ? @"" 51 ? @""
51 : l10n_util::GetNSStringF(IDS_TOOLTIP_ZOOM, zoom_percent); 52 : l10n_util::GetNSStringF(IDS_TOOLTIP_ZOOM, zoom_percent);
52 53
53 if ([tooltip_ isEqualToString:tooltip_string] && !default_zoom_changed) 54 if ([tooltip_ isEqualToString:tooltip_string] && !default_zoom_changed &&
55 old_visibility == IsVisible()) {
54 return false; 56 return false;
57 }
55 58
56 UpdateUI(zoom_controller, tooltip_string, location_bar_is_dark); 59 UpdateUI(zoom_controller, tooltip_string, location_bar_is_dark);
57 return true; 60 return true;
58 } 61 }
59 62
60 void ZoomDecoration::ShowBubble(BOOL auto_close) { 63 void ZoomDecoration::ShowBubble(BOOL auto_close) {
61 if (bubble_) { 64 if (bubble_) {
62 bubble_.delegate = nil; 65 bubble_.delegate = nil;
63 [[bubble_.window parentWindow] removeChildWindow:bubble_.window]; 66 [[bubble_.window parentWindow] removeChildWindow:bubble_.window];
64 [bubble_.window orderOut:nil]; 67 [bubble_.window orderOut:nil];
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // closed the decoration can be hidden. 168 // closed the decoration can be hidden.
166 if (IsAtDefaultZoom() && IsVisible()) { 169 if (IsAtDefaultZoom() && IsVisible()) {
167 SetVisible(false); 170 SetVisible(false);
168 owner_->OnDecorationsChanged(); 171 owner_->OnDecorationsChanged();
169 } 172 }
170 } 173 }
171 174
172 const gfx::VectorIcon* ZoomDecoration::GetMaterialVectorIcon() const { 175 const gfx::VectorIcon* ZoomDecoration::GetMaterialVectorIcon() const {
173 return vector_icon_; 176 return vector_icon_;
174 } 177 }
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