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 #include "chrome/browser/android/vr_shell/ui_scene.h" | 5 #include "chrome/browser/android/vr_shell/ui_scene.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // current frame. It may throttle, for example. | 114 // current frame. It may throttle, for example. |
115 element->OnBeginFrame(current_time); | 115 element->OnBeginFrame(current_time); |
116 | 116 |
117 element->set_dirty(true); | 117 element->set_dirty(true); |
118 } | 118 } |
119 for (auto& element : ui_elements_) { | 119 for (auto& element : ui_elements_) { |
120 ApplyRecursiveTransforms(element.get()); | 120 ApplyRecursiveTransforms(element.get()); |
121 } | 121 } |
122 } | 122 } |
123 | 123 |
124 UiElement* UiScene::GetUiElementById(int element_id) { | 124 UiElement* UiScene::GetUiElementById(int element_id) const { |
125 for (const auto& element : ui_elements_) { | 125 for (const auto& element : ui_elements_) { |
126 if (element->id() == element_id) { | 126 if (element->id() == element_id) { |
127 return element.get(); | 127 return element.get(); |
128 } | 128 } |
129 } | 129 } |
130 return nullptr; | 130 return nullptr; |
131 } | 131 } |
132 | 132 |
| 133 UiElement* UiScene::GetUiElementByDebugId(UiElementDebugId debug_id) const { |
| 134 DCHECK(debug_id != UiElementDebugId::kNone); |
| 135 for (const auto& element : ui_elements_) { |
| 136 if (element->debug_id() == debug_id) { |
| 137 return element.get(); |
| 138 } |
| 139 } |
| 140 return nullptr; |
| 141 } |
| 142 |
133 std::vector<const UiElement*> UiScene::GetWorldElements() const { | 143 std::vector<const UiElement*> UiScene::GetWorldElements() const { |
134 std::vector<const UiElement*> elements; | 144 std::vector<const UiElement*> elements; |
135 for (const auto& element : ui_elements_) { | 145 for (const auto& element : ui_elements_) { |
136 if (element->IsVisible() && !element->lock_to_fov()) { | 146 if (element->IsVisible() && !element->lock_to_fov()) { |
137 elements.push_back(element.get()); | 147 elements.push_back(element.get()); |
138 } | 148 } |
139 } | 149 } |
140 return elements; | 150 return elements; |
141 } | 151 } |
142 | 152 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 238 |
229 // TODO(mthiesse): Move this to UiSceneManager. | 239 // TODO(mthiesse): Move this to UiSceneManager. |
230 void UiScene::OnGLInitialized() { | 240 void UiScene::OnGLInitialized() { |
231 gl_initialized_ = true; | 241 gl_initialized_ = true; |
232 for (auto& element : ui_elements_) { | 242 for (auto& element : ui_elements_) { |
233 element->Initialize(); | 243 element->Initialize(); |
234 } | 244 } |
235 } | 245 } |
236 | 246 |
237 } // namespace vr_shell | 247 } // namespace vr_shell |
OLD | NEW |