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

Unified Diff: chrome/browser/android/vr_shell/ui_scene_manager.cc

Issue 2809143004: VR: Add a native UI element scene manager (Closed)
Patch Set: Rebase. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene_manager.h ('k') | chrome/browser/android/vr_shell/vr_gl_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/ui_scene_manager.cc
diff --git a/chrome/browser/android/vr_shell/ui_scene_manager.cc b/chrome/browser/android/vr_shell/ui_scene_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..543aa48e437854e5ffa63c8a95138f871142c0a5
--- /dev/null
+++ b/chrome/browser/android/vr_shell/ui_scene_manager.cc
@@ -0,0 +1,53 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/android/vr_shell/ui_scene_manager.h"
+
+#include "base/memory/ptr_util.h"
+#include "chrome/browser/android/vr_shell/ui_element.h"
+#include "chrome/browser/android/vr_shell/ui_scene.h"
+
+namespace vr_shell {
+
+namespace {
+
+enum Elements {
+ // For now, use fixed element IDs, and ensure they do not collide with HTML UI
+ // dynamically-chosen ID numbers.
+ SecureOriginWarning = 1000,
+};
+
+} // namespace
+
+UiSceneManager::UiSceneManager(UiScene* scene)
+ : scene_(scene), weak_ptr_factory_(this) {
+ // Create an invisible dummy warning quad. Actual security warnings will come
+ // in a follow-on chance.
+ auto warning = base::MakeUnique<UiElement>();
+ warning->id = Elements::SecureOriginWarning;
+ warning->name = "test quad";
+ warning->translation = {0, 0, -1};
+ warning->fill = vr_shell::Fill::NONE;
+ scene_->AddUiElement(std::move(warning));
+}
+
+UiSceneManager::~UiSceneManager() {}
+
+base::WeakPtr<UiSceneManager> UiSceneManager::GetWeakPtr() {
+ return weak_ptr_factory_.GetWeakPtr();
+}
+
+void UiSceneManager::UpdateScene(std::unique_ptr<base::ListValue> commands) {
+ scene_->HandleCommands(std::move(commands), base::TimeTicks::Now());
+}
+
+void UiSceneManager::SetWebVRMode(bool web_vr) {
+ web_vr_mode_ = web_vr;
+}
+
+void UiSceneManager::SetWebVRSecureOrigin(bool secure) {
+ secure_origin_ = secure;
+}
+
+} // namespace vr_shell
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene_manager.h ('k') | chrome/browser/android/vr_shell/vr_gl_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698