Commit 3e44fc53 authored by Dominick Ng's avatar Dominick Ng Committed by Commit Bot

Implement the Touchable Chrome color spec for the location bar.

This CL applies the Touchable Chrome color spec for the location bar and
omnibox drop down.

The selected keyword icon was not updated to the Touchable Chrome
version in a previous CL; that icon is also updated here along with its
color.

BUG=801583

Change-Id: Ia8a6ab56ef02852d407a0dd1501f2d10422f9455
Reviewed-on: https://chromium-review.googlesource.com/972702
Commit-Queue: Dominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545757}
parent f3adf863
...@@ -192,6 +192,24 @@ SkColor GetLegacyColor(OmniboxPart part, ...@@ -192,6 +192,24 @@ SkColor GetLegacyColor(OmniboxPart part,
: native_theme->GetSystemColor(color_id); : native_theme->GetSystemColor(color_id);
} }
SkColor GetSecurityChipColor(OmniboxTint tint, OmniboxPartState state) {
if (tint == OmniboxTint::DARK)
return gfx::kGoogleGrey100;
switch (state) {
case OmniboxPartState::CHIP_DEFAULT:
return gfx::kGoogleGrey800;
case OmniboxPartState::CHIP_SECURE:
return gfx::kGoogleGreen600;
case OmniboxPartState::CHIP_DANGEROUS:
return gfx::kGoogleRed600;
default:
NOTREACHED();
}
return gfx::kPlaceholderColor;
}
} // namespace } // namespace
SkColor GetOmniboxColor(OmniboxPart part, SkColor GetOmniboxColor(OmniboxPart part,
...@@ -205,34 +223,46 @@ SkColor GetOmniboxColor(OmniboxPart part, ...@@ -205,34 +223,46 @@ SkColor GetOmniboxColor(OmniboxPart part,
const bool dark = tint == OmniboxTint::DARK; const bool dark = tint == OmniboxTint::DARK;
switch (part) { switch (part) {
case OmniboxPart::LOCATION_BAR_BACKGROUND:
return dark ? SkColorSetRGB(0x28, 0x2C, 0x2F)
: SkColorSetRGB(0xED, 0xEF, 0xF2);
case OmniboxPart::LOCATION_BAR_SECURITY_CHIP:
return GetSecurityChipColor(tint, state);
case OmniboxPart::LOCATION_BAR_SELECTED_KEYWORD:
return dark ? gfx::kGoogleGrey100 : gfx::kGoogleBlue600;
case OmniboxPart::RESULTS_BACKGROUND: case OmniboxPart::RESULTS_BACKGROUND:
// The spec calls for transparent black (or white) overlays for hover (6%) // The spec calls for transparent black (or white) overlays for hover (6%)
// and select (8%), which can overlap (for 14%). Pre-blend these with the // and select (8%), which can overlap (for 14%). Pre-blend these with the
// background for the best text AA result. // background for the best text AA result.
return color_utils::BlendTowardOppositeLuma( return color_utils::BlendTowardOppositeLuma(
dark ? gfx::kGoogleGrey800 : SK_ColorWHITE, dark ? gfx::kGoogleGrey800 : SK_ColorWHITE,
NormalHoveredSelectedOrBoth<SkAlpha>(state, 0x00, 0x0f, 0x14, 0x24)); NormalHoveredSelectedOrBoth<SkAlpha>(state, 0x00, 0x0F, 0x14, 0x24));
case OmniboxPart::RESULTS_SEPARATOR: case OmniboxPart::RESULTS_SEPARATOR:
// The dark base color doesn't appear in the MD2 spec, just Chrome's. // The dark base color doesn't appear in the Material spec, just Chrome's.
return dark ? SkColorSetARGB(0x6e, 0x16, 0x17, 0x1a) // 43% alpha. return dark ? SkColorSetARGB(0x6E, 0x16, 0x17, 0x1A) // 43% alpha.
: SkColorSetA(gfx::kGoogleGrey900, 0x24); // 14% alpha. : SkColorSetA(gfx::kGoogleGrey900, 0x24); // 14% alpha.
// TODO(tapted): Add these.
case OmniboxPart::LOCATION_BAR_BACKGROUND:
case OmniboxPart::LOCATION_BAR_CLEAR_ALL:
case OmniboxPart::LOCATION_BAR_IME_AUTOCOMPLETE_BACKGROUND:
case OmniboxPart::LOCATION_BAR_IME_AUTOCOMPLETE_TEXT:
case OmniboxPart::LOCATION_BAR_SECURITY_CHIP:
case OmniboxPart::LOCATION_BAR_SELECTED_KEYWORD:
case OmniboxPart::LOCATION_BAR_TEXT_DEFAULT: case OmniboxPart::LOCATION_BAR_TEXT_DEFAULT:
case OmniboxPart::RESULTS_TEXT_DEFAULT:
return dark ? gfx::kGoogleGrey100 : gfx::kGoogleGrey800;
case OmniboxPart::LOCATION_BAR_TEXT_DIMMED: case OmniboxPart::LOCATION_BAR_TEXT_DIMMED:
case OmniboxPart::RESULTS_ICON: case OmniboxPart::RESULTS_ICON:
case OmniboxPart::RESULTS_TEXT_DEFAULT:
case OmniboxPart::RESULTS_TEXT_DIMMED: case OmniboxPart::RESULTS_TEXT_DIMMED:
// This is a pre-lightened (or darkened) variant of the base text color.
return dark ? gfx::kGoogleGrey400 : gfx::kGoogleGrey700;
case OmniboxPart::RESULTS_TEXT_URL:
// The darker blue doesn't appear in the Material spec.
return dark ? SkColorSetRGB(0x25, 0x81, 0xDF) : gfx::kGoogleBlue600;
// TODO(tapted): Add these.
case OmniboxPart::LOCATION_BAR_CLEAR_ALL:
case OmniboxPart::LOCATION_BAR_IME_AUTOCOMPLETE_BACKGROUND:
case OmniboxPart::LOCATION_BAR_IME_AUTOCOMPLETE_TEXT:
case OmniboxPart::RESULTS_TEXT_INVISIBLE: case OmniboxPart::RESULTS_TEXT_INVISIBLE:
case OmniboxPart::RESULTS_TEXT_NEGATIVE: case OmniboxPart::RESULTS_TEXT_NEGATIVE:
case OmniboxPart::RESULTS_TEXT_POSITIVE: case OmniboxPart::RESULTS_TEXT_POSITIVE:
case OmniboxPart::RESULTS_TEXT_URL:
return GetLegacyColor(part, tint, state); return GetLegacyColor(part, tint, state);
} }
return gfx::kPlaceholderColor; return gfx::kPlaceholderColor;
......
...@@ -11,9 +11,11 @@ ...@@ -11,9 +11,11 @@
#include "chrome/browser/ui/omnibox/omnibox_theme.h" #include "chrome/browser/ui/omnibox/omnibox_theme.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "components/omnibox/browser/vector_icons.h"
#include "components/search_engines/template_url_service.h" #include "components/search_engines/template_url_service.h"
#include "components/vector_icons/vector_icons.h" #include "components/vector_icons/vector_icons.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/material_design/material_design_controller.h"
#include "ui/base/theme_provider.h" #include "ui/base/theme_provider.h"
#include "ui/gfx/color_palette.h" #include "ui/gfx/color_palette.h"
#include "ui/gfx/color_utils.h" #include "ui/gfx/color_utils.h"
...@@ -36,9 +38,11 @@ SelectedKeywordView::~SelectedKeywordView() { ...@@ -36,9 +38,11 @@ SelectedKeywordView::~SelectedKeywordView() {
} }
void SelectedKeywordView::ResetImage() { void SelectedKeywordView::ResetImage() {
SetImage(gfx::CreateVectorIcon(vector_icons::kSearchIcon, SetImage(gfx::CreateVectorIcon(
GetLayoutConstant(LOCATION_BAR_ICON_SIZE), ui::MaterialDesignController::IsTouchOptimizedUiEnabled()
GetTextColor())); ? omnibox::kTouchableSearchIcon
: vector_icons::kSearchIcon,
GetLayoutConstant(LOCATION_BAR_ICON_SIZE), GetTextColor()));
} }
SkColor SelectedKeywordView::GetTextColor() const { SkColor SelectedKeywordView::GetTextColor() const {
......
...@@ -29,6 +29,7 @@ constexpr SkColor kGoogleRed800 = SkColorSetRGB(0xB3, 0x14, 0x12); ...@@ -29,6 +29,7 @@ constexpr SkColor kGoogleRed800 = SkColorSetRGB(0xB3, 0x14, 0x12);
constexpr SkColor kGoogleRedDark600 = SkColorSetRGB(0xD3, 0x3B, 0x30); constexpr SkColor kGoogleRedDark600 = SkColorSetRGB(0xD3, 0x3B, 0x30);
constexpr SkColor kGoogleRedDark800 = SkColorSetRGB(0xB4, 0x1B, 0x1A); constexpr SkColor kGoogleRedDark800 = SkColorSetRGB(0xB4, 0x1B, 0x1A);
constexpr SkColor kGoogleGreen300 = SkColorSetRGB(0x81, 0xC9, 0x95); constexpr SkColor kGoogleGreen300 = SkColorSetRGB(0x81, 0xC9, 0x95);
constexpr SkColor kGoogleGreen600 = SkColorSetRGB(0x1E, 0x8E, 0x3E);
constexpr SkColor kGoogleGreen700 = SkColorSetRGB(0x18, 0x80, 0x38); constexpr SkColor kGoogleGreen700 = SkColorSetRGB(0x18, 0x80, 0x38);
constexpr SkColor kGoogleYellow300 = SkColorSetRGB(0xFD, 0xD6, 0x63); constexpr SkColor kGoogleYellow300 = SkColorSetRGB(0xFD, 0xD6, 0x63);
constexpr SkColor kGoogleYellow700 = SkColorSetRGB(0xF2, 0x99, 0x00); constexpr SkColor kGoogleYellow700 = SkColorSetRGB(0xF2, 0x99, 0x00);
......
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