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

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

Issue 2866853002: VR: Wire VrShell UI-related state to the scene manager. (Closed)
Patch Set: Rebase; remove now-unused source file. 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/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/transient_security_warning .h" 10 #include "chrome/browser/android/vr_shell/ui_elements/transient_security_warning .h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 static constexpr vr::Colorf kCctBackgroundHorizonColor = {0.2, 0.6, 0.2, 1.0}; 49 static constexpr vr::Colorf kCctBackgroundHorizonColor = {0.2, 0.6, 0.2, 1.0};
50 static constexpr vr::Colorf kCctBackgroundCenterColor = {0.13, 0.52, 0.13, 1.0}; 50 static constexpr vr::Colorf kCctBackgroundCenterColor = {0.13, 0.52, 0.13, 1.0};
51 51
52 // Tiny distance to offset textures that should appear in the same plane. 52 // Tiny distance to offset textures that should appear in the same plane.
53 static constexpr float kTextureOffset = 0.01; 53 static constexpr float kTextureOffset = 0.01;
54 54
55 } // namespace 55 } // namespace
56 56
57 UiSceneManager::UiSceneManager(VrBrowserInterface* browser, 57 UiSceneManager::UiSceneManager(VrBrowserInterface* browser,
58 UiScene* scene, 58 UiScene* scene,
59 bool in_cct) 59 bool in_cct,
60 bool in_web_vr)
60 : browser_(browser), 61 : browser_(browser),
61 scene_(scene), 62 scene_(scene),
62 in_cct_(in_cct), 63 in_cct_(in_cct),
64 web_vr_mode_(in_web_vr),
63 weak_ptr_factory_(this) { 65 weak_ptr_factory_(this) {
64 CreateBackground(); 66 CreateBackground();
65 CreateContentQuad(); 67 CreateContentQuad();
66 CreateSecurityWarnings(); 68 CreateSecurityWarnings();
67 CreateUrlBar(); 69 CreateUrlBar();
68 } 70 }
69 71
70 UiSceneManager::~UiSceneManager() {} 72 UiSceneManager::~UiSceneManager() {}
71 73
72 void UiSceneManager::CreateSecurityWarnings() { 74 void UiSceneManager::CreateSecurityWarnings() {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 element->set_size({0.9, 0, 1}); 196 element->set_size({0.9, 0, 1});
195 url_bar_ = element.get(); 197 url_bar_ = element.get();
196 browser_ui_elements_.push_back(element.get()); 198 browser_ui_elements_.push_back(element.get());
197 scene_->AddUiElement(std::move(element)); 199 scene_->AddUiElement(std::move(element));
198 } 200 }
199 201
200 base::WeakPtr<UiSceneManager> UiSceneManager::GetWeakPtr() { 202 base::WeakPtr<UiSceneManager> UiSceneManager::GetWeakPtr() {
201 return weak_ptr_factory_.GetWeakPtr(); 203 return weak_ptr_factory_.GetWeakPtr();
202 } 204 }
203 205
204 void UiSceneManager::SetWebVRMode(bool web_vr) { 206 void UiSceneManager::SetWebVrMode(bool web_vr) {
205 web_vr_mode_ = web_vr; 207 web_vr_mode_ = web_vr;
206 208
207 // Make all VR scene UI elements visible if not in WebVR. 209 // Make all VR scene UI elements visible if not in WebVR.
208 for (UiElement* element : browser_ui_elements_) { 210 for (UiElement* element : browser_ui_elements_) {
209 element->set_visible(!web_vr_mode_); 211 element->set_visible(!web_vr_mode_);
210 } 212 }
211 213
212 ConfigureSecurityWarnings(); 214 ConfigureSecurityWarnings();
213 } 215 }
214 216
215 void UiSceneManager::SetWebVRSecureOrigin(bool secure) { 217 void UiSceneManager::SetWebVrSecureOrigin(bool secure) {
216 secure_origin_ = secure; 218 secure_origin_ = secure;
217 ConfigureSecurityWarnings(); 219 ConfigureSecurityWarnings();
218 } 220 }
219 221
220 void UiSceneManager::OnAppButtonClicked() { 222 void UiSceneManager::OnAppButtonClicked() {
221 // Pressing the app button currenly pauses content rendering. Note: its still 223 // Pressing the app button currenly pauses content rendering. Note: its still
222 // unclear what we want to do here and this will most likely change. 224 // unclear what we want to do here and this will most likely change.
223 content_rendering_enabled_ = !content_rendering_enabled_; 225 content_rendering_enabled_ = !content_rendering_enabled_;
224 scene_->SetWebVrRenderingEnabled(content_rendering_enabled_); 226 scene_->SetWebVrRenderingEnabled(content_rendering_enabled_);
225 browser_->OnContentPaused(!content_rendering_enabled_); 227 browser_->OnContentPaused(!content_rendering_enabled_);
226 } 228 }
227 229
228 void UiSceneManager::OnFullscreenChanged(bool fullscreen) { 230 void UiSceneManager::OnAppButtonGesturePerformed(
231 UiInterface::Direction direction) {}
232
233 void UiSceneManager::SetFullscreen(bool fullscreen) {
229 // Make all VR scene UI elements visible if not in WebVR or fullscreen. 234 // Make all VR scene UI elements visible if not in WebVR or fullscreen.
230 for (UiElement* element : browser_ui_elements_) { 235 for (UiElement* element : browser_ui_elements_) {
231 element->set_visible(!fullscreen); 236 element->set_visible(!fullscreen);
232 } 237 }
233 238
234 // Show the content quad in full screen. 239 // Show the content quad in full screen.
235 if (fullscreen) { 240 if (fullscreen) {
236 scene_->SetBackgroundColor(kFullscreenBackgroundColor); 241 scene_->SetBackgroundColor(kFullscreenBackgroundColor);
237 main_content_->set_visible(true); 242 main_content_->set_visible(true);
238 main_content_->set_translation( 243 main_content_->set_translation(
(...skipping 23 matching lines...) Expand all
262 &UiSceneManager::OnSecurityWarningTimer); 267 &UiSceneManager::OnSecurityWarningTimer);
263 } else { 268 } else {
264 security_warning_timer_.Stop(); 269 security_warning_timer_.Stop();
265 } 270 }
266 } 271 }
267 272
268 void UiSceneManager::OnSecurityWarningTimer() { 273 void UiSceneManager::OnSecurityWarningTimer() {
269 transient_security_warning_->set_visible(false); 274 transient_security_warning_->set_visible(false);
270 } 275 }
271 276
272 void UiSceneManager::OnUrlChange(const GURL& gurl) { 277 void UiSceneManager::SetURL(const GURL& gurl) {
273 url_bar_->SetURL(gurl); 278 url_bar_->SetURL(gurl);
274 } 279 }
275 280
281 void UiSceneManager::SetSecurityLevel(int level) {}
282
283 void UiSceneManager::SetLoading(bool loading) {}
284
285 void UiSceneManager::SetLoadProgress(double progress) {}
286
287 void UiSceneManager::SetHistoryButtonsEnabled(bool can_go_back,
288 bool can_go_forward) {}
289
276 int UiSceneManager::AllocateId() { 290 int UiSceneManager::AllocateId() {
277 return next_available_id_++; 291 return next_available_id_++;
278 } 292 }
279 293
280 } // namespace vr_shell 294 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene_manager.h ('k') | chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698