| 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/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/content_backplane.h" |
| 13 #include "chrome/browser/android/vr_shell/ui_elements/exit_prompt.h" | 14 #include "chrome/browser/android/vr_shell/ui_elements/exit_prompt.h" |
| 14 #include "chrome/browser/android/vr_shell/ui_elements/exit_warning.h" | 15 #include "chrome/browser/android/vr_shell/ui_elements/exit_warning.h" |
| 15 #include "chrome/browser/android/vr_shell/ui_elements/loading_indicator.h" | 16 #include "chrome/browser/android/vr_shell/ui_elements/loading_indicator.h" |
| 16 #include "chrome/browser/android/vr_shell/ui_elements/permanent_security_warning
.h" | 17 #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
" | 18 #include "chrome/browser/android/vr_shell/ui_elements/screen_capture_indicator.h
" |
| 18 #include "chrome/browser/android/vr_shell/ui_elements/screen_dimmer.h" | 19 #include "chrome/browser/android/vr_shell/ui_elements/screen_dimmer.h" |
| 19 #include "chrome/browser/android/vr_shell/ui_elements/transient_security_warning
.h" | 20 #include "chrome/browser/android/vr_shell/ui_elements/transient_security_warning
.h" |
| 20 #include "chrome/browser/android/vr_shell/ui_elements/ui_element.h" | 21 #include "chrome/browser/android/vr_shell/ui_elements/ui_element.h" |
| 21 #include "chrome/browser/android/vr_shell/ui_elements/ui_element_debug_id.h" | 22 #include "chrome/browser/android/vr_shell/ui_elements/ui_element_debug_id.h" |
| 22 #include "chrome/browser/android/vr_shell/ui_elements/url_bar.h" | 23 #include "chrome/browser/android/vr_shell/ui_elements/url_bar.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 element->set_fill(vr_shell::Fill::CONTENT); | 207 element->set_fill(vr_shell::Fill::CONTENT); |
| 207 element->set_size({kContentWidth, kContentHeight, 1}); | 208 element->set_size({kContentWidth, kContentHeight, 1}); |
| 208 element->set_translation({0, kContentVerticalOffset, -kContentDistance}); | 209 element->set_translation({0, kContentVerticalOffset, -kContentDistance}); |
| 209 element->set_visible(false); | 210 element->set_visible(false); |
| 210 main_content_ = element.get(); | 211 main_content_ = element.get(); |
| 211 content_elements_.push_back(element.get()); | 212 content_elements_.push_back(element.get()); |
| 212 scene_->AddUiElement(std::move(element)); | 213 scene_->AddUiElement(std::move(element)); |
| 213 | 214 |
| 214 // Place an invisible but hittable plane behind the content quad, to keep the | 215 // Place an invisible but hittable plane behind the content quad, to keep the |
| 215 // reticle roughly planar with the content if near content. | 216 // reticle roughly planar with the content if near content. |
| 216 element = base::MakeUnique<UiElement>(); | 217 element = base::MakeUnique<ContentBackplane>( |
| 218 base::Bind(&UiSceneManager::OnBackplaneClicked, base::Unretained(this))); |
| 217 element->set_debug_id(kBackplane); | 219 element->set_debug_id(kBackplane); |
| 218 element->set_id(AllocateId()); | 220 element->set_id(AllocateId()); |
| 219 element->set_fill(vr_shell::Fill::NONE); | 221 element->set_fill(vr_shell::Fill::NONE); |
| 220 element->set_size({kBackplaneSize, kBackplaneSize, 1.0}); | 222 element->set_size({kBackplaneSize, kBackplaneSize, 1.0}); |
| 221 element->set_translation({0.0, 0.0, -kTextureOffset}); | 223 element->set_translation({0.0, 0.0, -kTextureOffset}); |
| 222 element->set_parent_id(main_content_->id()); | 224 element->set_parent_id(main_content_->id()); |
| 223 main_content_backplane_ = element.get(); | 225 main_content_backplane_ = element.get(); |
| 224 content_elements_.push_back(element.get()); | 226 content_elements_.push_back(element.get()); |
| 225 scene_->AddUiElement(std::move(element)); | 227 scene_->AddUiElement(std::move(element)); |
| 226 | 228 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 browser_->NavigateBack(); | 452 browser_->NavigateBack(); |
| 451 } | 453 } |
| 452 | 454 |
| 453 void UiSceneManager::OnSecurityIconClicked() { | 455 void UiSceneManager::OnSecurityIconClicked() { |
| 454 if (scene_->is_prompting_to_exit()) | 456 if (scene_->is_prompting_to_exit()) |
| 455 return; | 457 return; |
| 456 scene_->set_is_prompting_to_exit(true); | 458 scene_->set_is_prompting_to_exit(true); |
| 457 ConfigureScene(); | 459 ConfigureScene(); |
| 458 } | 460 } |
| 459 | 461 |
| 460 void UiSceneManager::OnExitPromptPrimaryButtonClicked() { | 462 void UiSceneManager::OnBackplaneClicked() { |
| 463 CloseExitPrompt(); |
| 464 } |
| 465 |
| 466 void UiSceneManager::CloseExitPrompt() { |
| 461 if (!scene_->is_prompting_to_exit()) | 467 if (!scene_->is_prompting_to_exit()) |
| 462 return; | 468 return; |
| 463 scene_->set_is_prompting_to_exit(false); | 469 scene_->set_is_prompting_to_exit(false); |
| 464 ConfigureScene(); | 470 ConfigureScene(); |
| 465 } | 471 } |
| 466 | 472 |
| 473 void UiSceneManager::OnExitPromptPrimaryButtonClicked() { |
| 474 CloseExitPrompt(); |
| 475 } |
| 476 |
| 467 void UiSceneManager::OnExitPromptSecondaryButtonClicked() { | 477 void UiSceneManager::OnExitPromptSecondaryButtonClicked() { |
| 468 OnUnsupportedMode(UiUnsupportedMode::kUnhandledPageInfo); | 478 OnUnsupportedMode(UiUnsupportedMode::kUnhandledPageInfo); |
| 469 } | 479 } |
| 470 | 480 |
| 471 void UiSceneManager::SetURL(const GURL& gurl) { | 481 void UiSceneManager::SetURL(const GURL& gurl) { |
| 472 url_bar_->SetURL(gurl); | 482 url_bar_->SetURL(gurl); |
| 473 } | 483 } |
| 474 | 484 |
| 475 void UiSceneManager::SetSecurityLevel(security_state::SecurityLevel level) { | 485 void UiSceneManager::SetSecurityLevel(security_state::SecurityLevel level) { |
| 476 url_bar_->SetSecurityLevel(level); | 486 url_bar_->SetSecurityLevel(level); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 if (fullscreen_) | 524 if (fullscreen_) |
| 515 return ColorScheme::kModeFullscreen; | 525 return ColorScheme::kModeFullscreen; |
| 516 return ColorScheme::kModeNormal; | 526 return ColorScheme::kModeNormal; |
| 517 } | 527 } |
| 518 | 528 |
| 519 const ColorScheme& UiSceneManager::color_scheme() const { | 529 const ColorScheme& UiSceneManager::color_scheme() const { |
| 520 return ColorScheme::GetColorScheme(mode()); | 530 return ColorScheme::GetColorScheme(mode()); |
| 521 } | 531 } |
| 522 | 532 |
| 523 } // namespace vr_shell | 533 } // namespace vr_shell |
| OLD | NEW |