Commit a04e459e authored by Tommy C. Li's avatar Tommy C. Li Committed by Commit Bot

Omnibox: Experiment with a white background for the unfocused omnibox

Sets the unfocused omnibox background to the same color as the results
popup, which is conventionally white.

Also enables the location bar border stroke in this mode, which already
exists for high contrast mode.

Bug: 931836
Change-Id: I97e0a5c768c739f4f037d9e3abdb99115b14999d
Reviewed-on: https://chromium-review.googlesource.com/c/1474281Reviewed-by: default avatarKevin Bailey <krb@chromium.org>
Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Commit-Queue: Tommy Li <tommycli@chromium.org>
Auto-Submit: Tommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632737}
parent c048c3d1
......@@ -737,8 +737,16 @@ void LocationBarView::RefreshBackground() {
if (omnibox_view_->model()->is_caret_visible()) {
background_color = border_color = GetColor(OmniboxPart::RESULTS_BACKGROUND);
} else {
const SkColor normal = GetOmniboxColor(OmniboxPart::LOCATION_BAR_BACKGROUND,
tint(), OmniboxPartState::NORMAL);
// If the white omnibox background experiment is enabled, use the color of
// the results box rather than the normal location bar background color.
OmniboxPart normal_color_part =
base::FeatureList::IsEnabled(
omnibox::kUIExperimentWhiteBackgroundOnBlur)
? OmniboxPart::RESULTS_BACKGROUND
: OmniboxPart::LOCATION_BAR_BACKGROUND;
const SkColor normal =
GetOmniboxColor(normal_color_part, tint(), OmniboxPartState::NORMAL);
const SkColor hovered =
GetOmniboxColor(OmniboxPart::LOCATION_BAR_BACKGROUND, tint(),
OmniboxPartState::HOVERED);
......@@ -750,10 +758,18 @@ void LocationBarView::RefreshBackground() {
if (is_popup_mode_) {
SetBackground(views::CreateSolidBackground(background_color));
} else {
// High contrast schemes get a border stroke even on a rounded omnibox.
SkColor stroke_color = GetNativeTheme()->UsesHighContrastColors()
? border_color
: SK_ColorTRANSPARENT;
SkColor stroke_color = SK_ColorTRANSPARENT;
if (GetNativeTheme()->UsesHighContrastColors()) {
// High contrast schemes get a border stroke even on a rounded omnibox.
stroke_color = border_color;
} else if (base::FeatureList::IsEnabled(
omnibox::kUIExperimentWhiteBackgroundOnBlur)) {
const double opacity = hover_animation_.GetCurrentValue();
stroke_color = gfx::Tween::ColorValueBetween(opacity, border_color,
SK_ColorTRANSPARENT);
}
SetBackground(CreateRoundRectBackground(background_color, stroke_color));
}
......
......@@ -233,6 +233,13 @@ const base::Feature kUIExperimentShowSuffixOnAllSearchSuggestions{
"OmniboxUIExperimentShowSuffixOnAllSearchSuggestions",
base::FEATURE_DISABLED_BY_DEFAULT};
// Feature used to show a white background in the omnibox while it's unfocused.
// More technically, with this flag on, it uses the same background color as
// the results popup (conventionally white).
const base::Feature kUIExperimentWhiteBackgroundOnBlur{
"OmniboxUIExperimentWhiteBackgroundOnBlur",
base::FEATURE_DISABLED_BY_DEFAULT};
// Feature used to show a generic vector icon for omnibox search instead of the
// search engine favicon.
extern const base::Feature kUIExperimentUseGenericSearchEngineIcon{
......
......@@ -52,6 +52,7 @@ extern const base::Feature kUIExperimentShowSuggestionFavicons;
extern const base::Feature kUIExperimentSwapTitleAndUrl;
extern const base::Feature kUIExperimentVerticalMargin;
extern const base::Feature kUIExperimentShowSuffixOnAllSearchSuggestions;
extern const base::Feature kUIExperimentWhiteBackgroundOnBlur;
extern const base::Feature kUIExperimentUseGenericSearchEngineIcon;
extern const base::Feature kSpeculativeServiceWorkerStartOnQueryInput;
extern const base::Feature kDocumentProvider;
......
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