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

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

Issue 2829653003: PROTOTYPE (incomplete): Add quad renderer and stub bits to handle security warnings. (Closed)
Patch Set: 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_ELEMENT_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENT_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_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
44 // may be added to the
45 // scene.
46 CONTENT = 4,
47 }; 47 };
48 48
49 struct Transform { 49 struct Transform {
50 Transform(); 50 Transform();
51 51
52 void MakeIdentity(); 52 void MakeIdentity();
53 void Rotate(const vr::Quatf& quat); 53 void Rotate(const vr::Quatf& quat);
54 void Rotate(const vr::RotationAxisAngle& axis_angle); 54 void Rotate(const vr::RotationAxisAngle& axis_angle);
55 void Translate(const gfx::Vector3dF& translation); 55 void Translate(const gfx::Vector3dF& translation);
56 void Scale(const gfx::Vector3dF& scale); 56 void Scale(const gfx::Vector3dF& scale);
(...skipping 22 matching lines...) Expand all
79 // pixel coordinates. Points that fall onto the rectangle will generate X and 79 // pixel coordinates. Points that fall onto the rectangle will generate X and
80 // Y values on the interval [-0.5, 0.5]. 80 // Y values on the interval [-0.5, 0.5].
81 gfx::PointF GetUnitRectangleCoordinates(const gfx::Point3F& world_point); 81 gfx::PointF GetUnitRectangleCoordinates(const gfx::Point3F& world_point);
82 82
83 private: 83 private:
84 Transform transform_; 84 Transform transform_;
85 }; 85 };
86 86
87 struct UiElement : public WorldRectangle { 87 struct UiElement : public WorldRectangle {
88 UiElement(); 88 UiElement();
89 ~UiElement(); 89 virtual ~UiElement();
90 90
91 void Animate(const base::TimeTicks& time); 91 void Animate(const base::TimeTicks& time);
92 92
93 // Indicates whether the element should be visually rendered. 93 // Indicates whether the element should be visually rendered.
94 bool IsVisible() const; 94 bool IsVisible() const;
95 95
96 // Indicates whether the element should be tested for cursor input. 96 // Indicates whether the element should be tested for cursor input.
97 bool IsHitTestable() const; 97 bool IsHitTestable() const;
98 98
99 virtual bool Render(VrShellRenderer* renderer) const;
100
99 // Valid IDs are non-negative. 101 // Valid IDs are non-negative.
100 int id = -1; 102 int id = -1;
101 103
102 // Name string for debugging and testing purposes. 104 // Name string for debugging and testing purposes.
103 std::string name; 105 std::string name;
104 106
105 // If a non-negative parent ID is specified, applicable transformations 107 // If a non-negative parent ID is specified, applicable transformations
106 // are applied relative to the parent, rather than absolutely. 108 // are applied relative to the parent, rather than absolutely.
107 int parent_id = -1; 109 int parent_id = -1;
108 110
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // A flag usable during transformation calculates to avoid duplicate work. 164 // A flag usable during transformation calculates to avoid duplicate work.
163 bool dirty; 165 bool dirty;
164 166
165 private: 167 private:
166 DISALLOW_COPY_AND_ASSIGN(UiElement); 168 DISALLOW_COPY_AND_ASSIGN(UiElement);
167 }; 169 };
168 170
169 } // namespace vr_shell 171 } // namespace vr_shell
170 172
171 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENT_H_ 173 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698