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

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

Issue 2902393002: [vr] Bail on unhandled code points. (Closed)
Patch Set: histograms 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 #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/callback.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" 13 #include "chrome/browser/android/vr_shell/textures/ui_texture.h"
14 #include "chrome/browser/android/vr_shell/ui_unsupported_mode.h"
13 #include "url/gurl.h" 15 #include "url/gurl.h"
14 16
15 namespace gfx { 17 namespace gfx {
16 class PointF; 18 class PointF;
17 class RenderText; 19 class RenderText;
18 } // namespace gfx 20 } // namespace gfx
19 21
20 namespace vr_shell { 22 namespace vr_shell {
21 23
22 class UrlBarTexture : public UiTexture { 24 class UrlBarTexture : public UiTexture {
23 public: 25 public:
24 enum DrawFlags { 26 enum DrawFlags {
25 FLAG_BACK_HOVER = 1 << 0, 27 FLAG_BACK_HOVER = 1 << 0,
26 FLAG_BACK_DOWN = 1 << 1, 28 FLAG_BACK_DOWN = 1 << 1,
27 }; 29 };
28 30
29 UrlBarTexture(); 31 explicit UrlBarTexture(
32 const base::Callback<void(UiUnsupportedMode)>& failure_callback);
30 ~UrlBarTexture() override; 33 ~UrlBarTexture() override;
31 gfx::Size GetPreferredTextureSize(int width) const override; 34 gfx::Size GetPreferredTextureSize(int width) const override;
32 gfx::SizeF GetDrawnSize() const override; 35 gfx::SizeF GetDrawnSize() const override;
33 36
34 void SetURL(const GURL& gurl); 37 void SetURL(const GURL& gurl);
35 void SetSecurityLevel(int level); 38 void SetSecurityLevel(int level);
36 39
37 bool HitsBackButton(const gfx::PointF& position) const; 40 bool HitsBackButton(const gfx::PointF& position) const;
38 bool HitsUrlBar(const gfx::PointF& position) const; 41 bool HitsUrlBar(const gfx::PointF& position) const;
39 42
40 void SetHovered(bool hovered); 43 void SetHovered(bool hovered);
41 void SetPressed(bool pressed); 44 void SetPressed(bool pressed);
42 45
43 private: 46 private:
44 void Draw(SkCanvas* canvas, const gfx::Size& texture_size) override; 47 void Draw(SkCanvas* canvas, const gfx::Size& texture_size) override;
45 float ToPixels(float meters) const; 48 float ToPixels(float meters) const;
46 bool HitsTransparentRegion(const gfx::PointF& meters, bool left) const; 49 bool HitsTransparentRegion(const gfx::PointF& meters, bool left) const;
47 50
48 gfx::SizeF size_; 51 gfx::SizeF size_;
49 int security_level_; 52 int security_level_;
50 bool hovered_ = false; 53 bool hovered_ = false;
51 bool pressed_ = false; 54 bool pressed_ = false;
52 GURL gurl_; 55 GURL gurl_;
53 GURL last_drawn_gurl_; 56 GURL last_drawn_gurl_;
54 std::vector<std::unique_ptr<gfx::RenderText>> gurl_render_texts_; 57 std::vector<std::unique_ptr<gfx::RenderText>> gurl_render_texts_;
58 base::Callback<void(UiUnsupportedMode)> failure_callback_;
55 59
56 DISALLOW_COPY_AND_ASSIGN(UrlBarTexture); 60 DISALLOW_COPY_AND_ASSIGN(UrlBarTexture);
57 }; 61 };
58 62
59 } // namespace vr_shell 63 } // namespace vr_shell
60 64
61 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_ 65 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_URL_BAR_TEXTURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698