OLD | NEW |
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_SCENE_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_H_ |
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
| 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "chrome/browser/android/vr_shell/vr_math.h" | 13 #include "chrome/browser/android/vr_shell/vr_math.h" |
13 | 14 |
14 namespace base { | 15 namespace base { |
15 class DictionaryValue; | 16 class DictionaryValue; |
16 class ListValue; | 17 class ListValue; |
17 } | 18 } |
18 | 19 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // unit used in animations. | 61 // unit used in animations. |
61 void UpdateTransforms(int64_t time_in_micro); | 62 void UpdateTransforms(int64_t time_in_micro); |
62 | 63 |
63 // Handle a batch of commands passed from the UI HTML. | 64 // Handle a batch of commands passed from the UI HTML. |
64 void HandleCommands(std::unique_ptr<base::ListValue> commands, | 65 void HandleCommands(std::unique_ptr<base::ListValue> commands, |
65 int64_t time_in_micro); | 66 int64_t time_in_micro); |
66 | 67 |
67 const std::vector<std::unique_ptr<ContentRectangle>>& GetUiElements() const; | 68 const std::vector<std::unique_ptr<ContentRectangle>>& GetUiElements() const; |
68 | 69 |
69 ContentRectangle* GetUiElementById(int element_id); | 70 ContentRectangle* GetUiElementById(int element_id); |
| 71 ContentRectangle* GetUiElementByName(const std::string& element_name); |
70 | 72 |
71 std::vector<const ContentRectangle*> GetWorldElements() const; | 73 std::vector<const ContentRectangle*> GetWorldElements() const; |
72 std::vector<const ContentRectangle*> GetHeadLockedElements() const; | 74 std::vector<const ContentRectangle*> GetHeadLockedElements() const; |
73 bool HasVisibleHeadLockedElements() const; | 75 bool HasVisibleHeadLockedElements() const; |
74 | 76 |
75 const Colorf& GetBackgroundColor() const; | 77 const Colorf& GetBackgroundColor() const; |
76 float GetBackgroundDistance() const; | 78 float GetBackgroundDistance() const; |
77 bool GetWebVrRenderingEnabled() const; | 79 bool GetWebVrRenderingEnabled() const; |
78 | 80 |
| 81 // Builds a dictionary of the given element's properties for testing |
| 82 // purposes. This dictionary can be serialized and passed back to Java |
| 83 // during end-to-end testing. |
| 84 std::unique_ptr<base::DictionaryValue> CreateUiElementInfo( |
| 85 const std::string& element_name); |
| 86 |
79 private: | 87 private: |
80 void ApplyRecursiveTransforms(ContentRectangle* element); | 88 void ApplyRecursiveTransforms(ContentRectangle* element); |
81 void ApplyDictToElement(const base::DictionaryValue& dict, | 89 void ApplyDictToElement(const base::DictionaryValue& dict, |
82 ContentRectangle* element); | 90 ContentRectangle* element); |
83 | 91 |
84 std::vector<std::unique_ptr<ContentRectangle>> ui_elements_; | 92 std::vector<std::unique_ptr<ContentRectangle>> ui_elements_; |
85 ContentRectangle* content_element_ = nullptr; | 93 ContentRectangle* content_element_ = nullptr; |
86 Colorf background_color_ = {0.1f, 0.1f, 0.1f, 1.0f}; | 94 Colorf background_color_ = {0.1f, 0.1f, 0.1f, 1.0f}; |
87 float background_distance_ = 10.0f; | 95 float background_distance_ = 10.0f; |
88 bool webvr_rendering_enabled_ = true; | 96 bool webvr_rendering_enabled_ = true; |
89 | 97 |
90 DISALLOW_COPY_AND_ASSIGN(UiScene); | 98 DISALLOW_COPY_AND_ASSIGN(UiScene); |
91 }; | 99 }; |
92 | 100 |
93 } // namespace vr_shell | 101 } // namespace vr_shell |
94 | 102 |
95 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_H_ | 103 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_H_ |
OLD | NEW |