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

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

Issue 2923843002: Use desktop toolbar icons in VR. (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
« no previous file with comments | « chrome/browser/android/vr_shell/BUILD.gn ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "cc/paint/skia_paint_canvas.h" 8 #include "cc/paint/skia_paint_canvas.h"
9 #include "chrome/browser/android/vr_shell/color_scheme.h" 9 #include "chrome/browser/android/vr_shell/color_scheme.h"
10 #include "chrome/browser/android/vr_shell/textures/render_text_wrapper.h" 10 #include "chrome/browser/android/vr_shell/textures/render_text_wrapper.h"
11 #include "components/toolbar/vector_icons.h"
11 #include "components/url_formatter/url_formatter.h" 12 #include "components/url_formatter/url_formatter.h"
12 #include "ui/gfx/canvas.h" 13 #include "ui/gfx/canvas.h"
13 #include "ui/gfx/font.h" 14 #include "ui/gfx/font.h"
14 #include "ui/gfx/font_list.h" 15 #include "ui/gfx/font_list.h"
15 #include "ui/gfx/geometry/point_f.h" 16 #include "ui/gfx/geometry/point_f.h"
16 #include "ui/gfx/geometry/rect.h" 17 #include "ui/gfx/geometry/rect.h"
17 #include "ui/gfx/geometry/rect_f.h" 18 #include "ui/gfx/geometry/rect_f.h"
18 #include "ui/gfx/paint_vector_icon.h" 19 #include "ui/gfx/paint_vector_icon.h"
19 #include "ui/gfx/render_text.h" 20 #include "ui/gfx/render_text.h"
20 #include "ui/gfx/vector_icon_types.h" 21 #include "ui/gfx/vector_icon_types.h"
21 #include "ui/vector_icons/vector_icons.h" 22 #include "ui/vector_icons/vector_icons.h"
22 23
23 namespace vr_shell { 24 namespace vr_shell {
24 25
25 namespace { 26 namespace {
26 27
27 static constexpr float kWidth = 0.672; 28 static constexpr float kWidth = 0.672;
28 static constexpr float kHeight = 0.088; 29 static constexpr float kHeight = 0.088;
29 static constexpr float kFontHeight = 0.027; 30 static constexpr float kFontHeight = 0.027;
30 static constexpr float kBackButtonWidth = kHeight; 31 static constexpr float kBackButtonWidth = kHeight;
31 static constexpr float kBackIconHeight = 0.0375; 32 static constexpr float kBackIconHeight = 0.0375;
32 static constexpr float kBackIconOffset = 0.005; 33 static constexpr float kBackIconOffset = 0.005;
33 static constexpr float kSecurityFieldWidth = 0.06; 34 static constexpr float kSecurityFieldWidth = 0.06;
34 static constexpr float kSecurityIconHeight = 0.03; 35 static constexpr float kSecurityIconHeight = 0.03;
35 static constexpr float kUrlRightMargin = 0.02; 36 static constexpr float kUrlRightMargin = 0.02;
36 static constexpr float kSeparatorWidth = 0.002; 37 static constexpr float kSeparatorWidth = 0.002;
37 38
38 using security_state::SecurityLevel; 39 using security_state::SecurityLevel;
39 40
41 // See ToolbarModelImpl::GetVectorIcon().
40 const struct gfx::VectorIcon& getSecurityIcon(SecurityLevel level) { 42 const struct gfx::VectorIcon& getSecurityIcon(SecurityLevel level) {
41 switch (level) { 43 switch (level) {
42 case SecurityLevel::NONE: 44 case security_state::NONE:
43 case SecurityLevel::HTTP_SHOW_WARNING: 45 case security_state::HTTP_SHOW_WARNING:
44 case SecurityLevel::SECURITY_WARNING: 46 return toolbar::kHttpIcon;
45 return ui::kInfoOutlineIcon; 47 case security_state::EV_SECURE:
46 case SecurityLevel::SECURE: 48 case security_state::SECURE:
47 case SecurityLevel::EV_SECURE: 49 return toolbar::kHttpsValidIcon;
48 return ui::kLockIcon; 50 case security_state::SECURITY_WARNING:
49 case SecurityLevel::DANGEROUS: 51 // Surface Dubious as Neutral.
50 return ui::kWarningIcon; 52 return toolbar::kHttpIcon;
51 case SecurityLevel::SECURE_WITH_POLICY_INSTALLED_CERT: // ChromeOS only. 53 case security_state::SECURE_WITH_POLICY_INSTALLED_CERT: // ChromeOS only.
54 return ui::kBusinessIcon;
55 case security_state::DANGEROUS:
56 return toolbar::kHttpsInvalidIcon;
52 default: 57 default:
53 NOTREACHED(); 58 NOTREACHED();
54 return ui::kWarningIcon; 59 return toolbar::kHttpsInvalidIcon;
55 } 60 }
56 } 61 }
57 62
58 // See LocationBarView::GetSecureTextColor(). 63 // See LocationBarView::GetSecureTextColor().
59 SkColor getSchemeColor(SecurityLevel level, const ColorScheme& color_scheme) { 64 SkColor getSchemeColor(SecurityLevel level, const ColorScheme& color_scheme) {
60 switch (level) { 65 switch (level) {
61 case SecurityLevel::NONE: 66 case SecurityLevel::NONE:
62 case SecurityLevel::HTTP_SHOW_WARNING: 67 case SecurityLevel::HTTP_SHOW_WARNING:
68 return color_scheme.deemphasized;
69 case SecurityLevel::EV_SECURE:
70 case SecurityLevel::SECURE:
71 return color_scheme.secure;
63 case SecurityLevel::SECURITY_WARNING: 72 case SecurityLevel::SECURITY_WARNING:
64 return color_scheme.deemphasized; 73 return color_scheme.deemphasized;
65 case SecurityLevel::SECURE: 74 case SecurityLevel::SECURE_WITH_POLICY_INSTALLED_CERT: // ChromeOS only.
66 case SecurityLevel::EV_SECURE: 75 return color_scheme.insecure;
67 return color_scheme.secure;
68 case SecurityLevel::DANGEROUS: 76 case SecurityLevel::DANGEROUS:
69 return color_scheme.insecure; 77 return color_scheme.insecure;
70 case SecurityLevel::SECURE_WITH_POLICY_INSTALLED_CERT: // ChromeOS only.
71 default: 78 default:
72 NOTREACHED(); 79 NOTREACHED();
73 return color_scheme.warning; 80 return color_scheme.insecure;
74 } 81 }
75 } 82 }
76 83
77 void setEmphasis(vr_shell::RenderTextWrapper* render_text, 84 void setEmphasis(vr_shell::RenderTextWrapper* render_text,
78 bool emphasis, 85 bool emphasis,
79 const gfx::Range& range, 86 const gfx::Range& range,
80 const ColorScheme& color_scheme) { 87 const ColorScheme& color_scheme) {
81 SkColor color = 88 SkColor color =
82 emphasis ? color_scheme.emphasized : color_scheme.deemphasized; 89 emphasis ? color_scheme.emphasized : color_scheme.deemphasized;
83 if (range.IsValid()) { 90 if (range.IsValid()) {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 367
361 gfx::Size UrlBarTexture::GetPreferredTextureSize(int maximum_width) const { 368 gfx::Size UrlBarTexture::GetPreferredTextureSize(int maximum_width) const {
362 return gfx::Size(maximum_width, maximum_width * kHeight / kWidth); 369 return gfx::Size(maximum_width, maximum_width * kHeight / kWidth);
363 } 370 }
364 371
365 gfx::SizeF UrlBarTexture::GetDrawnSize() const { 372 gfx::SizeF UrlBarTexture::GetDrawnSize() const {
366 return size_; 373 return size_;
367 } 374 }
368 375
369 } // namespace vr_shell 376 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/BUILD.gn ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698