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

Side by Side Diff: chrome/browser/android/vr_shell/ui_elements/ui_element.h

Issue 2834543006: Hook up insecure content warnings for http webVR presentation. (Closed)
Patch Set: rebase Created 3 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_UI_ELEMENT_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENT_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "device/vr/vr_types.h" 13 #include "device/vr/vr_types.h"
14 14
15 namespace base { 15 namespace base {
16 class TimeTicks; 16 class TimeTicks;
17 } 17 }
18 18
19 namespace vr_shell { 19 namespace vr_shell {
20 20
21 class Animation; 21 class Animation;
22 class VrShellRenderer;
22 23
23 enum XAnchoring { 24 enum XAnchoring {
24 XNONE = 0, 25 XNONE = 0,
25 XLEFT, 26 XLEFT,
26 XRIGHT, 27 XRIGHT,
27 }; 28 };
28 29
29 enum YAnchoring { 30 enum YAnchoring {
30 YNONE = 0, 31 YNONE = 0,
31 YTOP, 32 YTOP,
32 YBOTTOM, 33 YBOTTOM,
33 }; 34 };
34 35
35 enum Fill { 36 enum Fill {
36 NONE = 0, 37 NONE = 0,
37 SKIA = 1, 38 // The element is filled with the content web site. Only one content element
39 // may be added to the
40 // scene.
41 CONTENT = 1,
38 // The element is filled with a radial gradient as specified by the edge and 42 // The element is filled with a radial gradient as specified by the edge and
39 // center color. 43 // center color.
40 OPAQUE_GRADIENT = 2, 44 OPAQUE_GRADIENT = 2,
41 // Same as OPAQUE_GRADIENT but the element is drawn as a grid. 45 // Same as OPAQUE_GRADIENT but the element is drawn as a grid.
42 GRID_GRADIENT = 3, 46 GRID_GRADIENT = 3,
43 // The element is filled with the content web site. Only one content element 47 // The element draws itself.
44 // may be added to the 48 SELF = 4,
45 // scene.
46 CONTENT = 4,
47 }; 49 };
48 50
49 struct Transform { 51 struct Transform {
50 Transform(); 52 Transform();
51 53
52 void MakeIdentity(); 54 void MakeIdentity();
53 void Rotate(const vr::Quatf& quat); 55 void Rotate(const vr::Quatf& quat);
54 void Rotate(const vr::RotationAxisAngle& axis_angle); 56 void Rotate(const vr::RotationAxisAngle& axis_angle);
55 void Translate(const gfx::Vector3dF& translation); 57 void Translate(const gfx::Vector3dF& translation);
56 void Scale(const gfx::Vector3dF& scale); 58 void Scale(const gfx::Vector3dF& scale);
(...skipping 20 matching lines...) Expand all
77 // rectangle, returning 2D coordinates relative to the un-transformed unit 79 // rectangle, returning 2D coordinates relative to the un-transformed unit
78 // rectangle. This allows beam intersection points to be mapped to sprite 80 // rectangle. This allows beam intersection points to be mapped to sprite
79 // pixel coordinates. Points that fall onto the rectangle will generate X and 81 // pixel coordinates. Points that fall onto the rectangle will generate X and
80 // Y values on the interval [-0.5, 0.5]. 82 // Y values on the interval [-0.5, 0.5].
81 gfx::PointF GetUnitRectangleCoordinates(const gfx::Point3F& world_point); 83 gfx::PointF GetUnitRectangleCoordinates(const gfx::Point3F& world_point);
82 84
83 private: 85 private:
84 Transform transform_; 86 Transform transform_;
85 }; 87 };
86 88
89 // TODO(mthiesse): Make this a class - we derive classes from this struct.
87 struct UiElement : public WorldRectangle { 90 struct UiElement : public WorldRectangle {
88 UiElement(); 91 UiElement();
89 ~UiElement(); 92 virtual ~UiElement();
90 93
91 void Animate(const base::TimeTicks& time); 94 void Animate(const base::TimeTicks& time);
92 95
93 // Indicates whether the element should be visually rendered. 96 // Indicates whether the element should be visually rendered.
94 bool IsVisible() const; 97 bool IsVisible() const;
95 98
96 // Indicates whether the element should be tested for cursor input. 99 // Indicates whether the element should be tested for cursor input.
97 bool IsHitTestable() const; 100 bool IsHitTestable() const;
98 101
102 virtual void Render(VrShellRenderer* renderer,
103 vr::Mat4f view_proj_matrix) const;
104
105 virtual void Initialize();
106
99 // Valid IDs are non-negative. 107 // Valid IDs are non-negative.
100 int id = -1; 108 int id = -1;
101 109
102 // Name string for debugging and testing purposes. 110 // Name string for debugging and testing purposes.
103 std::string name; 111 std::string name;
104 112
105 // If a non-negative parent ID is specified, applicable transformations 113 // If a non-negative parent ID is specified, applicable transformations
106 // are applied relative to the parent, rather than absolutely. 114 // are applied relative to the parent, rather than absolutely.
107 int parent_id = -1; 115 int parent_id = -1;
108 116
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 169
162 // A flag usable during transformation calculates to avoid duplicate work. 170 // A flag usable during transformation calculates to avoid duplicate work.
163 bool dirty; 171 bool dirty;
164 172
165 private: 173 private:
166 DISALLOW_COPY_AND_ASSIGN(UiElement); 174 DISALLOW_COPY_AND_ASSIGN(UiElement);
167 }; 175 };
168 176
169 } // namespace vr_shell 177 } // namespace vr_shell
170 178
171 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENT_H_ 179 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698