| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 // Remove |animation_id| from element |element_id|. | 54 // Remove |animation_id| from element |element_id|. |
| 55 void RemoveAnimation(int element_id, int animation_id); | 55 void RemoveAnimation(int element_id, int animation_id); |
| 56 | 56 |
| 57 // Update the positions of all elements in the scene, according to active | 57 // Update the positions of all elements in the scene, according to active |
| 58 // animations, desired screen tilt and time. The units of time are | 58 // animations, desired screen tilt and time. The units of time are |
| 59 // arbitrary, but must match the unit used in animations. | 59 // arbitrary, but must match the unit used in animations. |
| 60 void UpdateTransforms(float screen_tilt, int64_t time_in_micro); | 60 void UpdateTransforms(float screen_tilt, int64_t time_in_micro); |
| 61 | 61 |
| 62 // Handle a batch of commands passed from the UI HTML. | 62 // Handle a batch of commands passed from the UI HTML. |
| 63 void HandleCommands(const base::ListValue* commands, int64_t time_in_micro); | 63 void HandleCommands(std::unique_ptr<base::ListValue> commands, |
| 64 int64_t time_in_micro); |
| 64 | 65 |
| 65 const std::vector<std::unique_ptr<ContentRectangle>>& GetUiElements() const; | 66 const std::vector<std::unique_ptr<ContentRectangle>>& GetUiElements() const; |
| 66 | 67 |
| 67 ContentRectangle* GetUiElementById(int element_id); | 68 ContentRectangle* GetUiElementById(int element_id); |
| 68 | 69 |
| 69 ContentRectangle* GetContentQuad(); | 70 ContentRectangle* GetContentQuad(); |
| 70 | 71 |
| 71 // Return a monotonic time in microseconds for coordinating animations. | |
| 72 static int64_t TimeInMicroseconds(); | |
| 73 | |
| 74 private: | 72 private: |
| 75 void ApplyRecursiveTransforms(const ContentRectangle& element, | 73 void ApplyRecursiveTransforms(const ContentRectangle& element, |
| 76 ReversibleTransform* transform); | 74 ReversibleTransform* transform); |
| 77 void ApplyDictToElement(const base::DictionaryValue& dict, | 75 void ApplyDictToElement(const base::DictionaryValue& dict, |
| 78 ContentRectangle *element); | 76 ContentRectangle *element); |
| 79 | 77 |
| 80 std::vector<std::unique_ptr<ContentRectangle>> ui_elements_; | 78 std::vector<std::unique_ptr<ContentRectangle>> ui_elements_; |
| 81 ContentRectangle* content_element_ = nullptr; | 79 ContentRectangle* content_element_ = nullptr; |
| 82 | 80 |
| 83 DISALLOW_COPY_AND_ASSIGN(UiScene); | 81 DISALLOW_COPY_AND_ASSIGN(UiScene); |
| 84 }; | 82 }; |
| 85 | 83 |
| 86 } // namespace vr_shell | 84 } // namespace vr_shell |
| 87 | 85 |
| 88 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_H_ | 86 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_H_ |
| OLD | NEW |