Commit 099f86d3 authored by Yash Malik's avatar Yash Malik Committed by Commit Bot

VR: Remove ExitPromptBakplane element

https://chromium-review.googlesource.com/c/chromium/src/+/748817 adds event
handlers so we don't need this anymore.

Bug: None
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Iba9883d31e7e575cc12d1b6aee25b3a5735f3e56
Reviewed-on: https://chromium-review.googlesource.com/764771
Commit-Queue: Ian Vollick <vollick@chromium.org>
Reviewed-by: default avatarIan Vollick <vollick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#515825}
parent dd7029b7
......@@ -47,8 +47,6 @@ static_library("vr_common") {
"elements/exclusive_screen_toast_texture.h",
"elements/exit_prompt.cc",
"elements/exit_prompt.h",
"elements/exit_prompt_backplane.cc",
"elements/exit_prompt_backplane.h",
"elements/exit_prompt_texture.cc",
"elements/exit_prompt_texture.h",
"elements/exit_warning_texture.cc",
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/vr/elements/exit_prompt_backplane.h"
#include "base/memory/ptr_util.h"
namespace vr {
ExitPromptBackplane::ExitPromptBackplane(
const base::Callback<void()>& click_callback)
: click_callback_(click_callback) {}
ExitPromptBackplane::~ExitPromptBackplane() = default;
void ExitPromptBackplane::OnButtonUp(const gfx::PointF& position) {
// We always run the callback. That is, if the user clicks the controller
// button on the backplane and releases it on another element in front of the
// backplane, this callback will still be called. Elements are input locked
// on button down and it's probably not worth special-casing the backplane.
click_callback_.Run();
}
} // namespace vr
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_VR_ELEMENTS_EXIT_PROMPT_BACKPLANE_H_
#define CHROME_BROWSER_VR_ELEMENTS_EXIT_PROMPT_BACKPLANE_H_
#include "base/callback.h"
#include "chrome/browser/vr/elements/invisible_hit_target.h"
namespace vr {
// An invisible but hittable plane behind the exit prompt, to keep the reticle
// roughly planar with the prompt when its near the prompt.
class ExitPromptBackplane : public InvisibleHitTarget {
public:
explicit ExitPromptBackplane(const base::Callback<void()>& click_callback);
~ExitPromptBackplane() override;
void OnButtonUp(const gfx::PointF& position) override;
private:
base::Callback<void()> click_callback_;
DISALLOW_COPY_AND_ASSIGN(ExitPromptBackplane);
};
} // namespace vr
#endif // CHROME_BROWSER_VR_ELEMENTS_EXIT_PROMPT_BACKPLANE_H_
......@@ -42,7 +42,7 @@ static constexpr float kAudioPermissionPromptWidth = 0.552f * kContentDistance;
static constexpr float kAudioPermissionPromptHeight = 0.2f * kContentDistance;
static constexpr float kExitPromptVerticalOffset = -0.09f * kContentDistance;
static constexpr float kExitPromptBackplaneSize = 1000.0;
static constexpr float kPromptBackplaneSize = 1000.0;
// Distance-independent milimeter size of the URL bar.
static constexpr float kUrlBarWidthDMM = 0.672f;
......
......@@ -18,7 +18,6 @@
#include "chrome/browser/vr/elements/draw_phase.h"
#include "chrome/browser/vr/elements/exclusive_screen_toast.h"
#include "chrome/browser/vr/elements/exit_prompt.h"
#include "chrome/browser/vr/elements/exit_prompt_backplane.h"
#include "chrome/browser/vr/elements/full_screen_rect.h"
#include "chrome/browser/vr/elements/grid.h"
#include "chrome/browser/vr/elements/invisible_hit_target.h"
......@@ -635,7 +634,7 @@ void UiSceneManager::CreateVoiceSearchUiGroup(Model* model) {
auto hit_target = base::MakeUnique<InvisibleHitTarget>();
hit_target->set_name(kSpeechRecognitionResultBackplane);
hit_target->set_draw_phase(kPhaseForeground);
hit_target->SetSize(kExitPromptBackplaneSize, kExitPromptBackplaneSize);
hit_target->SetSize(kPromptBackplaneSize, kPromptBackplaneSize);
hit_target->SetTranslate(0.0, 0.0, kTextureOffset);
scene_->AddUiElement(kSpeechRecognitionResult, std::move(hit_target));
......@@ -688,13 +687,17 @@ void UiSceneManager::CreateVoiceSearchUiGroup(Model* model) {
microphone_icon->SetSize(kCloseButtonWidth, kCloseButtonHeight);
scene_->AddUiElement(kSpeechRecognitionListening, std::move(microphone_icon));
auto backplane = base::MakeUnique<ExitPromptBackplane>(base::Bind(
&UiSceneManager::OnExitRecognizingSpeechClicked, base::Unretained(this)));
auto backplane = base::MakeUnique<InvisibleHitTarget>();
speech_recognition_prompt_backplane_ = backplane.get();
backplane->set_name(kSpeechRecognitionListeningBackplane);
backplane->set_draw_phase(kPhaseForeground);
backplane->SetSize(kExitPromptBackplaneSize, kExitPromptBackplaneSize);
backplane->SetSize(kPromptBackplaneSize, kPromptBackplaneSize);
backplane->SetTranslate(0.0, 0.0, kTextureOffset);
EventHandlers event_handlers;
event_handlers.button_up = base::Bind(
&UiSceneManager::OnExitRecognizingSpeechClicked, base::Unretained(this));
backplane->set_event_handlers(event_handlers);
scene_->AddUiElement(kSpeechRecognitionListening, std::move(backplane));
UiElement* browser_foregroud =
......@@ -911,15 +914,18 @@ void UiSceneManager::CreateExitPrompt() {
// Place an invisible but hittable plane behind the exit prompt, to keep the
// reticle roughly planar with the content if near content.
auto backplane = base::MakeUnique<ExitPromptBackplane>(base::Bind(
&UiSceneManager::OnExitPromptBackplaneClicked, base::Unretained(this)));
auto backplane = base::MakeUnique<InvisibleHitTarget>();
exit_prompt_backplane_ = backplane.get();
element = std::move(backplane);
element->set_name(kExitPromptBackplane);
element->set_draw_phase(kPhaseForeground);
element->SetSize(kExitPromptBackplaneSize, kExitPromptBackplaneSize);
element->SetSize(kPromptBackplaneSize, kPromptBackplaneSize);
element->SetTranslate(0.0, kContentVerticalOffset + kExitPromptVerticalOffset,
kTextureOffset - kContentDistance);
EventHandlers event_handlers;
event_handlers.button_up = base::Bind(
&UiSceneManager::OnExitPromptBackplaneClicked, base::Unretained(this));
element->set_event_handlers(event_handlers);
element->AddBinding(VR_BIND_FUNC(
bool, UiSceneManager, this, browsing_mode() && model->prompting_to_exit(),
UiElement, element.get(), SetVisible));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment