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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/android/vr_shell/ui_scene_manager.h"
6
7 #include "base/memory/ptr_util.h"
8 #include "chrome/browser/android/vr_shell/ui_element.h"
9 #include "chrome/browser/android/vr_shell/ui_scene.h"
10
11 namespace vr_shell {
12
13 namespace {
14
15 enum Elements {
16 // For now, use fixed element IDs, and ensure they do not collide with HTML UI
17 // dynamically-chosen ID numbers.
18 SecureOriginWarning = 1000,
19 };
20
21 } // namespace
22
23 UiSceneManager::UiSceneManager(UiScene* scene)
24 : scene_(scene), weak_ptr_factory_(this) {
25 // Create an invisible dummy warning quad. Actual security warnings will come
26 // in a follow-on chance.
27 auto warning = base::MakeUnique<UiElement>();
28 warning->id = Elements::SecureOriginWarning;
29 warning->name = "test quad";
30 warning->translation = {0, 0, -1};
31 warning->fill = vr_shell::Fill::NONE;
32 scene_->AddUiElement(std::move(warning));
33 }
34
35 UiSceneManager::~UiSceneManager() {}
36
37 base::WeakPtr<UiSceneManager> UiSceneManager::GetWeakPtr() {
38 return weak_ptr_factory_.GetWeakPtr();
39 }
40
41 void UiSceneManager::UpdateScene(std::unique_ptr<base::ListValue> commands) {
42 scene_->HandleCommands(std::move(commands), base::TimeTicks::Now());
43 }
44
45 void UiSceneManager::SetWebVRMode(bool web_vr) {
46 web_vr_mode_ = web_vr;
47 }
48
49 void UiSceneManager::SetWebVRSecureOrigin(bool secure) {
50 secure_origin_ = secure;
51 }
52
53 } // namespace vr_shell
OLDNEW
« 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