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

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

Issue 2888283005: VR: Fix HTTP warning staying visible after exiting WebVR. (Closed)
Patch Set: Created 3 years, 7 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 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/callback.h" 7 #include "base/callback.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "chrome/browser/android/vr_shell/textures/close_button_texture.h" 9 #include "chrome/browser/android/vr_shell/textures/close_button_texture.h"
10 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" 10 #include "chrome/browser/android/vr_shell/textures/ui_texture.h"
11 #include "chrome/browser/android/vr_shell/ui_elements/audio_capture_indicator.h" 11 #include "chrome/browser/android/vr_shell/ui_elements/audio_capture_indicator.h"
12 #include "chrome/browser/android/vr_shell/ui_elements/button.h" 12 #include "chrome/browser/android/vr_shell/ui_elements/button.h"
13 #include "chrome/browser/android/vr_shell/ui_elements/loading_indicator.h" 13 #include "chrome/browser/android/vr_shell/ui_elements/loading_indicator.h"
14 #include "chrome/browser/android/vr_shell/ui_elements/permanent_security_warning .h" 14 #include "chrome/browser/android/vr_shell/ui_elements/permanent_security_warning .h"
15 #include "chrome/browser/android/vr_shell/ui_elements/transient_security_warning .h" 15 #include "chrome/browser/android/vr_shell/ui_elements/transient_security_warning .h"
16 #include "chrome/browser/android/vr_shell/ui_elements/ui_element.h" 16 #include "chrome/browser/android/vr_shell/ui_elements/ui_element.h"
17 #include "chrome/browser/android/vr_shell/ui_elements/ui_element_identifiers.h"
17 #include "chrome/browser/android/vr_shell/ui_elements/url_bar.h" 18 #include "chrome/browser/android/vr_shell/ui_elements/url_bar.h"
18 #include "chrome/browser/android/vr_shell/ui_elements/video_capture_indicator.h" 19 #include "chrome/browser/android/vr_shell/ui_elements/video_capture_indicator.h"
19 #include "chrome/browser/android/vr_shell/ui_scene.h" 20 #include "chrome/browser/android/vr_shell/ui_scene.h"
20 #include "chrome/browser/android/vr_shell/vr_browser_interface.h" 21 #include "chrome/browser/android/vr_shell/vr_browser_interface.h"
21 #include "chrome/browser/android/vr_shell/vr_shell.h" 22 #include "chrome/browser/android/vr_shell/vr_shell.h"
22 23
23 namespace vr_shell { 24 namespace vr_shell {
24 25
25 namespace { 26 namespace {
26 27
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 weak_ptr_factory_(this) { 78 weak_ptr_factory_(this) {
78 CreateBackground(); 79 CreateBackground();
79 CreateContentQuad(); 80 CreateContentQuad();
80 CreateSecurityWarnings(); 81 CreateSecurityWarnings();
81 CreateSystemIndicators(); 82 CreateSystemIndicators();
82 CreateUrlBar(); 83 CreateUrlBar();
83 if (in_cct_) 84 if (in_cct_)
84 CreateCloseButton(); 85 CreateCloseButton();
85 86
86 ConfigureScene(); 87 ConfigureScene();
88 ConfigureSecurityWarnings();
87 } 89 }
88 90
89 UiSceneManager::~UiSceneManager() {} 91 UiSceneManager::~UiSceneManager() {}
90 92
91 void UiSceneManager::CreateSecurityWarnings() { 93 void UiSceneManager::CreateSecurityWarnings() {
92 std::unique_ptr<UiElement> element; 94 std::unique_ptr<UiElement> element;
93 95
94 // TODO(mthiesse): Programatically compute the proper texture size for these 96 // TODO(mthiesse): Programatically compute the proper texture size for these
95 // textured UI elements. 97 // textured UI elements.
96 element = base::MakeUnique<PermanentSecurityWarning>(512); 98 element = base::MakeUnique<PermanentSecurityWarning>(512);
99 element->set_identifier(kWebVrPermanentHttpSecurityWarning);
97 element->set_id(AllocateId()); 100 element->set_id(AllocateId());
98 element->set_fill(vr_shell::Fill::NONE); 101 element->set_fill(vr_shell::Fill::NONE);
99 element->set_size({kPermanentWarningWidth, kPermanentWarningHeight, 1}); 102 element->set_size({kPermanentWarningWidth, kPermanentWarningHeight, 1});
100 element->set_scale({kWarningDistance, kWarningDistance, 1}); 103 element->set_scale({kWarningDistance, kWarningDistance, 1});
101 element->set_translation( 104 element->set_translation(
102 gfx::Vector3dF(0, kWarningDistance * sin(kWarningAngleRadians), 105 gfx::Vector3dF(0, kWarningDistance * sin(kWarningAngleRadians),
103 -kWarningDistance * cos(kWarningAngleRadians))); 106 -kWarningDistance * cos(kWarningAngleRadians)));
104 element->set_rotation({1.0f, 0, 0, kWarningAngleRadians}); 107 element->set_rotation({1.0f, 0, 0, kWarningAngleRadians});
105 element->set_visible(false); 108 element->set_visible(false);
106 element->set_hit_testable(false); 109 element->set_hit_testable(false);
107 element->set_lock_to_fov(true); 110 element->set_lock_to_fov(true);
108 permanent_security_warning_ = element.get(); 111 permanent_security_warning_ = element.get();
109 scene_->AddUiElement(std::move(element)); 112 scene_->AddUiElement(std::move(element));
110 113
111 element = base::MakeUnique<TransientSecurityWarning>(1024); 114 element = base::MakeUnique<TransientSecurityWarning>(1024);
115 element->set_identifier(kWebVrTransientHttpSecurityWarning);
112 element->set_id(AllocateId()); 116 element->set_id(AllocateId());
113 element->set_fill(vr_shell::Fill::NONE); 117 element->set_fill(vr_shell::Fill::NONE);
114 element->set_size({kTransientWarningWidth, kTransientWarningHeight, 1}); 118 element->set_size({kTransientWarningWidth, kTransientWarningHeight, 1});
115 element->set_scale({kWarningDistance, kWarningDistance, 1}); 119 element->set_scale({kWarningDistance, kWarningDistance, 1});
116 element->set_translation({0, 0, -kWarningDistance}); 120 element->set_translation({0, 0, -kWarningDistance});
117 element->set_visible(false); 121 element->set_visible(false);
118 element->set_hit_testable(false); 122 element->set_hit_testable(false);
119 element->set_lock_to_fov(true); 123 element->set_lock_to_fov(true);
120 transient_security_warning_ = element.get(); 124 transient_security_warning_ = element.get();
121 scene_->AddUiElement(std::move(element)); 125 scene_->AddUiElement(std::move(element));
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 265
262 base::WeakPtr<UiSceneManager> UiSceneManager::GetWeakPtr() { 266 base::WeakPtr<UiSceneManager> UiSceneManager::GetWeakPtr() {
263 return weak_ptr_factory_.GetWeakPtr(); 267 return weak_ptr_factory_.GetWeakPtr();
264 } 268 }
265 269
266 void UiSceneManager::SetWebVrMode(bool web_vr) { 270 void UiSceneManager::SetWebVrMode(bool web_vr) {
267 if (web_vr_mode_ == web_vr) 271 if (web_vr_mode_ == web_vr)
268 return; 272 return;
269 web_vr_mode_ = web_vr; 273 web_vr_mode_ = web_vr;
270 ConfigureScene(); 274 ConfigureScene();
275 ConfigureSecurityWarnings();
271 } 276 }
272 277
273 void UiSceneManager::ConfigureScene() { 278 void UiSceneManager::ConfigureScene() {
274 // Controls (URL bar, loading progress, etc). 279 // Controls (URL bar, loading progress, etc).
275 bool controls_visible = !web_vr_mode_ && !fullscreen_; 280 bool controls_visible = !web_vr_mode_ && !fullscreen_;
276 for (UiElement* element : control_elements_) { 281 for (UiElement* element : control_elements_) {
277 element->SetEnabled(controls_visible); 282 element->SetEnabled(controls_visible);
278 } 283 }
279 284
280 // Content elements. 285 // Content elements.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 void UiSceneManager::SetHistoryButtonsEnabled(bool can_go_back, 379 void UiSceneManager::SetHistoryButtonsEnabled(bool can_go_back,
375 bool can_go_forward) {} 380 bool can_go_forward) {}
376 381
377 void UiSceneManager::OnCloseButtonClicked() {} 382 void UiSceneManager::OnCloseButtonClicked() {}
378 383
379 int UiSceneManager::AllocateId() { 384 int UiSceneManager::AllocateId() {
380 return next_available_id_++; 385 return next_available_id_++;
381 } 386 }
382 387
383 } // namespace vr_shell 388 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698