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

Side by Side Diff: chrome/browser/android/vr_shell/textures/url_bar_texture.cc

Issue 2946523002: VR: Support security chip text on URL bar. (Closed)
Patch Set: Created 3 years, 6 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #include "chrome/browser/android/vr_shell/textures/url_bar_texture.h" 5 #include "chrome/browser/android/vr_shell/textures/url_bar_texture.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "cc/paint/skia_paint_canvas.h" 9 #include "cc/paint/skia_paint_canvas.h"
10 #include "chrome/browser/android/vr_shell/color_scheme.h" 10 #include "chrome/browser/android/vr_shell/color_scheme.h"
11 #include "chrome/browser/android/vr_shell/textures/render_text_wrapper.h" 11 #include "chrome/browser/android/vr_shell/textures/render_text_wrapper.h"
12 #include "components/strings/grit/components_strings.h"
12 #include "components/toolbar/vector_icons.h" 13 #include "components/toolbar/vector_icons.h"
13 #include "components/url_formatter/url_formatter.h" 14 #include "components/url_formatter/url_formatter.h"
15 #include "ui/base/l10n/l10n_util.h"
14 #include "ui/gfx/canvas.h" 16 #include "ui/gfx/canvas.h"
15 #include "ui/gfx/font.h" 17 #include "ui/gfx/font.h"
16 #include "ui/gfx/font_list.h" 18 #include "ui/gfx/font_list.h"
17 #include "ui/gfx/geometry/point_f.h" 19 #include "ui/gfx/geometry/point_f.h"
18 #include "ui/gfx/geometry/rect.h" 20 #include "ui/gfx/geometry/rect.h"
19 #include "ui/gfx/geometry/rect_f.h"
20 #include "ui/gfx/paint_vector_icon.h" 21 #include "ui/gfx/paint_vector_icon.h"
21 #include "ui/gfx/render_text.h" 22 #include "ui/gfx/render_text.h"
22 #include "ui/gfx/vector_icon_types.h" 23 #include "ui/gfx/vector_icon_types.h"
23 #include "ui/vector_icons/vector_icons.h" 24 #include "ui/vector_icons/vector_icons.h"
24 25
25 namespace vr_shell { 26 namespace vr_shell {
26 27
27 namespace { 28 namespace {
28 29
29 static constexpr float kWidth = 0.672; 30 static constexpr float kWidth = 0.672;
30 static constexpr float kHeight = 0.088; 31 static constexpr float kHeight = 0.088;
31 static constexpr float kFontHeight = 0.027; 32 static constexpr float kFontHeight = 0.027;
32 static constexpr float kBackButtonWidth = kHeight; 33 static constexpr float kBackButtonWidth = kHeight;
33 static constexpr float kBackIconHeight = 0.0375; 34 static constexpr float kBackIconHeight = 0.0375;
34 static constexpr float kBackIconOffset = 0.005; 35 static constexpr float kBackIconOffset = 0.005;
35 static constexpr float kSecurityFieldWidth = 0.06; 36 static constexpr float kFieldSpacing = 0.014;
36 static constexpr float kSecurityIconHeight = 0.03; 37 static constexpr float kSecurityIconHeight = 0.03;
37 static constexpr float kUrlRightMargin = 0.02; 38 static constexpr float kUrlRightMargin = 0.02;
38 static constexpr float kSeparatorWidth = 0.002; 39 static constexpr float kSeparatorWidth = 0.002;
40 static constexpr float kChipTextLineMargin = kHeight * 0.3;
39 41
40 using security_state::SecurityLevel; 42 using security_state::SecurityLevel;
41 43
42 // See ToolbarModelImpl::GetVectorIcon(). 44 // See ToolbarModelImpl::GetVectorIcon().
43 const struct gfx::VectorIcon& getSecurityIcon(SecurityLevel level) { 45 const struct gfx::VectorIcon& GetSecurityIcon(SecurityLevel level) {
44 switch (level) { 46 switch (level) {
45 case security_state::NONE: 47 case security_state::NONE:
46 case security_state::HTTP_SHOW_WARNING: 48 case security_state::HTTP_SHOW_WARNING:
47 return toolbar::kHttpIcon; 49 return toolbar::kHttpIcon;
48 case security_state::EV_SECURE: 50 case security_state::EV_SECURE:
49 case security_state::SECURE: 51 case security_state::SECURE:
50 return toolbar::kHttpsValidIcon; 52 return toolbar::kHttpsValidIcon;
51 case security_state::SECURITY_WARNING: 53 case security_state::SECURITY_WARNING:
52 // Surface Dubious as Neutral. 54 // Surface Dubious as Neutral.
53 return toolbar::kHttpIcon; 55 return toolbar::kHttpIcon;
54 case security_state::SECURE_WITH_POLICY_INSTALLED_CERT: // ChromeOS only. 56 case security_state::SECURE_WITH_POLICY_INSTALLED_CERT: // ChromeOS only.
55 return ui::kBusinessIcon; 57 return ui::kBusinessIcon;
56 case security_state::DANGEROUS: 58 case security_state::DANGEROUS:
57 return toolbar::kHttpsInvalidIcon; 59 return toolbar::kHttpsInvalidIcon;
58 default: 60 default:
59 NOTREACHED(); 61 NOTREACHED();
60 return toolbar::kHttpsInvalidIcon; 62 return toolbar::kHttpsInvalidIcon;
61 } 63 }
62 } 64 }
63 65
64 // See LocationBarView::GetSecureTextColor(). 66 // See LocationBarView::GetSecureTextColor().
65 SkColor getSchemeColor(SecurityLevel level, const ColorScheme& color_scheme) { 67 SkColor GetSchemeColor(SecurityLevel level, const ColorScheme& color_scheme) {
66 switch (level) { 68 switch (level) {
67 case SecurityLevel::NONE: 69 case SecurityLevel::NONE:
68 case SecurityLevel::HTTP_SHOW_WARNING: 70 case SecurityLevel::HTTP_SHOW_WARNING:
69 return color_scheme.url_deemphasized; 71 return color_scheme.url_deemphasized;
70 case SecurityLevel::EV_SECURE: 72 case SecurityLevel::EV_SECURE:
71 case SecurityLevel::SECURE: 73 case SecurityLevel::SECURE:
72 return color_scheme.secure; 74 return color_scheme.secure;
73 case SecurityLevel::SECURITY_WARNING: 75 case SecurityLevel::SECURITY_WARNING:
74 return color_scheme.url_deemphasized; 76 return color_scheme.url_deemphasized;
75 case SecurityLevel::SECURE_WITH_POLICY_INSTALLED_CERT: // ChromeOS only. 77 case SecurityLevel::SECURE_WITH_POLICY_INSTALLED_CERT: // ChromeOS only.
76 return color_scheme.insecure; 78 return color_scheme.insecure;
77 case SecurityLevel::DANGEROUS: 79 case SecurityLevel::DANGEROUS:
78 return color_scheme.insecure; 80 return color_scheme.insecure;
79 default: 81 default:
80 NOTREACHED(); 82 NOTREACHED();
81 return color_scheme.insecure; 83 return color_scheme.insecure;
82 } 84 }
83 } 85 }
84 86
87 // See ToolbarModelImpl::GetSecureVerboseText().
88 int GetSecurityTextId(SecurityLevel level, bool malware) {
89 switch (level) {
90 case security_state::HTTP_SHOW_WARNING:
91 return IDS_NOT_SECURE_VERBOSE_STATE;
92 case security_state::SECURE:
93 return IDS_SECURE_VERBOSE_STATE;
94 case security_state::DANGEROUS:
95 return (malware ? IDS_DANGEROUS_VERBOSE_STATE
96 : IDS_NOT_SECURE_VERBOSE_STATE);
97 default:
98 return 0;
99 }
100 }
101
85 void setEmphasis(vr_shell::RenderTextWrapper* render_text, 102 void setEmphasis(vr_shell::RenderTextWrapper* render_text,
86 bool emphasis, 103 bool emphasis,
87 const gfx::Range& range, 104 const gfx::Range& range,
88 const ColorScheme& color_scheme) { 105 const ColorScheme& color_scheme) {
89 SkColor color = 106 SkColor color =
90 emphasis ? color_scheme.url_emphasized : color_scheme.url_deemphasized; 107 emphasis ? color_scheme.url_emphasized : color_scheme.url_deemphasized;
91 if (range.IsValid()) { 108 if (range.IsValid()) {
92 render_text->ApplyColor(color, range); 109 render_text->ApplyColor(color, range);
93 } else { 110 } else {
94 render_text->SetColor(color); 111 render_text->SetColor(color);
(...skipping 20 matching lines...) Expand all
115 set_dirty(); 132 set_dirty();
116 gurl_ = gurl; 133 gurl_ = gurl;
117 } 134 }
118 135
119 void UrlBarTexture::SetHistoryButtonsEnabled(bool can_go_back) { 136 void UrlBarTexture::SetHistoryButtonsEnabled(bool can_go_back) {
120 if (can_go_back != can_go_back_) 137 if (can_go_back != can_go_back_)
121 set_dirty(); 138 set_dirty();
122 can_go_back_ = can_go_back; 139 can_go_back_ = can_go_back;
123 } 140 }
124 141
125 void UrlBarTexture::SetSecurityLevel(SecurityLevel level) { 142 void UrlBarTexture::SetSecurityInfo(SecurityLevel level, bool malware) {
126 if (security_level_ != level) 143 if (security_level_ != level || malware_ != malware)
127 set_dirty(); 144 set_dirty();
128 security_level_ = level; 145 security_level_ = level;
146 malware_ = malware;
129 } 147 }
130 148
131 float UrlBarTexture::ToPixels(float meters) const { 149 float UrlBarTexture::ToPixels(float meters) const {
132 return meters * size_.width() / kWidth; 150 return meters * size_.width() / kWidth;
133 } 151 }
134 152
153 float UrlBarTexture::ToMeters(float pixels) const {
154 return pixels * kWidth / size_.width();
155 }
156
135 bool UrlBarTexture::HitsBackButton(const gfx::PointF& position) const { 157 bool UrlBarTexture::HitsBackButton(const gfx::PointF& position) const {
136 const gfx::PointF& meters = percentToMeters(position); 158 const gfx::PointF& meters = percentToMeters(position);
137 gfx::RectF rect(gfx::PointF(0, 0), gfx::SizeF(kBackButtonWidth, kHeight)); 159 gfx::RectF rect(gfx::PointF(0, 0), gfx::SizeF(kBackButtonWidth, kHeight));
138 return rect.Contains(meters) && !HitsTransparentRegion(meters, true); 160 return rect.Contains(meters) && !HitsTransparentRegion(meters, true);
139 } 161 }
140 162
141 bool UrlBarTexture::HitsUrlBar(const gfx::PointF& position) const { 163 bool UrlBarTexture::HitsUrlBar(const gfx::PointF& position) const {
142 const gfx::PointF& meters = percentToMeters(position); 164 const gfx::PointF& meters = percentToMeters(position);
143 gfx::RectF rect(gfx::PointF(kBackButtonWidth, 0), 165 gfx::RectF rect(gfx::PointF(kBackButtonWidth, 0),
144 gfx::SizeF(kWidth - kBackButtonWidth, kHeight)); 166 gfx::SizeF(kWidth - kBackButtonWidth, kHeight));
145 return rect.Contains(meters) && !HitsTransparentRegion(meters, false); 167 return rect.Contains(meters) && !HitsTransparentRegion(meters, false);
146 } 168 }
147 169
148 gfx::PointF UrlBarTexture::SecurityIconPositionMeters() const { 170 bool UrlBarTexture::HitsSecurityRegion(const gfx::PointF& position) const {
149 float x = has_back_button_ ? kBackButtonWidth + kSeparatorWidth : 0.0f; 171 return security_hit_region_.Contains(percentToMeters(position));
150 x += kSecurityFieldWidth / 2 - kSecurityIconHeight / 2;
151 float y = kHeight / 2 - kSecurityIconHeight / 2;
152 return gfx::PointF(x, y);
153 }
154
155 gfx::PointF UrlBarTexture::UrlBarPositionMeters() const {
156 float x = has_back_button_ ? kBackButtonWidth + kSeparatorWidth : 0.0f;
157 x += kSecurityFieldWidth;
158 return gfx::PointF(x, 0);
159 }
160
161 bool UrlBarTexture::HitsSecurityIcon(const gfx::PointF& position) const {
162 gfx::RectF rect(SecurityIconPositionMeters(),
163 gfx::SizeF(kSecurityIconHeight, kSecurityIconHeight));
164 return rect.Contains(percentToMeters(position));
165 } 172 }
166 173
167 bool UrlBarTexture::HitsTransparentRegion(const gfx::PointF& meters, 174 bool UrlBarTexture::HitsTransparentRegion(const gfx::PointF& meters,
168 bool left) const { 175 bool left) const {
169 const float radius = kHeight / 2.0f; 176 const float radius = kHeight / 2.0f;
170 gfx::PointF circle_center(left ? radius : kWidth - radius, radius); 177 gfx::PointF circle_center(left ? radius : kWidth - radius, radius);
171 if (!left && meters.x() < circle_center.x()) 178 if (!left && meters.x() < circle_center.x())
172 return false; 179 return false;
173 if (left && meters.x() > circle_center.x()) 180 if (left && meters.x() > circle_center.x())
174 return false; 181 return false;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 SkPaint paint; 228 SkPaint paint;
222 paint.setColor(GetLeftCornerColor()); 229 paint.setColor(GetLeftCornerColor());
223 canvas->drawRRect(round_rect, paint); 230 canvas->drawRRect(round_rect, paint);
224 231
225 // URL area. 232 // URL area.
226 paint.setColor(color_scheme().element_background); 233 paint.setColor(color_scheme().element_background);
227 SkVector right_corners[4] = {{0, 0}, rounded_corner, rounded_corner, {0, 0}}; 234 SkVector right_corners[4] = {{0, 0}, rounded_corner, rounded_corner, {0, 0}};
228 round_rect.setRectRadii({kHeight, 0, kWidth, kHeight}, right_corners); 235 round_rect.setRectRadii({kHeight, 0, kWidth, kHeight}, right_corners);
229 canvas->drawRRect(round_rect, paint); 236 canvas->drawRRect(round_rect, paint);
230 237
238 float left_edge = 0;
239 security_hit_region_.SetRect(0, 0, 0, 0);
240
231 if (has_back_button_) { 241 if (has_back_button_) {
232 // Back button / URL separator vertical line. 242 // Back button / URL separator vertical line.
233 paint.setColor(color_scheme().separator); 243 paint.setColor(color_scheme().separator);
234 canvas->drawRect(SkRect::MakeXYWH(kHeight, 0, kSeparatorWidth, kHeight), 244 canvas->drawRect(
235 paint); 245 SkRect::MakeXYWH(kBackButtonWidth, 0, kSeparatorWidth, kHeight), paint);
236 246
237 // Back button icon. 247 // Back button icon.
238 canvas->save(); 248 canvas->save();
239 canvas->translate(kHeight / 2 + kBackIconOffset, kHeight / 2); 249 canvas->translate(kBackButtonWidth / 2 + kBackIconOffset, kHeight / 2);
240 canvas->translate(-kBackIconHeight / 2, -kBackIconHeight / 2); 250 canvas->translate(-kBackIconHeight / 2, -kBackIconHeight / 2);
241 float icon_scale = 251 float icon_scale =
242 kBackIconHeight / GetDefaultSizeOfVectorIcon(ui::kBackArrowIcon); 252 kBackIconHeight / GetDefaultSizeOfVectorIcon(ui::kBackArrowIcon);
243 canvas->scale(icon_scale, icon_scale); 253 canvas->scale(icon_scale, icon_scale);
244 PaintVectorIcon(&gfx_canvas, ui::kBackArrowIcon, 254 PaintVectorIcon(&gfx_canvas, ui::kBackArrowIcon,
245 can_go_back_ ? color_scheme().element_foreground 255 can_go_back_ ? color_scheme().element_foreground
246 : color_scheme().disabled); 256 : color_scheme().disabled);
247 canvas->restore(); 257 canvas->restore();
258
259 left_edge += kBackButtonWidth + kSeparatorWidth;
248 } 260 }
249 261
250 // Site security state icon. 262 // Site security state icon.
251 if (!gurl_.is_empty()) { 263 if (!gurl_.is_empty()) {
264 left_edge += kFieldSpacing;
265
266 gfx::RectF icon_region(left_edge, kHeight / 2 - kSecurityIconHeight / 2,
267 kSecurityIconHeight, kSecurityIconHeight);
252 canvas->save(); 268 canvas->save();
253 gfx::PointF icon_position = SecurityIconPositionMeters(); 269 canvas->translate(icon_region.x(), icon_region.y());
254 canvas->translate(icon_position.x(), icon_position.y()); 270 const gfx::VectorIcon& icon = GetSecurityIcon(security_level_);
255 const gfx::VectorIcon& icon = getSecurityIcon(security_level_);
256 float icon_scale = kSecurityIconHeight / GetDefaultSizeOfVectorIcon(icon); 271 float icon_scale = kSecurityIconHeight / GetDefaultSizeOfVectorIcon(icon);
257 canvas->scale(icon_scale, icon_scale); 272 canvas->scale(icon_scale, icon_scale);
258 PaintVectorIcon(&gfx_canvas, icon, 273 PaintVectorIcon(&gfx_canvas, icon,
259 getSchemeColor(security_level_, color_scheme())); 274 GetSchemeColor(security_level_, color_scheme()));
260 canvas->restore(); 275 canvas->restore();
276
277 security_hit_region_ = icon_region;
278 left_edge += kSecurityIconHeight + kFieldSpacing;
261 } 279 }
262 280
263 canvas->restore(); 281 canvas->restore();
264 282
283 // Draw security chip text (eg. "Not secure") next to the security icon.
284 int chip_string_id = GetSecurityTextId(security_level_, malware_);
285 if (!gurl_.is_empty() && chip_string_id != 0) {
ymalik 2017/06/19 14:33:05 I'm not sure if we want to show this in the transi
cjgrant 2017/06/19 15:39:39 I've disabled it entirely in this CL. A follow-on
286 float chip_max_width = kWidth - left_edge - kUrlRightMargin;
ymalik 2017/06/19 14:33:05 Are we allowing the chip text portion to take prec
cjgrant 2017/06/19 15:39:39 The behavior on desktop is to elide both, allocati
287 gfx::Rect text_bounds(ToPixels(left_edge), 0, ToPixels(chip_max_width),
288 ToPixels(kHeight));
289
290 int pixel_font_height = texture_size.height() * kFontHeight / kHeight;
291 SkColor chip_color = GetSchemeColor(security_level_, color_scheme());
292 auto chip_text = l10n_util::GetStringUTF16(chip_string_id);
293 DCHECK(!chip_text.empty());
294
295 gfx::FontList font_list;
296 // TODO: Can we call this more than once?
ymalik 2017/06/19 14:33:05 Please clarify what this means and add owner or bu
cjgrant 2017/06/19 15:39:39 Lets talk offline about this.
297 if (!GetFontList(pixel_font_height, chip_text, &font_list)) {
298 failure_callback_.Run(UiUnsupportedMode::kUnhandledCodePoint);
299 }
300
301 std::unique_ptr<gfx::RenderText> render_text(
302 gfx::RenderText::CreateInstance());
303 render_text->SetFontList(font_list);
304 render_text->SetColor(chip_color);
305 render_text->SetHorizontalAlignment(gfx::ALIGN_LEFT);
306 render_text->SetText(chip_text);
307 render_text->SetDisplayRect(text_bounds);
308 render_text->Draw(&gfx_canvas);
309
310 // Capture the rendered text region for future hit testing.
311 gfx::Size string_size = render_text->GetStringSize();
312 gfx::RectF hit_bounds(
313 left_edge, kHeight / 2 - ToMeters(string_size.height()) / 2,
314 ToMeters(string_size.width()), ToMeters(string_size.height()));
315 security_hit_region_.Union(hit_bounds);
316 left_edge += ToMeters(string_size.width());
317
318 // Separator line between security text and URL.
319 left_edge += kFieldSpacing;
320 paint.setColor(color_scheme().url_deemphasized);
321 canvas->drawRect(
322 SkRect::MakeXYWH(ToPixels(left_edge), ToPixels(kChipTextLineMargin),
323 ToPixels(kSeparatorWidth),
324 ToPixels(kHeight - 2 * kChipTextLineMargin)),
325 paint);
326 left_edge += kFieldSpacing + kSeparatorWidth;
327 }
328
265 if (!gurl_.is_empty()) { 329 if (!gurl_.is_empty()) {
266 if (last_drawn_gurl_ != gurl_ || 330 if (last_drawn_gurl_ != gurl_ ||
267 last_drawn_security_level_ != security_level_) { 331 last_drawn_security_level_ != security_level_) {
268 gfx::PointF url_position = UrlBarPositionMeters(); 332 float url_x = left_edge;
269 gfx::Rect text_bounds( 333 float url_width = kWidth - url_x - kUrlRightMargin;
ymalik 2017/06/19 14:33:05 Correct me if I'm wrong, but this looks like we're
cjgrant 2017/06/19 15:39:39 I don't think there's a problem. Over-the-shoulder
ymalik 2017/06/19 15:54:20 Done.
270 ToPixels(url_position.x()), ToPixels(url_position.y()), 334 gfx::Rect text_bounds(ToPixels(url_x), 0, ToPixels(url_width),
271 ToPixels(kWidth - url_position.x() - kUrlRightMargin), 335 ToPixels(kHeight));
272 ToPixels(kHeight));
273 RenderUrl(texture_size, text_bounds); 336 RenderUrl(texture_size, text_bounds);
274 last_drawn_gurl_ = gurl_; 337 last_drawn_gurl_ = gurl_;
275 last_drawn_security_level_ = security_level_; 338 last_drawn_security_level_ = security_level_;
276 } 339 }
277 url_render_text_->Draw(&gfx_canvas); 340 url_render_text_->Draw(&gfx_canvas);
278 } 341 }
279 } 342 }
280 343
281 void UrlBarTexture::RenderUrl(const gfx::Size& texture_size, 344 void UrlBarTexture::RenderUrl(const gfx::Size& texture_size,
282 const gfx::Rect& bounds) { 345 const gfx::Rect& bounds) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 color_scheme); 437 color_scheme);
375 break; 438 break;
376 } 439 }
377 440
378 // Only SECURE and DANGEROUS levels (pages served over HTTPS or flagged by 441 // Only SECURE and DANGEROUS levels (pages served over HTTPS or flagged by
379 // SafeBrowsing) get a special scheme color treatment. If the security level 442 // SafeBrowsing) get a special scheme color treatment. If the security level
380 // is NONE or HTTP_SHOW_WARNING, we do not override the text style previously 443 // is NONE or HTTP_SHOW_WARNING, we do not override the text style previously
381 // applied to the scheme text range by setEmphasis(). 444 // applied to the scheme text range by setEmphasis().
382 if (scheme_range.IsValid() && security_level != security_state::NONE && 445 if (scheme_range.IsValid() && security_level != security_state::NONE &&
383 security_level != security_state::HTTP_SHOW_WARNING) { 446 security_level != security_state::HTTP_SHOW_WARNING) {
384 render_text->ApplyColor(getSchemeColor(security_level, color_scheme), 447 render_text->ApplyColor(GetSchemeColor(security_level, color_scheme),
385 scheme_range); 448 scheme_range);
386 if (security_level == SecurityLevel::DANGEROUS) { 449 if (security_level == SecurityLevel::DANGEROUS) {
387 render_text->ApplyStyle(gfx::TextStyle::DIAGONAL_STRIKE, true, 450 render_text->ApplyStyle(gfx::TextStyle::STRIKE, true, scheme_range);
388 scheme_range);
389 } 451 }
390 } 452 }
391 } 453 }
392 454
393 gfx::Size UrlBarTexture::GetPreferredTextureSize(int maximum_width) const { 455 gfx::Size UrlBarTexture::GetPreferredTextureSize(int maximum_width) const {
394 return gfx::Size(maximum_width, maximum_width * kHeight / kWidth); 456 return gfx::Size(maximum_width, maximum_width * kHeight / kWidth);
395 } 457 }
396 458
397 gfx::SizeF UrlBarTexture::GetDrawnSize() const { 459 gfx::SizeF UrlBarTexture::GetDrawnSize() const {
398 return size_; 460 return size_;
399 } 461 }
400 462
401 } // namespace vr_shell 463 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698