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/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" | 9 #include "chrome/browser/android/vr_shell/color_scheme.h" |
| 10 #include "chrome/browser/android/vr_shell/textures/close_button_texture.h" | 10 #include "chrome/browser/android/vr_shell/textures/close_button_texture.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 element->set_fill(vr_shell::Fill::OPAQUE_GRADIENT); | 248 element->set_fill(vr_shell::Fill::OPAQUE_GRADIENT); |
| 249 element->set_draw_phase(0); | 249 element->set_draw_phase(0); |
| 250 ceiling_ = element.get(); | 250 ceiling_ = element.get(); |
| 251 content_elements_.push_back(element.get()); | 251 content_elements_.push_back(element.get()); |
| 252 scene_->AddUiElement(std::move(element)); | 252 scene_->AddUiElement(std::move(element)); |
| 253 | 253 |
| 254 // Floor grid. | 254 // Floor grid. |
| 255 element = base::MakeUnique<UiElement>(); | 255 element = base::MakeUnique<UiElement>(); |
| 256 element->set_debug_id(kFloorGrid); | 256 element->set_debug_id(kFloorGrid); |
| 257 element->set_id(AllocateId()); | 257 element->set_id(AllocateId()); |
| 258 element->set_fill(vr_shell::Fill::GRID_GRADIENT); | |
| 259 element->set_size({kSceneSize, kSceneSize, 1.0}); | 258 element->set_size({kSceneSize, kSceneSize, 1.0}); |
| 260 element->set_translation({0.0, -kSceneHeight / 2 + kTextureOffset, 0.0}); | 259 element->set_translation({0.0, -kSceneHeight / 2 + kTextureOffset, 0.0}); |
| 261 element->set_rotation({1.0, 0.0, 0.0, -M_PI / 2}); | 260 element->set_rotation({1.0, 0.0, 0.0, -M_PI / 2}); |
| 262 element->set_fill(vr_shell::Fill::GRID_GRADIENT); | 261 element->set_fill(vr_shell::Fill::GRID_GRADIENT); |
| 263 element->set_gridline_count(kFloorGridlineCount); | 262 element->set_gridline_count(kFloorGridlineCount); |
| 263 element->set_center_color(color_scheme().horizon); | |
|
amp
2017/05/26 17:48:20
Aren't all the colors for the background being han
Ian Vollick
2017/05/27 00:30:18
Done.
| |
| 264 element->set_draw_phase(0); | 264 element->set_draw_phase(0); |
| 265 floor_grid_ = element.get(); | 265 floor_grid_ = element.get(); |
| 266 content_elements_.push_back(element.get()); | 266 content_elements_.push_back(element.get()); |
| 267 scene_->AddUiElement(std::move(element)); | 267 scene_->AddUiElement(std::move(element)); |
| 268 | 268 |
| 269 UpdateBackgroundColor(); | 269 UpdateBackgroundColor(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void UiSceneManager::CreateUrlBar() { | 272 void UiSceneManager::CreateUrlBar() { |
| 273 // TODO(cjgrant): Incorporate final size and position. | 273 // TODO(cjgrant): Incorporate final size and position. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 | 376 |
| 377 void UiSceneManager::SetScreenCapturingIndicator(bool enabled) { | 377 void UiSceneManager::SetScreenCapturingIndicator(bool enabled) { |
| 378 // TODO(asimjour) add the indicator and change the visibility here. | 378 // TODO(asimjour) add the indicator and change the visibility here. |
| 379 } | 379 } |
| 380 | 380 |
| 381 void UiSceneManager::SetWebVrSecureOrigin(bool secure) { | 381 void UiSceneManager::SetWebVrSecureOrigin(bool secure) { |
| 382 secure_origin_ = secure; | 382 secure_origin_ = secure; |
| 383 ConfigureSecurityWarnings(); | 383 ConfigureSecurityWarnings(); |
| 384 } | 384 } |
| 385 | 385 |
| 386 void UiSceneManager::SetIncognito(bool incognito) { | |
| 387 const bool needs_update = incognito != incognito_; | |
| 388 incognito_ = incognito; | |
| 389 if (needs_update) | |
| 390 UpdateBackgroundColor(); | |
| 391 url_bar_->SetIncognito(incognito); | |
| 392 } | |
| 393 | |
| 386 void UiSceneManager::OnAppButtonClicked() { | 394 void UiSceneManager::OnAppButtonClicked() { |
| 387 // App button click exits the WebVR presentation and fullscreen. | 395 // App button click exits the WebVR presentation and fullscreen. |
| 388 browser_->ExitPresent(); | 396 browser_->ExitPresent(); |
| 389 browser_->ExitFullscreen(); | 397 browser_->ExitFullscreen(); |
| 390 } | 398 } |
| 391 | 399 |
| 392 void UiSceneManager::OnAppButtonGesturePerformed( | 400 void UiSceneManager::OnAppButtonGesturePerformed( |
| 393 UiInterface::Direction direction) {} | 401 UiInterface::Direction direction) {} |
| 394 | 402 |
| 395 void UiSceneManager::SetFullscreen(bool fullscreen) { | 403 void UiSceneManager::SetFullscreen(bool fullscreen) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 448 | 456 |
| 449 void UiSceneManager::OnCloseButtonClicked() { | 457 void UiSceneManager::OnCloseButtonClicked() { |
| 450 browser_->ExitCct(); | 458 browser_->ExitCct(); |
| 451 } | 459 } |
| 452 | 460 |
| 453 int UiSceneManager::AllocateId() { | 461 int UiSceneManager::AllocateId() { |
| 454 return next_available_id_++; | 462 return next_available_id_++; |
| 455 } | 463 } |
| 456 | 464 |
| 457 const ColorScheme& UiSceneManager::color_scheme() const { | 465 const ColorScheme& UiSceneManager::color_scheme() const { |
| 458 return ColorScheme::GetColorScheme(fullscreen_ ? ColorScheme::kModeFullscreen | 466 if (incognito_) |
| 459 : ColorScheme::kModeNormal); | 467 return ColorScheme::GetColorScheme(ColorScheme::kModeIncognito); |
| 468 if (fullscreen_) | |
| 469 return ColorScheme::GetColorScheme(ColorScheme::kModeFullscreen); | |
| 470 return ColorScheme::GetColorScheme(ColorScheme::kModeNormal); | |
| 460 } | 471 } |
| 461 | 472 |
| 462 } // namespace vr_shell | 473 } // namespace vr_shell |
| OLD | NEW |