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

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

Issue 2375033002: cocoa browser: remove non-MD location bar support (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
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 87
88 void ZoomDecoration::HideUI() { 88 void ZoomDecoration::HideUI() {
89 [bubble_ close]; 89 [bubble_ close];
90 SetVisible(false); 90 SetVisible(false);
91 } 91 }
92 92
93 void ZoomDecoration::ShowAndUpdateUI(zoom::ZoomController* zoom_controller, 93 void ZoomDecoration::ShowAndUpdateUI(zoom::ZoomController* zoom_controller,
94 NSString* tooltip_string, 94 NSString* tooltip_string,
95 bool location_bar_is_dark) { 95 bool location_bar_is_dark) {
96 if (ui::MaterialDesignController::IsModeMaterial()) { 96 vector_icon_id_ = gfx::VectorIconId::VECTOR_ICON_NONE;
97 vector_icon_id_ = gfx::VectorIconId::VECTOR_ICON_NONE; 97 zoom::ZoomController::RelativeZoom relative_zoom =
98 zoom::ZoomController::RelativeZoom relative_zoom = 98 zoom_controller->GetZoomRelativeToDefault();
99 zoom_controller->GetZoomRelativeToDefault(); 99 if (relative_zoom == zoom::ZoomController::ZOOM_BELOW_DEFAULT_ZOOM) {
100 if (relative_zoom == zoom::ZoomController::ZOOM_BELOW_DEFAULT_ZOOM) { 100 vector_icon_id_ = gfx::VectorIconId::ZOOM_MINUS;
101 vector_icon_id_ = gfx::VectorIconId::ZOOM_MINUS; 101 } else if (relative_zoom == zoom::ZoomController::ZOOM_ABOVE_DEFAULT_ZOOM) {
102 } else if (relative_zoom == zoom::ZoomController::ZOOM_ABOVE_DEFAULT_ZOOM) { 102 vector_icon_id_ = gfx::VectorIconId::ZOOM_PLUS;
103 vector_icon_id_ = gfx::VectorIconId::ZOOM_PLUS; 103 }
104 }
105 104
106 SetImage(GetMaterialIcon(location_bar_is_dark)); 105 SetImage(GetMaterialIcon(location_bar_is_dark));
107 } else {
108 int image_id = IDR_ZOOM_NORMAL;
109 zoom::ZoomController::RelativeZoom relative_zoom =
110 zoom_controller->GetZoomRelativeToDefault();
111 if (relative_zoom == zoom::ZoomController::ZOOM_BELOW_DEFAULT_ZOOM)
112 image_id = IDR_ZOOM_MINUS;
113 else if (relative_zoom == zoom::ZoomController::ZOOM_ABOVE_DEFAULT_ZOOM)
114 image_id = IDR_ZOOM_PLUS;
115
116 SetImage(OmniboxViewMac::ImageForResource(image_id));
117 }
118 106
119 tooltip_.reset([tooltip_string retain]); 107 tooltip_.reset([tooltip_string retain]);
120 108
121 SetVisible(true); 109 SetVisible(true);
122 [bubble_ onZoomChanged]; 110 [bubble_ onZoomChanged];
123 } 111 }
124 112
125 NSPoint ZoomDecoration::GetBubblePointInFrame(NSRect frame) { 113 NSPoint ZoomDecoration::GetBubblePointInFrame(NSRect frame) {
126 return NSMakePoint(NSMaxX(frame), NSMaxY(frame)); 114 return NSMakePoint(NSMaxX(frame), NSMaxY(frame));
127 } 115 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // closed the decoration can be hidden. 159 // closed the decoration can be hidden.
172 if (IsAtDefaultZoom() && IsVisible()) { 160 if (IsAtDefaultZoom() && IsVisible()) {
173 SetVisible(false); 161 SetVisible(false);
174 owner_->OnDecorationsChanged(); 162 owner_->OnDecorationsChanged();
175 } 163 }
176 } 164 }
177 165
178 gfx::VectorIconId ZoomDecoration::GetMaterialVectorIconId() const { 166 gfx::VectorIconId ZoomDecoration::GetMaterialVectorIconId() const {
179 return vector_icon_id_; 167 return vector_icon_id_;
180 } 168 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698