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

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

Issue 2902043005: [vr] Add incognito coloring (Closed)
Patch Set: . Created 3 years, 6 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/color_scheme.h"
10 #include "chrome/browser/android/vr_shell/textures/close_button_texture.h" 9 #include "chrome/browser/android/vr_shell/textures/close_button_texture.h"
11 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" 10 #include "chrome/browser/android/vr_shell/textures/ui_texture.h"
12 #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"
13 #include "chrome/browser/android/vr_shell/ui_elements/button.h" 12 #include "chrome/browser/android/vr_shell/ui_elements/button.h"
14 #include "chrome/browser/android/vr_shell/ui_elements/exit_warning.h" 13 #include "chrome/browser/android/vr_shell/ui_elements/exit_warning.h"
15 #include "chrome/browser/android/vr_shell/ui_elements/loading_indicator.h" 14 #include "chrome/browser/android/vr_shell/ui_elements/loading_indicator.h"
16 #include "chrome/browser/android/vr_shell/ui_elements/permanent_security_warning .h" 15 #include "chrome/browser/android/vr_shell/ui_elements/permanent_security_warning .h"
17 #include "chrome/browser/android/vr_shell/ui_elements/screen_capture_indicator.h " 16 #include "chrome/browser/android/vr_shell/ui_elements/screen_capture_indicator.h "
18 #include "chrome/browser/android/vr_shell/ui_elements/screen_dimmer.h" 17 #include "chrome/browser/android/vr_shell/ui_elements/screen_dimmer.h"
19 #include "chrome/browser/android/vr_shell/ui_elements/transient_security_warning .h" 18 #include "chrome/browser/android/vr_shell/ui_elements/transient_security_warning .h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 element->set_fill(vr_shell::Fill::OPAQUE_GRADIENT); 247 element->set_fill(vr_shell::Fill::OPAQUE_GRADIENT);
249 element->set_draw_phase(0); 248 element->set_draw_phase(0);
250 ceiling_ = element.get(); 249 ceiling_ = element.get();
251 content_elements_.push_back(element.get()); 250 content_elements_.push_back(element.get());
252 scene_->AddUiElement(std::move(element)); 251 scene_->AddUiElement(std::move(element));
253 252
254 // Floor grid. 253 // Floor grid.
255 element = base::MakeUnique<UiElement>(); 254 element = base::MakeUnique<UiElement>();
256 element->set_debug_id(kFloorGrid); 255 element->set_debug_id(kFloorGrid);
257 element->set_id(AllocateId()); 256 element->set_id(AllocateId());
258 element->set_fill(vr_shell::Fill::GRID_GRADIENT);
259 element->set_size({kSceneSize, kSceneSize, 1.0}); 257 element->set_size({kSceneSize, kSceneSize, 1.0});
260 element->set_translation({0.0, -kSceneHeight / 2 + kTextureOffset, 0.0}); 258 element->set_translation({0.0, -kSceneHeight / 2 + kTextureOffset, 0.0});
261 element->set_rotation({1.0, 0.0, 0.0, -M_PI / 2}); 259 element->set_rotation({1.0, 0.0, 0.0, -M_PI / 2});
262 element->set_fill(vr_shell::Fill::GRID_GRADIENT); 260 element->set_fill(vr_shell::Fill::GRID_GRADIENT);
263 element->set_gridline_count(kFloorGridlineCount); 261 element->set_gridline_count(kFloorGridlineCount);
264 element->set_draw_phase(0); 262 element->set_draw_phase(0);
265 floor_grid_ = element.get(); 263 floor_grid_ = element.get();
266 content_elements_.push_back(element.get()); 264 content_elements_.push_back(element.get());
267 scene_->AddUiElement(std::move(element)); 265 scene_->AddUiElement(std::move(element));
268 266
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 main_content_->set_translation( 343 main_content_->set_translation(
346 {0, kFullscreenVerticalOffset, -kFullscreenDistance}); 344 {0, kFullscreenVerticalOffset, -kFullscreenDistance});
347 main_content_->set_size({kFullscreenWidth, kFullscreenHeight, 1}); 345 main_content_->set_size({kFullscreenWidth, kFullscreenHeight, 1});
348 } else { 346 } else {
349 // Note that main_content_ is already visible in this case. 347 // Note that main_content_ is already visible in this case.
350 main_content_->set_translation( 348 main_content_->set_translation(
351 {0, kContentVerticalOffset, -kContentDistance}); 349 {0, kContentVerticalOffset, -kContentDistance});
352 main_content_->set_size({kContentWidth, kContentHeight, 1}); 350 main_content_->set_size({kContentWidth, kContentHeight, 1});
353 } 351 }
354 352
355 UpdateBackgroundColor(); 353 scene_->SetMode(mode());
356 scene_->SetBackgroundDistance(main_content_->translation().z() * 354 scene_->SetBackgroundDistance(main_content_->translation().z() *
357 -kBackgroundDistanceMultiplier); 355 -kBackgroundDistanceMultiplier);
356 UpdateBackgroundColor();
358 } 357 }
359 358
360 void UiSceneManager::UpdateBackgroundColor() { 359 void UiSceneManager::UpdateBackgroundColor() {
361 scene_->SetBackgroundColor(color_scheme().horizon); 360 // TODO(vollick): it would be nice if ceiling, floor and the grid were
361 // UiElement subclasses and could respond to the OnSetMode signal.
362 ceiling_->set_center_color(color_scheme().ceiling); 362 ceiling_->set_center_color(color_scheme().ceiling);
363 ceiling_->set_edge_color(color_scheme().horizon); 363 ceiling_->set_edge_color(color_scheme().horizon);
364 floor_->set_center_color(color_scheme().floor); 364 floor_->set_center_color(color_scheme().floor);
365 floor_->set_edge_color(color_scheme().horizon); 365 floor_->set_edge_color(color_scheme().horizon);
366 floor_grid_->set_center_color(color_scheme().floor_grid); 366 floor_grid_->set_center_color(color_scheme().floor_grid);
367 SkColor floor_grid_edge_color = SkColorSetA(color_scheme().floor_grid, 0); 367 SkColor floor_grid_edge_color = SkColorSetA(color_scheme().floor_grid, 0);
368 floor_grid_->set_edge_color(floor_grid_edge_color); 368 floor_grid_->set_edge_color(floor_grid_edge_color);
369 floor_grid_->set_center_color(color_scheme().horizon);
amp 2017/05/27 00:47:47 wait, why are we setting this to horizon? We just
Ian Vollick 2017/05/27 01:29:12 Whoops. Fixed.
369 } 370 }
370 371
371 void UiSceneManager::SetAudioCapturingIndicator(bool enabled) { 372 void UiSceneManager::SetAudioCapturingIndicator(bool enabled) {
372 audio_capturing_ = enabled; 373 audio_capturing_ = enabled;
373 audio_capture_indicator_->set_visible(enabled && !web_vr_mode_); 374 audio_capture_indicator_->set_visible(enabled && !web_vr_mode_);
374 } 375 }
375 376
376 void UiSceneManager::SetVideoCapturingIndicator(bool enabled) { 377 void UiSceneManager::SetVideoCapturingIndicator(bool enabled) {
377 video_capturing_ = enabled; 378 video_capturing_ = enabled;
378 video_capture_indicator_->set_visible(enabled && !web_vr_mode_); 379 video_capture_indicator_->set_visible(enabled && !web_vr_mode_);
379 } 380 }
380 381
381 void UiSceneManager::SetScreenCapturingIndicator(bool enabled) { 382 void UiSceneManager::SetScreenCapturingIndicator(bool enabled) {
382 screen_capturing_ = enabled; 383 screen_capturing_ = enabled;
383 screen_capture_indicator_->set_visible(enabled && !web_vr_mode_); 384 screen_capture_indicator_->set_visible(enabled && !web_vr_mode_);
384 } 385 }
385 386
386 void UiSceneManager::SetWebVrSecureOrigin(bool secure) { 387 void UiSceneManager::SetWebVrSecureOrigin(bool secure) {
387 secure_origin_ = secure; 388 secure_origin_ = secure;
388 ConfigureSecurityWarnings(); 389 ConfigureSecurityWarnings();
389 } 390 }
390 391
392 void UiSceneManager::SetIncognito(bool incognito) {
393 if (incognito == incognito_)
394 return;
395 incognito_ = incognito;
396 ConfigureScene();
397 }
398
391 void UiSceneManager::OnAppButtonClicked() { 399 void UiSceneManager::OnAppButtonClicked() {
392 // App button click exits the WebVR presentation and fullscreen. 400 // App button click exits the WebVR presentation and fullscreen.
393 browser_->ExitPresent(); 401 browser_->ExitPresent();
394 browser_->ExitFullscreen(); 402 browser_->ExitFullscreen();
395 } 403 }
396 404
397 void UiSceneManager::OnAppButtonGesturePerformed( 405 void UiSceneManager::OnAppButtonGesturePerformed(
398 UiInterface::Direction direction) {} 406 UiInterface::Direction direction) {}
399 407
400 void UiSceneManager::SetFullscreen(bool fullscreen) { 408 void UiSceneManager::SetFullscreen(bool fullscreen) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 bool can_go_forward) {} 460 bool can_go_forward) {}
453 461
454 void UiSceneManager::OnCloseButtonClicked() { 462 void UiSceneManager::OnCloseButtonClicked() {
455 browser_->ExitCct(); 463 browser_->ExitCct();
456 } 464 }
457 465
458 int UiSceneManager::AllocateId() { 466 int UiSceneManager::AllocateId() {
459 return next_available_id_++; 467 return next_available_id_++;
460 } 468 }
461 469
470 ColorScheme::Mode UiSceneManager::mode() const {
471 if (incognito_)
472 return ColorScheme::kModeIncognito;
473 if (fullscreen_)
474 return ColorScheme::kModeFullscreen;
475 return ColorScheme::kModeNormal;
476 }
477
462 const ColorScheme& UiSceneManager::color_scheme() const { 478 const ColorScheme& UiSceneManager::color_scheme() const {
463 return ColorScheme::GetColorScheme(fullscreen_ ? ColorScheme::kModeFullscreen 479 return ColorScheme::GetColorScheme(mode());
464 : ColorScheme::kModeNormal);
465 } 480 }
466 481
467 } // namespace vr_shell 482 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698