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

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

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