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

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

Issue 2902043005: [vr] Add incognito coloring (Closed)
Patch Set: . Created 3 years, 7 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 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" 12 #include "chrome/browser/android/vr_shell/textures/ui_texture.h"
13 #include "components/security_state/core/security_state.h" 13 #include "components/security_state/core/security_state.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 namespace gfx { 16 namespace gfx {
17 class PointF; 17 class PointF;
18 class RenderText; 18 class RenderText;
19 } // namespace gfx 19 } // namespace gfx
20 20
21 namespace vr_shell { 21 namespace vr_shell {
22 22
23 class RenderTextWrapper; 23 class RenderTextWrapper;
24 struct ColorScheme;
24 25
25 class UrlBarTexture : public UiTexture { 26 class UrlBarTexture : public UiTexture {
26 public: 27 public:
27 enum DrawFlags { 28 enum DrawFlags {
28 FLAG_BACK_HOVER = 1 << 0, 29 FLAG_BACK_HOVER = 1 << 0,
29 FLAG_BACK_DOWN = 1 << 1, 30 FLAG_BACK_DOWN = 1 << 1,
30 }; 31 };
31 32
32 UrlBarTexture(); 33 UrlBarTexture();
33 ~UrlBarTexture() override; 34 ~UrlBarTexture() override;
34 gfx::Size GetPreferredTextureSize(int width) const override; 35 gfx::Size GetPreferredTextureSize(int width) const override;
35 gfx::SizeF GetDrawnSize() const override; 36 gfx::SizeF GetDrawnSize() const override;
36 37
37 void SetURL(const GURL& gurl); 38 void SetURL(const GURL& gurl);
38 void SetSecurityLevel(security_state::SecurityLevel level); 39 void SetSecurityLevel(security_state::SecurityLevel level);
39 40
40 bool HitsBackButton(const gfx::PointF& position) const; 41 bool HitsBackButton(const gfx::PointF& position) const;
41 bool HitsUrlBar(const gfx::PointF& position) const; 42 bool HitsUrlBar(const gfx::PointF& position) const;
42 43
43 void SetHovered(bool hovered); 44 void SetHovered(bool hovered);
44 void SetPressed(bool pressed); 45 void SetPressed(bool pressed);
45 46
46 // Public for testability. 47 // Public for testability.
47 static void ApplyUrlStyling(const base::string16& formatted_url, 48 static void ApplyUrlStyling(const base::string16& formatted_url,
48 const url::Parsed& parsed, 49 const url::Parsed& parsed,
49 security_state::SecurityLevel security_level, 50 security_state::SecurityLevel security_level,
50 vr_shell::RenderTextWrapper* render_text); 51 vr_shell::RenderTextWrapper* render_text,
52 const ColorScheme& color_scheme);
51 53
52 private: 54 private:
53 void Draw(SkCanvas* canvas, const gfx::Size& texture_size) override; 55 void Draw(SkCanvas* canvas, const gfx::Size& texture_size) override;
54 float ToPixels(float meters) const; 56 float ToPixels(float meters) const;
55 bool HitsTransparentRegion(const gfx::PointF& meters, bool left) const; 57 bool HitsTransparentRegion(const gfx::PointF& meters, bool left) const;
56 void RenderUrl(const gfx::Size& texture_size, const gfx::Rect& bounds); 58 void RenderUrl(const gfx::Size& texture_size, const gfx::Rect& bounds);
59 void OnSetMode() override;
60 const ColorScheme& color_scheme() const;
57 61
58 gfx::SizeF size_; 62 gfx::SizeF size_;
59 bool hovered_ = false; 63 bool hovered_ = false;
60 bool pressed_ = false; 64 bool pressed_ = false;
61 65
62 GURL gurl_; 66 GURL gurl_;
63 security_state::SecurityLevel security_level_; 67 security_state::SecurityLevel security_level_;
64 68
65 std::unique_ptr<gfx::RenderText> url_render_text_; 69 std::unique_ptr<gfx::RenderText> url_render_text_;
66 GURL last_drawn_gurl_; 70 GURL last_drawn_gurl_;
67 security_state::SecurityLevel last_drawn_security_level_; 71 security_state::SecurityLevel last_drawn_security_level_;
68 72
69 DISALLOW_COPY_AND_ASSIGN(UrlBarTexture); 73 DISALLOW_COPY_AND_ASSIGN(UrlBarTexture);
70 }; 74 };
71 75
72 } // namespace vr_shell 76 } // namespace vr_shell
73 77
74 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_ 78 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698