Chromium Code Reviews| 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::GetUiElementByIdentifier( | |
|
Ian Vollick
2017/05/19 14:42:32
nit/bikeshed: Id and Identifier are pretty close.
cjgrant
2017/05/19 15:10:40
Sure. I'll adapt that when we close on the NDEBUG
| |
| 134 UiElementIdentifier identifier) const { | |
| 135 DCHECK(identifier != UiElementIdentifier::kNone); | |
| 136 for (const auto& element : ui_elements_) { | |
| 137 if (element->identifier() == identifier) { | |
| 138 return element.get(); | |
| 139 } | |
| 140 } | |
| 141 return nullptr; | |
| 142 } | |
| 143 | |
| 133 std::vector<const UiElement*> UiScene::GetWorldElements() const { | 144 std::vector<const UiElement*> UiScene::GetWorldElements() const { |
| 134 std::vector<const UiElement*> elements; | 145 std::vector<const UiElement*> elements; |
| 135 for (const auto& element : ui_elements_) { | 146 for (const auto& element : ui_elements_) { |
| 136 if (element->IsVisible() && !element->lock_to_fov()) { | 147 if (element->IsVisible() && !element->lock_to_fov()) { |
| 137 elements.push_back(element.get()); | 148 elements.push_back(element.get()); |
| 138 } | 149 } |
| 139 } | 150 } |
| 140 return elements; | 151 return elements; |
| 141 } | 152 } |
| 142 | 153 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 | 239 |
| 229 // TODO(mthiesse): Move this to UiSceneManager. | 240 // TODO(mthiesse): Move this to UiSceneManager. |
| 230 void UiScene::OnGLInitialized() { | 241 void UiScene::OnGLInitialized() { |
| 231 gl_initialized_ = true; | 242 gl_initialized_ = true; |
| 232 for (auto& element : ui_elements_) { | 243 for (auto& element : ui_elements_) { |
| 233 element->Initialize(); | 244 element->Initialize(); |
| 234 } | 245 } |
| 235 } | 246 } |
| 236 | 247 |
| 237 } // namespace vr_shell | 248 } // namespace vr_shell |
| OLD | NEW |