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

Side by Side Diff: chrome/browser/android/vr_shell/ui_scene.cc

Issue 2834543006: Hook up insecure content warnings for http webVR presentation. (Closed)
Patch Set: Add missing files 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 #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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 void UiScene::AddUiElement(std::unique_ptr<UiElement> element) { 56 void UiScene::AddUiElement(std::unique_ptr<UiElement> element) {
57 CHECK_GE(element->id, 0); 57 CHECK_GE(element->id, 0);
58 CHECK_EQ(GetUiElementById(element->id), nullptr); 58 CHECK_EQ(GetUiElementById(element->id), nullptr);
59 if (element->parent_id >= 0) { 59 if (element->parent_id >= 0) {
60 CHECK_NE(GetUiElementById(element->parent_id), nullptr); 60 CHECK_NE(GetUiElementById(element->parent_id), nullptr);
61 } else { 61 } else {
62 CHECK_EQ(element->x_anchoring, XAnchoring::XNONE); 62 CHECK_EQ(element->x_anchoring, XAnchoring::XNONE);
63 CHECK_EQ(element->y_anchoring, YAnchoring::YNONE); 63 CHECK_EQ(element->y_anchoring, YAnchoring::YNONE);
64 } 64 }
65 if (gl_initialized_)
66 element->Initialize();
65 ui_elements_.push_back(std::move(element)); 67 ui_elements_.push_back(std::move(element));
66 } 68 }
67 69
68 void UiScene::RemoveUiElement(int element_id) { 70 void UiScene::RemoveUiElement(int element_id) {
69 for (auto it = ui_elements_.begin(); it != ui_elements_.end(); ++it) { 71 for (auto it = ui_elements_.begin(); it != ui_elements_.end(); ++it) {
70 if ((*it)->id == element_id) { 72 if ((*it)->id == element_id) {
71 if ((*it)->fill == Fill::CONTENT) { 73 if ((*it)->fill == Fill::CONTENT) {
72 content_element_ = nullptr; 74 content_element_ = nullptr;
73 } 75 }
74 ui_elements_.erase(it); 76 ui_elements_.erase(it);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 198
197 element->computed_opacity *= parent->opacity; 199 element->computed_opacity *= parent->opacity;
198 element->computed_lock_to_fov = parent->lock_to_fov; 200 element->computed_lock_to_fov = parent->lock_to_fov;
199 } 201 }
200 202
201 vr::MatrixMul(inheritable->to_world, transform->to_world, 203 vr::MatrixMul(inheritable->to_world, transform->to_world,
202 &transform->to_world); 204 &transform->to_world);
203 element->dirty = false; 205 element->dirty = false;
204 } 206 }
205 207
208 void UiScene::OnGLInitialized() {
209 gl_initialized_ = true;
210 for (const auto& element : ui_elements_) {
cjgrant 2017/04/21 14:30:13 This is another situation where the const should b
mthiesse 2017/04/21 15:05:12 No, because the unique_ptr is constant, but -> doe
cjgrant 2017/04/21 15:19:33 Right. I mean that we shouldn't bother with the c
mthiesse 2017/04/21 17:17:30 Fixed by getting rid of auto so it's not confusing
211 element->Initialize();
212 }
213 }
214
206 } // namespace vr_shell 215 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698