Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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_manager.h" | 5 #include "chrome/browser/android/vr_shell/ui_scene_manager.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" | 8 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" |
| 9 #include "chrome/browser/android/vr_shell/ui_elements/permanent_security_warning .h" | 9 #include "chrome/browser/android/vr_shell/ui_elements/permanent_security_warning .h" |
| 10 #include "chrome/browser/android/vr_shell/ui_elements/textured_element.h" | 10 #include "chrome/browser/android/vr_shell/ui_elements/textured_element.h" |
| 11 #include "chrome/browser/android/vr_shell/ui_elements/transient_security_warning .h" | 11 #include "chrome/browser/android/vr_shell/ui_elements/transient_security_warning .h" |
| 12 #include "chrome/browser/android/vr_shell/ui_elements/ui_element.h" | 12 #include "chrome/browser/android/vr_shell/ui_elements/ui_element.h" |
| 13 #include "chrome/browser/android/vr_shell/ui_scene.h" | 13 #include "chrome/browser/android/vr_shell/ui_scene.h" |
| 14 | 14 |
| 15 namespace vr_shell { | 15 namespace vr_shell { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 static constexpr int kWarningTimeoutSeconds = 30; | 19 static constexpr int kWarningTimeoutSeconds = 30; |
| 20 static constexpr float kWarningDistance = 0.7; | 20 static constexpr float kWarningDistance = 0.7; |
| 21 static constexpr float kWarningAngleRadians = 16.3 * M_PI / 180.0; | 21 static constexpr float kWarningAngleRadians = 16.3 * M_PI / 180.0; |
| 22 static constexpr float kPermanentWarningHeight = 0.226; | 22 static constexpr float kPermanentWarningHeight = 0.070f; |
| 23 static constexpr float kPermanentWarningWidth = 0.078; | 23 static constexpr float kPermanentWarningWidth = 0.224f; |
| 24 static constexpr float kTransientWarningHeight = 0.512; | 24 static constexpr float kTransientWarningHeight = 0.160; |
| 25 static constexpr float kTransientWarningWidth = 0.160; | 25 static constexpr float kTransientWarningWidth = 0.512; |
| 26 | 26 |
| 27 static constexpr float kContentWidth = 2.4; | 27 static constexpr float kContentWidth = 2.4; |
| 28 static constexpr float kContentHeight = 1.6; | 28 static constexpr float kContentHeight = 1.6; |
| 29 static constexpr float kContentDistance = 2.5; | 29 static constexpr float kContentDistance = 2.5; |
| 30 static constexpr float kContentVerticalOffset = -0.26; | 30 static constexpr float kContentVerticalOffset = -0.26; |
| 31 static constexpr float kBackplaneSize = 1000.0; | 31 static constexpr float kBackplaneSize = 1000.0; |
| 32 static constexpr float kBackgroundDistanceMultiplier = 1.414; | 32 static constexpr float kBackgroundDistanceMultiplier = 1.414; |
| 33 | 33 |
| 34 static constexpr float kSceneSize = 25.0; | 34 static constexpr float kSceneSize = 25.0; |
| 35 static constexpr float kSceneHeight = 4.0; | 35 static constexpr float kSceneHeight = 4.0; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 | 178 |
| 179 ConfigureSecurityWarnings(); | 179 ConfigureSecurityWarnings(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void UiSceneManager::SetWebVRSecureOrigin(bool secure) { | 182 void UiSceneManager::SetWebVRSecureOrigin(bool secure) { |
| 183 secure_origin_ = secure; | 183 secure_origin_ = secure; |
| 184 ConfigureSecurityWarnings(); | 184 ConfigureSecurityWarnings(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void UiSceneManager::ConfigureSecurityWarnings() { | 187 void UiSceneManager::ConfigureSecurityWarnings() { |
| 188 bool enabled = web_vr_mode_ && !secure_origin_; | 188 bool enabled = web_vr_mode_ && secure_origin_; |
|
amp
2017/04/28 19:36:50
Wait, why are we changing the logic here? It look
mthiesse
2017/04/28 19:42:15
oooops. For debugging, good catch.
| |
| 189 permanent_security_warning_->visible = enabled; | 189 permanent_security_warning_->visible = enabled; |
| 190 transient_security_warning_->visible = enabled; | 190 transient_security_warning_->visible = enabled; |
| 191 if (enabled) { | 191 if (enabled) { |
| 192 security_warning_timer_.Start( | 192 security_warning_timer_.Start( |
| 193 FROM_HERE, base::TimeDelta::FromSeconds(kWarningTimeoutSeconds), this, | 193 FROM_HERE, base::TimeDelta::FromSeconds(kWarningTimeoutSeconds), this, |
| 194 &UiSceneManager::OnSecurityWarningTimer); | 194 &UiSceneManager::OnSecurityWarningTimer); |
| 195 } else { | 195 } else { |
| 196 security_warning_timer_.Stop(); | 196 security_warning_timer_.Stop(); |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 | 199 |
| 200 void UiSceneManager::OnSecurityWarningTimer() { | 200 void UiSceneManager::OnSecurityWarningTimer() { |
| 201 transient_security_warning_->visible = false; | 201 transient_security_warning_->visible = false; |
| 202 } | 202 } |
| 203 | 203 |
| 204 int UiSceneManager::AllocateId() { | 204 int UiSceneManager::AllocateId() { |
| 205 return next_available_id_++; | 205 return next_available_id_++; |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace vr_shell | 208 } // namespace vr_shell |
| OLD | NEW |