Commit ffb1cb87 authored by Biao She's avatar Biao She Committed by Commit Bot

Replace clickable backplane with a close button in speech recogntion UI

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: I583c207a627d26ad51d13c0f4e916dfb0e4ac134
Reviewed-on: https://chromium-review.googlesource.com/776238
Commit-Queue: Biao She <bshe@chromium.org>
Reviewed-by: default avatarIan Vollick <vollick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517598}
parent ef2eab41
...@@ -83,7 +83,7 @@ static const char* g_ui_element_name_strings[] = { ...@@ -83,7 +83,7 @@ static const char* g_ui_element_name_strings[] = {
"kSpeechRecognitionListeningGrowingCircle", "kSpeechRecognitionListeningGrowingCircle",
"kSpeechRecognitionListeningInnerCircle", "kSpeechRecognitionListeningInnerCircle",
"kSpeechRecognitionListeningMicrophoneIcon", "kSpeechRecognitionListeningMicrophoneIcon",
"kSpeechRecognitionListeningBackplane", "kSpeechRecognitionListeningCloseButton",
"kSuggestionLayout", "kSuggestionLayout",
"kNumUiElementNames", "kNumUiElementNames",
}; };
......
...@@ -83,7 +83,7 @@ enum UiElementName { ...@@ -83,7 +83,7 @@ enum UiElementName {
kSpeechRecognitionListeningGrowingCircle, kSpeechRecognitionListeningGrowingCircle,
kSpeechRecognitionListeningInnerCircle, kSpeechRecognitionListeningInnerCircle,
kSpeechRecognitionListeningMicrophoneIcon, kSpeechRecognitionListeningMicrophoneIcon,
kSpeechRecognitionListeningBackplane, kSpeechRecognitionListeningCloseButton,
kSuggestionLayout, kSuggestionLayout,
// This must be last. // This must be last.
......
...@@ -166,7 +166,7 @@ TestParams params[] = { ...@@ -166,7 +166,7 @@ TestParams params[] = {
kSpeechRecognitionListeningGrowingCircle, kSpeechRecognitionListeningGrowingCircle,
kSpeechRecognitionListeningInnerCircle, kSpeechRecognitionListeningInnerCircle,
kSpeechRecognitionListeningMicrophoneIcon, kSpeechRecognitionListeningMicrophoneIcon,
kSpeechRecognitionListeningBackplane, kSpeechRecognitionListeningCloseButton,
}}, }},
{&UiScene::GetVisible2dBrowsingOverlayElements, {&UiScene::GetVisible2dBrowsingOverlayElements,
{ {
......
...@@ -119,10 +119,18 @@ static constexpr int kFloorGridlineCount = 40; ...@@ -119,10 +119,18 @@ static constexpr int kFloorGridlineCount = 40;
// Tiny distance to offset textures that should appear in the same plane. // Tiny distance to offset textures that should appear in the same plane.
static constexpr float kTextureOffset = 0.01f; static constexpr float kTextureOffset = 0.01f;
static constexpr float kVoiceSearchButtonWidth = 0.096f * kUrlBarDistance; static constexpr float kVoiceSearchUIGroupButtonDMM = 0.096f;
static constexpr float kVoiceSearchButtonWidth =
kVoiceSearchUIGroupButtonDMM * kUrlBarDistance;
static constexpr float kVoiceSearchButtonHeight = kVoiceSearchButtonWidth; static constexpr float kVoiceSearchButtonHeight = kVoiceSearchButtonWidth;
static constexpr float kVoiceSearchButtonYOffset = static constexpr float kVoiceSearchButtonYOffset =
(0.5 * kUrlBarHeightDMM + 0.032) * kUrlBarDistance; (0.5f * kUrlBarHeightDMM + 0.032f) * kUrlBarDistance;
static constexpr float kVoiceSearchCloseButtonWidth =
kVoiceSearchUIGroupButtonDMM * kContentDistance;
static constexpr float kVoiceSearchCloseButtonHeight =
kVoiceSearchCloseButtonWidth;
static constexpr float kVoiceSearchCloseButtonYOffset =
0.316f * kContentDistance + 0.5f * kVoiceSearchCloseButtonWidth;
static constexpr float kUnderDevelopmentNoticeFontHeightM = static constexpr float kUnderDevelopmentNoticeFontHeightM =
0.02f * kUrlBarDistance; 0.02f * kUrlBarDistance;
......
...@@ -738,18 +738,15 @@ void UiSceneManager::CreateVoiceSearchUiGroup(Model* model) { ...@@ -738,18 +738,15 @@ void UiSceneManager::CreateVoiceSearchUiGroup(Model* model) {
microphone_icon->SetSize(kCloseButtonWidth, kCloseButtonHeight); microphone_icon->SetSize(kCloseButtonWidth, kCloseButtonHeight);
scene_->AddUiElement(kSpeechRecognitionListening, std::move(microphone_icon)); scene_->AddUiElement(kSpeechRecognitionListening, std::move(microphone_icon));
auto backplane = base::MakeUnique<InvisibleHitTarget>(); auto close_button = base::MakeUnique<Button>(
speech_recognition_prompt_backplane_ = backplane.get(); base::Bind(&UiSceneManager::OnExitRecognizingSpeechClicked,
backplane->set_name(kSpeechRecognitionListeningBackplane); base::Unretained(this)),
backplane->set_draw_phase(kPhaseForeground); kPhaseForeground, kVoiceSearchCloseButtonWidth,
backplane->SetSize(kPromptBackplaneSize, kPromptBackplaneSize); kVoiceSearchCloseButtonHeight, vector_icons::kClose16Icon);
backplane->SetTranslate(0.0, 0.0, kTextureOffset); close_button->set_name(kSpeechRecognitionListeningCloseButton);
EventHandlers event_handlers; close_button->SetTranslate(0.0, -kVoiceSearchCloseButtonYOffset, 0.f);
event_handlers.button_up = base::Bind( BindColor(this, close_button.get(), &ColorScheme::button_colors);
&UiSceneManager::OnExitRecognizingSpeechClicked, base::Unretained(this)); scene_->AddUiElement(kSpeechRecognitionListening, std::move(close_button));
backplane->set_event_handlers(event_handlers);
scene_->AddUiElement(kSpeechRecognitionListening, std::move(backplane));
UiElement* browser_foregroud = UiElement* browser_foregroud =
scene_->GetUiElementByName(k2dBrowsingForeground); scene_->GetUiElementByName(k2dBrowsingForeground);
......
...@@ -207,7 +207,6 @@ class UiSceneManager { ...@@ -207,7 +207,6 @@ class UiSceneManager {
TransientElement* exclusive_screen_toast_viewport_aware_transient_parent_ = TransientElement* exclusive_screen_toast_viewport_aware_transient_parent_ =
nullptr; nullptr;
ShowUntilSignalTransientElement* splash_screen_transient_parent_ = nullptr; ShowUntilSignalTransientElement* splash_screen_transient_parent_ = nullptr;
UiElement* speech_recognition_prompt_backplane_ = nullptr;
UiElement* exit_warning_ = nullptr; UiElement* exit_warning_ = nullptr;
ContentElement* main_content_ = nullptr; ContentElement* main_content_ = nullptr;
UiElement* audio_capture_indicator_ = nullptr; UiElement* audio_capture_indicator_ = nullptr;
......
...@@ -64,10 +64,10 @@ const std::set<UiElementName> kHitTestableElements = { ...@@ -64,10 +64,10 @@ const std::set<UiElementName> kHitTestableElements = {
kWebVrTimeoutMessageText, kWebVrTimeoutMessageText,
kWebVrTimeoutMessageButtonText, kWebVrTimeoutMessageButtonText,
kSpeechRecognitionResultBackplane, kSpeechRecognitionResultBackplane,
kSpeechRecognitionListeningBackplane,
}; };
const std::set<UiElementName> kSpecialHitTestableElements = { const std::set<UiElementName> kSpecialHitTestableElements = {
kCloseButton, kWebVrTimeoutMessageButton, kVoiceSearchButton, kCloseButton, kWebVrTimeoutMessageButton, kVoiceSearchButton,
kSpeechRecognitionListeningCloseButton,
}; };
const std::set<UiElementName> kElementsVisibleWithExitWarning = { const std::set<UiElementName> kElementsVisibleWithExitWarning = {
kScreenDimmer, kExitWarning, kScreenDimmer, kExitWarning,
...@@ -723,7 +723,7 @@ TEST_F(UiSceneManagerTest, SpeechRecognitionUiVisibility) { ...@@ -723,7 +723,7 @@ TEST_F(UiSceneManagerTest, SpeechRecognitionUiVisibility) {
false); false);
VerifyVisibility( VerifyVisibility(
{kSpeechRecognitionListening, kSpeechRecognitionListeningMicrophoneIcon, {kSpeechRecognitionListening, kSpeechRecognitionListeningMicrophoneIcon,
kSpeechRecognitionListeningBackplane, kSpeechRecognitionListeningCloseButton,
kSpeechRecognitionListeningInnerCircle, kSpeechRecognitionListeningInnerCircle,
kSpeechRecognitionListeningGrowingCircle}, kSpeechRecognitionListeningGrowingCircle},
true); true);
......
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