| OLD | NEW |
| (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 |
| OLD | NEW |