Commit 274f9afd authored by Ahmed Fakhry's avatar Ahmed Fakhry Committed by Commit Bot

Touchable chrome: Non-client frame colors

Minor CL to add a skeleton for Touchable-specific colors as well
as adding the non-client frame colors.

BUG=805267

Change-Id: Ia1b3a344223c3d2e0b7c7b0bf0a5d2e851221558
Reviewed-on: https://chromium-review.googlesource.com/898489
Commit-Queue: Ahmed Fakhry <afakhry@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534138}
parent 68c11e3d
...@@ -121,8 +121,7 @@ FrameCaptionButtonContainerView::FrameCaptionButtonContainerView( ...@@ -121,8 +121,7 @@ FrameCaptionButtonContainerView::FrameCaptionButtonContainerView(
constexpr int kTouchOptimizedCaptionButtonsSpacing = 8; constexpr int kTouchOptimizedCaptionButtonsSpacing = 8;
auto layout = std::make_unique<views::BoxLayout>( auto layout = std::make_unique<views::BoxLayout>(
views::BoxLayout::kHorizontal, gfx::Insets(), views::BoxLayout::kHorizontal, gfx::Insets(),
ui::MaterialDesignController::GetMode() == ui::MaterialDesignController::IsTouchOptimizedUiEnabled()
ui::MaterialDesignController::MATERIAL_TOUCH_OPTIMIZED
? kTouchOptimizedCaptionButtonsSpacing ? kTouchOptimizedCaptionButtonsSpacing
: 0); : 0);
layout->set_cross_axis_alignment( layout->set_cross_axis_alignment(
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <memory> #include <memory>
#include "base/macros.h" #include "base/macros.h"
#include "base/optional.h"
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "build/build_config.h" #include "build/build_config.h"
...@@ -138,6 +139,44 @@ constexpr char kTilingRepeatX[] = "repeat-x"; ...@@ -138,6 +139,44 @@ constexpr char kTilingRepeatX[] = "repeat-x";
constexpr char kTilingRepeatY[] = "repeat-y"; constexpr char kTilingRepeatY[] = "repeat-y";
constexpr char kTilingRepeat[] = "repeat"; constexpr char kTilingRepeat[] = "repeat";
// ----------------------------------------------------------------------------
// Defaults for properties when the touch-optimized UI is enabled.
constexpr SkColor kActiveFrameColorTouchOptimized =
SkColorSetRGB(0xD0, 0xD2, 0xD6);
constexpr SkColor kInactiveFrameColorTouchOptimized =
SkColorSetRGB(0xE3, 0xE5, 0xE8);
constexpr SkColor kIncognitoActiveFrameColorTouchOptimized =
SkColorSetRGB(0x20, 0x21, 0x24);
constexpr SkColor kIncognitoInactiveFrameColorTouchOptimized =
SkColorSetRGB(0x32, 0x36, 0x39);
// Returns a |nullopt| if the touch-optimized UI is not enabled, or it's enabled
// but for the given |id|, there's no touch-optimized specific colors, and we
// should fall back to the default colors.
base::Optional<SkColor> MaybeGetDefaultColorForTouchOptimizedUi(
int id,
bool incognito) {
if (!ui::MaterialDesignController::IsTouchOptimizedUiEnabled())
return base::nullopt;
switch (id) {
case ThemeProperties::COLOR_FRAME:
// Active frame colors.
return incognito ? kIncognitoActiveFrameColorTouchOptimized
: kActiveFrameColorTouchOptimized;
case ThemeProperties::COLOR_FRAME_INACTIVE:
// Inactive frame colors.
return incognito ? kIncognitoInactiveFrameColorTouchOptimized
: kInactiveFrameColorTouchOptimized;
// TODO: Place all touch-optimized UI related colors here.
default:
return base::nullopt;
}
}
} // namespace } // namespace
// static // static
...@@ -226,6 +265,11 @@ color_utils::HSL ThemeProperties::GetDefaultTint(int id, bool incognito) { ...@@ -226,6 +265,11 @@ color_utils::HSL ThemeProperties::GetDefaultTint(int id, bool incognito) {
// static // static
SkColor ThemeProperties::GetDefaultColor(int id, bool incognito) { SkColor ThemeProperties::GetDefaultColor(int id, bool incognito) {
const base::Optional<SkColor> color =
MaybeGetDefaultColorForTouchOptimizedUi(id, incognito);
if (color)
return color.value();
switch (id) { switch (id) {
// Properties stored in theme pack. // Properties stored in theme pack.
case COLOR_FRAME: case COLOR_FRAME:
......
...@@ -190,8 +190,7 @@ const gfx::VectorIcon& AutocompleteMatch::TypeToVectorIcon(Type type, ...@@ -190,8 +190,7 @@ const gfx::VectorIcon& AutocompleteMatch::TypeToVectorIcon(Type type,
bool is_bookmark) { bool is_bookmark) {
#if (!defined(OS_ANDROID) || BUILDFLAG(ENABLE_VR)) && !defined(OS_IOS) #if (!defined(OS_ANDROID) || BUILDFLAG(ENABLE_VR)) && !defined(OS_IOS)
const bool is_touch_ui = const bool is_touch_ui =
ui::MaterialDesignController::GetMode() == ui::MaterialDesignController::IsTouchOptimizedUiEnabled();
ui::MaterialDesignController::MATERIAL_TOUCH_OPTIMIZED;
if (is_bookmark) if (is_bookmark)
return is_touch_ui ? omnibox::kTouchableBookmarkIcon : omnibox::kStarIcon; return is_touch_ui ? omnibox::kTouchableBookmarkIcon : omnibox::kStarIcon;
......
...@@ -82,6 +82,11 @@ bool MaterialDesignController::IsSecondaryUiMaterial() { ...@@ -82,6 +82,11 @@ bool MaterialDesignController::IsSecondaryUiMaterial() {
return base::FeatureList::IsEnabled(features::kSecondaryUiMd); return base::FeatureList::IsEnabled(features::kSecondaryUiMd);
} }
// static
bool MaterialDesignController::IsTouchOptimizedUiEnabled() {
return GetMode() == MATERIAL_TOUCH_OPTIMIZED;
}
// static // static
MaterialDesignController::Mode MaterialDesignController::DefaultMode() { MaterialDesignController::Mode MaterialDesignController::DefaultMode() {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
......
...@@ -38,6 +38,9 @@ class UI_BASE_EXPORT MaterialDesignController { ...@@ -38,6 +38,9 @@ class UI_BASE_EXPORT MaterialDesignController {
// should be extended to cover secondary UI. // should be extended to cover secondary UI.
static bool IsSecondaryUiMaterial(); static bool IsSecondaryUiMaterial();
// Returns true if the touch-optimized UI material design mode is enabled;
static bool IsTouchOptimizedUiEnabled();
// Returns the per-platform default material design variant. // Returns the per-platform default material design variant.
static Mode DefaultMode(); static Mode DefaultMode();
......
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