OLD | NEW |
---|---|
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" | 21 #include "ui/gfx/geometry/rect_f.h" |
20 #include "ui/gfx/paint_vector_icon.h" | 22 #include "ui/gfx/paint_vector_icon.h" |
21 #include "ui/gfx/render_text.h" | 23 #include "ui/gfx/render_text.h" |
22 #include "ui/gfx/vector_icon_types.h" | 24 #include "ui/gfx/vector_icon_types.h" |
23 #include "ui/vector_icons/vector_icons.h" | 25 #include "ui/vector_icons/vector_icons.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 icon_default_height = GetDefaultSizeOfVectorIcon(icon); | 244 icon_default_height = GetDefaultSizeOfVectorIcon(icon); |
243 icon_scale = kSecurityIconHeight / icon_default_height; | 245 icon_scale = kSecurityIconHeight / icon_default_height; |
244 SkColor icon_color = getSchemeColor(security_level_, color_scheme()); | 246 SkColor icon_color = getSchemeColor(security_level_, color_scheme()); |
245 canvas->scale(icon_scale, icon_scale); | 247 canvas->scale(icon_scale, icon_scale); |
246 PaintVectorIcon(&gfx_canvas, icon, icon_color); | 248 PaintVectorIcon(&gfx_canvas, icon, icon_color); |
247 canvas->restore(); | 249 canvas->restore(); |
248 } | 250 } |
249 | 251 |
250 canvas->restore(); | 252 canvas->restore(); |
251 | 253 |
254 auto chip_text = l10n_util::GetStringUTF16(IDS_DANGEROUS_VERBOSE_STATE); | |
cjgrant
2017/06/15 19:03:55
Folks, this is is temporary test code to exercise
| |
255 CHECK(!chip_text.empty()); | |
256 | |
252 if (!gurl_.is_empty()) { | 257 if (!gurl_.is_empty()) { |
253 if (last_drawn_gurl_ != gurl_ || | 258 if (last_drawn_gurl_ != gurl_ || |
254 last_drawn_security_level_ != security_level_) { | 259 last_drawn_security_level_ != security_level_) { |
255 float url_x = kBackButtonWidth + kSeparatorWidth + kSecurityFieldWidth; | 260 float url_x = kBackButtonWidth + kSeparatorWidth + kSecurityFieldWidth; |
256 float url_width = kWidth - url_x - kUrlRightMargin; | 261 float url_width = kWidth - url_x - kUrlRightMargin; |
257 gfx::Rect text_bounds(ToPixels(url_x), 0, ToPixels(url_width), | 262 gfx::Rect text_bounds(ToPixels(url_x), 0, ToPixels(url_width), |
258 ToPixels(kHeight)); | 263 ToPixels(kHeight)); |
259 RenderUrl(texture_size, text_bounds); | 264 RenderUrl(texture_size, text_bounds); |
260 last_drawn_gurl_ = gurl_; | 265 last_drawn_gurl_ = gurl_; |
261 last_drawn_security_level_ = security_level_; | 266 last_drawn_security_level_ = security_level_; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
378 | 383 |
379 gfx::Size UrlBarTexture::GetPreferredTextureSize(int maximum_width) const { | 384 gfx::Size UrlBarTexture::GetPreferredTextureSize(int maximum_width) const { |
380 return gfx::Size(maximum_width, maximum_width * kHeight / kWidth); | 385 return gfx::Size(maximum_width, maximum_width * kHeight / kWidth); |
381 } | 386 } |
382 | 387 |
383 gfx::SizeF UrlBarTexture::GetDrawnSize() const { | 388 gfx::SizeF UrlBarTexture::GetDrawnSize() const { |
384 return size_; | 389 return size_; |
385 } | 390 } |
386 | 391 |
387 } // namespace vr_shell | 392 } // namespace vr_shell |
OLD | NEW |