Commit 20b7a590 authored by Christopher Grant's avatar Christopher Grant Committed by Commit Bot

VR: Add omnibox hint text

This change puts a prompt string into the omnibox whenever the field is
empty.  Once a character is entered, or when the field later becomes
empty, the hint is shown.

BUG=
R=bshe
TBR=cpu@chromium.org

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: Ib05f091fb339a4c06d83a0502e1d0d1b51b0d277
Reviewed-on: https://chromium-review.googlesource.com/812208Reviewed-by: default avatarBiao She <bshe@chromium.org>
Commit-Queue: Christopher Grant <cjgrant@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522317}
parent 488c1b08
...@@ -5178,7 +5178,7 @@ Keep your key file in a safe place. You will need it to create new versions of y ...@@ -5178,7 +5178,7 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_OMNIBOX_CLEAR_ALL" desc="Accessibility text for the button that deletes all text input from the omnibox on touch devices."> <message name="IDS_OMNIBOX_CLEAR_ALL" desc="Accessibility text for the button that deletes all text input from the omnibox on touch devices.">
Clear input Clear input
</message> </message>
<if expr="is_android"> <if expr="is_android or enable_vr">
<message name="IDS_SEARCH_OR_TYPE_URL" desc="Prompt to enter text into the text field that will either perform web searches or navigate to a URL. [CHAR-LIMIT=38]" formatter_data="android_java"> <message name="IDS_SEARCH_OR_TYPE_URL" desc="Prompt to enter text into the text field that will either perform web searches or navigate to a URL. [CHAR-LIMIT=38]" formatter_data="android_java">
Search or type URL Search or type URL
</message> </message>
......
...@@ -112,6 +112,10 @@ void TextInput::SetCursorColor(SkColor color) { ...@@ -112,6 +112,10 @@ void TextInput::SetCursorColor(SkColor color) {
cursor_element_->SetColor(color); cursor_element_->SetColor(color);
} }
void TextInput::SetHintColor(SkColor color) {
hint_element_->SetColor(color);
}
void TextInput::UpdateInput(const TextInputInfo& info) { void TextInput::UpdateInput(const TextInputInfo& info) {
if (text_info_ == info) if (text_info_ == info)
return; return;
......
...@@ -43,6 +43,7 @@ class TextInput : public UiElement { ...@@ -43,6 +43,7 @@ class TextInput : public UiElement {
void SetHintText(const base::string16& text); void SetHintText(const base::string16& text);
void SetTextColor(SkColor color); void SetTextColor(SkColor color);
void SetCursorColor(SkColor color); void SetCursorColor(SkColor color);
void SetHintColor(SkColor color);
void SetTextInputDelegate(TextInputDelegate* text_input_delegate); void SetTextInputDelegate(TextInputDelegate* text_input_delegate);
bool OnBeginFrame(const base::TimeTicks& time, bool OnBeginFrame(const base::TimeTicks& time,
......
...@@ -114,6 +114,7 @@ void InitializeColorSchemes() { ...@@ -114,6 +114,7 @@ void InitializeColorSchemes() {
normal_scheme.omnibox_background = 0xFFEEEEEE; normal_scheme.omnibox_background = 0xFFEEEEEE;
normal_scheme.omnibox_icon = 0xA6000000; normal_scheme.omnibox_icon = 0xA6000000;
normal_scheme.omnibox_text = 0xFF595959; normal_scheme.omnibox_text = 0xFF595959;
normal_scheme.omnibox_hint = 0xFF999999;
normal_scheme.omnibox_suggestion_content = 0xFF595959; normal_scheme.omnibox_suggestion_content = 0xFF595959;
normal_scheme.omnibox_suggestion_description = 0xFF5595FE; normal_scheme.omnibox_suggestion_description = 0xFF5595FE;
normal_scheme.cursor = 0xFF5595FE; normal_scheme.cursor = 0xFF5595FE;
......
...@@ -106,6 +106,7 @@ struct ColorScheme { ...@@ -106,6 +106,7 @@ struct ColorScheme {
SkColor omnibox_background; SkColor omnibox_background;
SkColor omnibox_icon; SkColor omnibox_icon;
SkColor omnibox_text; SkColor omnibox_text;
SkColor omnibox_hint;
SkColor omnibox_suggestion_content; SkColor omnibox_suggestion_content;
SkColor omnibox_suggestion_description; SkColor omnibox_suggestion_description;
......
...@@ -1140,6 +1140,8 @@ void UiSceneCreator::CreateOmnibox() { ...@@ -1140,6 +1140,8 @@ void UiSceneCreator::CreateOmnibox() {
VR_BIND(TextInputInfo, Model, model_, omnibox_text_field_info, VR_BIND(TextInputInfo, Model, model_, omnibox_text_field_info,
UiBrowserInterface, browser_, StartAutocomplete(value.text))); UiBrowserInterface, browser_, StartAutocomplete(value.text)));
omnibox_text_field->SetSize(width, 0); omnibox_text_field->SetSize(width, 0);
omnibox_text_field->SetHintText(
l10n_util::GetStringUTF16(IDS_SEARCH_OR_TYPE_URL));
omnibox_text_field->set_name(kOmniboxTextField); omnibox_text_field->set_name(kOmniboxTextField);
omnibox_text_field->set_x_anchoring(LEFT); omnibox_text_field->set_x_anchoring(LEFT);
omnibox_text_field->set_x_centering(LEFT); omnibox_text_field->set_x_centering(LEFT);
...@@ -1158,6 +1160,8 @@ void UiSceneCreator::CreateOmnibox() { ...@@ -1158,6 +1160,8 @@ void UiSceneCreator::CreateOmnibox() {
&TextInput::SetTextColor); &TextInput::SetTextColor);
BindColor(model_, omnibox_text_field.get(), &ColorScheme::cursor, BindColor(model_, omnibox_text_field.get(), &ColorScheme::cursor,
&TextInput::SetCursorColor); &TextInput::SetCursorColor);
BindColor(model_, omnibox_text_field.get(), &ColorScheme::omnibox_hint,
&TextInput::SetHintColor);
scene_->AddUiElement(kOmniboxContainer, std::move(omnibox_text_field)); scene_->AddUiElement(kOmniboxContainer, std::move(omnibox_text_field));
......
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