Commit a68c3e66 authored by David Black's avatar David Black Committed by Commit Bot

Change font for Assistant.

See bug for additional details.

Bug: b:110416447
Change-Id: Id5323c5040e1b32326a8caa8d06a41749f0d92fa
Reviewed-on: https://chromium-review.googlesource.com/1151714
Commit-Queue: David Black <dmblack@google.com>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578499}
parent ecb28473
...@@ -126,7 +126,6 @@ component("ash") { ...@@ -126,7 +126,6 @@ component("ash") {
"assistant/ui/assistant_main_view.h", "assistant/ui/assistant_main_view.h",
"assistant/ui/assistant_mini_view.cc", "assistant/ui/assistant_mini_view.cc",
"assistant/ui/assistant_mini_view.h", "assistant/ui/assistant_mini_view.h",
"assistant/ui/assistant_ui_constants.h",
"assistant/ui/assistant_web_view.cc", "assistant/ui/assistant_web_view.cc",
"assistant/ui/assistant_web_view.h", "assistant/ui/assistant_web_view.h",
"assistant/ui/caption_bar.cc", "assistant/ui/caption_bar.cc",
...@@ -1329,6 +1328,7 @@ component("ash") { ...@@ -1329,6 +1328,7 @@ component("ash") {
] ]
deps = [ deps = [
"//ash/app_menu", "//ash/app_menu",
"//ash/assistant/ui:constants",
"//ash/autoclick/common:autoclick", "//ash/autoclick/common:autoclick",
"//ash/components/autoclick/public/mojom", "//ash/components/autoclick/public/mojom",
"//ash/components/cursor", "//ash/components/cursor",
......
...@@ -99,6 +99,7 @@ component("app_list") { ...@@ -99,6 +99,7 @@ component("app_list") {
deps = [ deps = [
"//ash/app_list/resources", "//ash/app_list/resources",
"//ash/app_menu", "//ash/app_menu",
"//ash/assistant/ui:constants",
"//ash/public/cpp/app_list/vector_icons", "//ash/public/cpp/app_list/vector_icons",
"//base", "//base",
"//base:i18n", "//base:i18n",
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <memory> #include <memory>
#include "ash/assistant/ui/assistant_ui_constants.h"
#include "ash/public/cpp/app_list/app_list_config.h" #include "ash/public/cpp/app_list/app_list_config.h"
#include "ui/accessibility/ax_node_data.h" #include "ui/accessibility/ax_node_data.h"
#include "ui/gfx/canvas.h" #include "ui/gfx/canvas.h"
...@@ -27,7 +28,7 @@ namespace { ...@@ -27,7 +28,7 @@ namespace {
constexpr SkColor kAssistantBackgroundColor = SK_ColorWHITE; constexpr SkColor kAssistantBackgroundColor = SK_ColorWHITE;
constexpr SkColor kAssistantStrokeColor = constexpr SkColor kAssistantStrokeColor =
SkColorSetA(gfx::kGoogleGrey900, 0x24); SkColorSetA(gfx::kGoogleGrey900, 0x24);
constexpr SkColor kAssistantTextColor = gfx::kGoogleGrey900; constexpr SkColor kAssistantTextColor = gfx::kGoogleGrey700;
constexpr int kAssistantStrokeWidthDip = 1; constexpr int kAssistantStrokeWidthDip = 1;
// App list specific style: // App list specific style:
...@@ -114,9 +115,10 @@ void SuggestionChipView::InitLayout(const Params& params) { ...@@ -114,9 +115,10 @@ void SuggestionChipView::InitLayout(const Params& params) {
text_view_->SetAutoColorReadabilityEnabled(false); text_view_->SetAutoColorReadabilityEnabled(false);
text_view_->SetEnabledColor(assistant_style_ ? kAssistantTextColor text_view_->SetEnabledColor(assistant_style_ ? kAssistantTextColor
: kAppListTextColor); : kAppListTextColor);
text_view_->SetFontList(assistant_style_ text_view_->SetFontList(
? text_view_->font_list().DeriveWithSizeDelta(2) assistant_style_
: AppListConfig::instance().app_title_font()); ? ash::assistant::ui::GetDefaultFontList().DeriveWithSizeDelta(2)
: AppListConfig::instance().app_title_font());
text_view_->SetText(params.text); text_view_->SetText(params.text);
AddChildView(text_view_); AddChildView(text_view_);
} }
......
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/ui.gni")
assert(is_chromeos)
source_set("constants") {
sources = [
"assistant_ui_constants.cc",
"assistant_ui_constants.h",
]
deps = [
"//base",
"//skia",
"//ui/gfx",
]
}
...@@ -77,7 +77,7 @@ void AssistantMiniView::InitLayout() { ...@@ -77,7 +77,7 @@ void AssistantMiniView::InitLayout() {
// Label. // Label.
label_->SetAutoColorReadabilityEnabled(false); label_->SetAutoColorReadabilityEnabled(false);
label_->SetFontList( label_->SetFontList(
views::Label::GetDefaultFontList().DeriveWithSizeDelta(4)); assistant::ui::GetDefaultFontList().DeriveWithSizeDelta(4));
label_->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT); label_->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT);
AddChildView(label_); AddChildView(label_);
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/assistant/ui/assistant_ui_constants.h"
#include "base/no_destructor.h"
#include "ui/gfx/font_list.h"
namespace ash {
namespace assistant {
namespace ui {
const gfx::FontList& GetDefaultFontList() {
static const base::NoDestructor<gfx::FontList> font_list("Google Sans, 12px");
return *font_list;
}
} // namespace ui
} // namespace assistant
} // namespace ash
\ No newline at end of file
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/color_palette.h" #include "ui/gfx/color_palette.h"
namespace gfx {
class FontList;
} // namespace gfx
namespace ash { namespace ash {
// Appearance. // Appearance.
...@@ -21,6 +25,16 @@ constexpr SkColor kTextColorHint = gfx::kGoogleGrey500; ...@@ -21,6 +25,16 @@ constexpr SkColor kTextColorHint = gfx::kGoogleGrey500;
constexpr SkColor kTextColorPrimary = gfx::kGoogleGrey900; constexpr SkColor kTextColorPrimary = gfx::kGoogleGrey900;
constexpr SkColor kTextColorSecondary = gfx::kGoogleGrey700; constexpr SkColor kTextColorSecondary = gfx::kGoogleGrey700;
// TODO(dmblack): Move the other constants into ash::assistant::ui.
namespace assistant {
namespace ui {
// Returns the default font list for Assistant UI.
const gfx::FontList& GetDefaultFontList();
} // namespace ui
} // namespace assistant
} // namespace ash } // namespace ash
#endif // ASH_ASSISTANT_UI_ASSISTANT_UI_CONSTANTS_H_ #endif // ASH_ASSISTANT_UI_ASSISTANT_UI_CONSTANTS_H_
...@@ -154,7 +154,7 @@ void DialogPlate::InitKeyboardLayoutContainer( ...@@ -154,7 +154,7 @@ void DialogPlate::InitKeyboardLayoutContainer(
views::BoxLayout::CrossAxisAlignment::CROSS_AXIS_ALIGNMENT_CENTER); views::BoxLayout::CrossAxisAlignment::CROSS_AXIS_ALIGNMENT_CENTER);
gfx::FontList font_list = gfx::FontList font_list =
views::Textfield::GetDefaultFontList().DeriveWithSizeDelta(4); assistant::ui::GetDefaultFontList().DeriveWithSizeDelta(4);
// Textfield. // Textfield.
textfield_ = new views::Textfield(); textfield_ = new views::Textfield();
......
...@@ -84,7 +84,7 @@ void AssistantHeaderView::InitLayout() { ...@@ -84,7 +84,7 @@ void AssistantHeaderView::InitLayout() {
greeting_label_->SetAutoColorReadabilityEnabled(false); greeting_label_->SetAutoColorReadabilityEnabled(false);
greeting_label_->SetEnabledColor(kTextColorPrimary); greeting_label_->SetEnabledColor(kTextColorPrimary);
greeting_label_->SetFontList( greeting_label_->SetFontList(
views::Label::GetDefaultFontList() assistant::ui::GetDefaultFontList()
.DeriveWithSizeDelta(8) .DeriveWithSizeDelta(8)
.DeriveWithWeight(gfx::Font::Weight::MEDIUM)); .DeriveWithWeight(gfx::Font::Weight::MEDIUM));
greeting_label_->SetHorizontalAlignment( greeting_label_->SetHorizontalAlignment(
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "ash/assistant/model/assistant_query.h" #include "ash/assistant/model/assistant_query.h"
#include "ash/assistant/ui/assistant_ui_constants.h" #include "ash/assistant/ui/assistant_ui_constants.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h" #include "ui/views/layout/box_layout.h"
namespace ash { namespace ash {
...@@ -23,7 +22,8 @@ constexpr int kMinHeightDip = 32; ...@@ -23,7 +22,8 @@ constexpr int kMinHeightDip = 32;
views::StyledLabel::RangeStyleInfo CreateStyleInfo(SkColor color) { views::StyledLabel::RangeStyleInfo CreateStyleInfo(SkColor color) {
views::StyledLabel::RangeStyleInfo style; views::StyledLabel::RangeStyleInfo style;
style.custom_font = views::Label::GetDefaultFontList().DeriveWithSizeDelta(2); style.custom_font =
assistant::ui::GetDefaultFontList().DeriveWithSizeDelta(2);
style.override_color = color; style.override_color = color;
return style; return style;
} }
......
...@@ -17,7 +17,7 @@ AssistantTextElementView::AssistantTextElementView( ...@@ -17,7 +17,7 @@ AssistantTextElementView::AssistantTextElementView(
: views::Label(base::UTF8ToUTF16(text_element->text())) { : views::Label(base::UTF8ToUTF16(text_element->text())) {
SetAutoColorReadabilityEnabled(false); SetAutoColorReadabilityEnabled(false);
SetEnabledColor(kTextColorPrimary); SetEnabledColor(kTextColorPrimary);
SetFontList(views::Label::GetDefaultFontList() SetFontList(assistant::ui::GetDefaultFontList()
.DeriveWithSizeDelta(2) .DeriveWithSizeDelta(2)
.DeriveWithWeight(gfx::Font::Weight::MEDIUM)); .DeriveWithWeight(gfx::Font::Weight::MEDIUM));
SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT); SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT);
......
...@@ -14,35 +14,35 @@ namespace ash { ...@@ -14,35 +14,35 @@ namespace ash {
namespace assistant { namespace assistant {
namespace util { namespace util {
ui::LayerAnimationSequence* CreateLayerAnimationSequence( ::ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<ui::LayerAnimationElement> a, std::unique_ptr<::ui::LayerAnimationElement> a,
const LayerAnimationSequenceParams& params) { const LayerAnimationSequenceParams& params) {
return CreateLayerAnimationSequence(std::move(a), nullptr, nullptr, nullptr, return CreateLayerAnimationSequence(std::move(a), nullptr, nullptr, nullptr,
params); params);
} }
ui::LayerAnimationSequence* CreateLayerAnimationSequence( ::ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<ui::LayerAnimationElement> a, std::unique_ptr<::ui::LayerAnimationElement> a,
std::unique_ptr<ui::LayerAnimationElement> b, std::unique_ptr<::ui::LayerAnimationElement> b,
const LayerAnimationSequenceParams& params) { const LayerAnimationSequenceParams& params) {
return CreateLayerAnimationSequence(std::move(a), std::move(b), nullptr, return CreateLayerAnimationSequence(std::move(a), std::move(b), nullptr,
nullptr, params); nullptr, params);
} }
ui::LayerAnimationSequence* CreateLayerAnimationSequence( ::ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<ui::LayerAnimationElement> a, std::unique_ptr<::ui::LayerAnimationElement> a,
std::unique_ptr<ui::LayerAnimationElement> b, std::unique_ptr<::ui::LayerAnimationElement> b,
std::unique_ptr<ui::LayerAnimationElement> c, std::unique_ptr<::ui::LayerAnimationElement> c,
const LayerAnimationSequenceParams& params) { const LayerAnimationSequenceParams& params) {
return CreateLayerAnimationSequence(std::move(a), std::move(b), std::move(c), return CreateLayerAnimationSequence(std::move(a), std::move(b), std::move(c),
nullptr, params); nullptr, params);
} }
ui::LayerAnimationSequence* CreateLayerAnimationSequence( ::ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<ui::LayerAnimationElement> a, std::unique_ptr<::ui::LayerAnimationElement> a,
std::unique_ptr<ui::LayerAnimationElement> b, std::unique_ptr<::ui::LayerAnimationElement> b,
std::unique_ptr<ui::LayerAnimationElement> c, std::unique_ptr<::ui::LayerAnimationElement> c,
std::unique_ptr<ui::LayerAnimationElement> d, std::unique_ptr<::ui::LayerAnimationElement> d,
const LayerAnimationSequenceParams& params) { const LayerAnimationSequenceParams& params) {
ui::LayerAnimationSequence* layer_animation_sequence = ui::LayerAnimationSequence* layer_animation_sequence =
new ui::LayerAnimationSequence(); new ui::LayerAnimationSequence();
...@@ -63,32 +63,32 @@ ui::LayerAnimationSequence* CreateLayerAnimationSequence( ...@@ -63,32 +63,32 @@ ui::LayerAnimationSequence* CreateLayerAnimationSequence(
return layer_animation_sequence; return layer_animation_sequence;
} }
std::unique_ptr<ui::LayerAnimationElement> CreateOpacityElement( std::unique_ptr<::ui::LayerAnimationElement> CreateOpacityElement(
float opacity, float opacity,
const base::TimeDelta& duration, const base::TimeDelta& duration,
const gfx::Tween::Type& tween) { const gfx::Tween::Type& tween) {
std::unique_ptr<ui::LayerAnimationElement> layer_animation_element = std::unique_ptr<::ui::LayerAnimationElement> layer_animation_element =
ui::LayerAnimationElement::CreateOpacityElement(opacity, duration); ::ui::LayerAnimationElement::CreateOpacityElement(opacity, duration);
layer_animation_element->set_tween_type(tween); layer_animation_element->set_tween_type(tween);
return layer_animation_element; return layer_animation_element;
} }
std::unique_ptr<ui::LayerAnimationElement> CreateTransformElement( std::unique_ptr<::ui::LayerAnimationElement> CreateTransformElement(
const gfx::Transform& transform, const gfx::Transform& transform,
const base::TimeDelta& duration, const base::TimeDelta& duration,
const gfx::Tween::Type& tween) { const gfx::Tween::Type& tween) {
std::unique_ptr<ui::LayerAnimationElement> layer_animation_element = std::unique_ptr<::ui::LayerAnimationElement> layer_animation_element =
ui::LayerAnimationElement::CreateTransformElement(transform, duration); ::ui::LayerAnimationElement::CreateTransformElement(transform, duration);
layer_animation_element->set_tween_type(tween); layer_animation_element->set_tween_type(tween);
return layer_animation_element; return layer_animation_element;
} }
void StartLayerAnimationSequencesTogether( void StartLayerAnimationSequencesTogether(
ui::LayerAnimator* layer_animator, ::ui::LayerAnimator* layer_animator,
const std::vector<ui::LayerAnimationSequence*>& layer_animation_sequences, const std::vector<ui::LayerAnimationSequence*>& layer_animation_sequences,
ui::LayerAnimationObserver* observer) { ::ui::LayerAnimationObserver* observer) {
if (observer) { if (observer) {
for (ui::LayerAnimationSequence* layer_animation_sequence : for (::ui::LayerAnimationSequence* layer_animation_sequence :
layer_animation_sequences) { layer_animation_sequences) {
layer_animation_sequence->AddObserver(observer); layer_animation_sequence->AddObserver(observer);
} }
......
...@@ -34,46 +34,46 @@ struct LayerAnimationSequenceParams { ...@@ -34,46 +34,46 @@ struct LayerAnimationSequenceParams {
// Creates a LayerAnimationSequence containing the specified // Creates a LayerAnimationSequence containing the specified
// LayerAnimationElements with the given |params|. The method caller assumes // LayerAnimationElements with the given |params|. The method caller assumes
// ownership of the returned pointer. // ownership of the returned pointer.
ui::LayerAnimationSequence* CreateLayerAnimationSequence( ::ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<ui::LayerAnimationElement> a, std::unique_ptr<::ui::LayerAnimationElement> a,
const LayerAnimationSequenceParams& params = {}); const LayerAnimationSequenceParams& params = {});
// Creates a LayerAnimationSequence containing the specified // Creates a LayerAnimationSequence containing the specified
// LayerAnimationElements with the given |params|. The method caller assumes // LayerAnimationElements with the given |params|. The method caller assumes
// ownership of the returned pointer. // ownership of the returned pointer.
ui::LayerAnimationSequence* CreateLayerAnimationSequence( ::ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<ui::LayerAnimationElement> a, std::unique_ptr<::ui::LayerAnimationElement> a,
std::unique_ptr<ui::LayerAnimationElement> b, std::unique_ptr<::ui::LayerAnimationElement> b,
const LayerAnimationSequenceParams& params = {}); const LayerAnimationSequenceParams& params = {});
// Creates a LayerAnimationSequence containing the specified // Creates a LayerAnimationSequence containing the specified
// LayerAnimationElements with the given |params|. The method caller assumes // LayerAnimationElements with the given |params|. The method caller assumes
// ownership of the returned pointer. // ownership of the returned pointer.
ui::LayerAnimationSequence* CreateLayerAnimationSequence( ::ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<ui::LayerAnimationElement> a, std::unique_ptr<::ui::LayerAnimationElement> a,
std::unique_ptr<ui::LayerAnimationElement> b, std::unique_ptr<::ui::LayerAnimationElement> b,
std::unique_ptr<ui::LayerAnimationElement> c, std::unique_ptr<::ui::LayerAnimationElement> c,
const LayerAnimationSequenceParams& params = {}); const LayerAnimationSequenceParams& params = {});
// Creates a LayerAnimationSequence containing the specified // Creates a LayerAnimationSequence containing the specified
// LayerAnimationElements with the given |params|. The method caller assumes // LayerAnimationElements with the given |params|. The method caller assumes
// ownership of the returned pointer. // ownership of the returned pointer.
ui::LayerAnimationSequence* CreateLayerAnimationSequence( ::ui::LayerAnimationSequence* CreateLayerAnimationSequence(
std::unique_ptr<ui::LayerAnimationElement> a, std::unique_ptr<::ui::LayerAnimationElement> a,
std::unique_ptr<ui::LayerAnimationElement> b, std::unique_ptr<::ui::LayerAnimationElement> b,
std::unique_ptr<ui::LayerAnimationElement> c, std::unique_ptr<::ui::LayerAnimationElement> c,
std::unique_ptr<ui::LayerAnimationElement> d, std::unique_ptr<::ui::LayerAnimationElement> d,
const LayerAnimationSequenceParams& params = {}); const LayerAnimationSequenceParams& params = {});
// Creates a LayerAnimationElement to animate opacity with the given parameters. // Creates a LayerAnimationElement to animate opacity with the given parameters.
std::unique_ptr<ui::LayerAnimationElement> CreateOpacityElement( std::unique_ptr<::ui::LayerAnimationElement> CreateOpacityElement(
float opacity, float opacity,
const base::TimeDelta& duration, const base::TimeDelta& duration,
const gfx::Tween::Type& tween = gfx::Tween::Type::LINEAR); const gfx::Tween::Type& tween = gfx::Tween::Type::LINEAR);
// Creates a LayerAnimationElement to animate transform with the given // Creates a LayerAnimationElement to animate transform with the given
// parameters. // parameters.
std::unique_ptr<ui::LayerAnimationElement> CreateTransformElement( ::std::unique_ptr<::ui::LayerAnimationElement> CreateTransformElement(
const gfx::Transform& transform, const gfx::Transform& transform,
const base::TimeDelta& duration, const base::TimeDelta& duration,
const gfx::Tween::Type& tween = gfx::Tween::Type::LINEAR); const gfx::Tween::Type& tween = gfx::Tween::Type::LINEAR);
...@@ -82,9 +82,9 @@ std::unique_ptr<ui::LayerAnimationElement> CreateTransformElement( ...@@ -82,9 +82,9 @@ std::unique_ptr<ui::LayerAnimationElement> CreateTransformElement(
// |layer_animator|. If an optional |observer| is supplied, it will be added // |layer_animator|. If an optional |observer| is supplied, it will be added
// to each sequence in the animation set. // to each sequence in the animation set.
void StartLayerAnimationSequencesTogether( void StartLayerAnimationSequencesTogether(
ui::LayerAnimator* layer_animator, ::ui::LayerAnimator* layer_animator,
const std::vector<ui::LayerAnimationSequence*>& layer_animation_sequences, const std::vector<::ui::LayerAnimationSequence*>& layer_animation_sequences,
ui::LayerAnimationObserver* observer = nullptr); ::ui::LayerAnimationObserver* observer = nullptr);
} // namespace util } // namespace util
} // namespace assistant } // namespace assistant
......
...@@ -39,7 +39,7 @@ constexpr char kAssistantExploreWebUrl[] = ...@@ -39,7 +39,7 @@ constexpr char kAssistantExploreWebUrl[] =
// TODO(dmblack): Wire up actual Assistant Reminders URL. // TODO(dmblack): Wire up actual Assistant Reminders URL.
constexpr char kAssistantRemindersWebUrl[] = R"(data:text/html, constexpr char kAssistantRemindersWebUrl[] = R"(data:text/html,
<html> <html>
<body style="padding:0 32px;"> <body style="font-family:Google Sans,sans-serif;padding:0 32px;">
<h3>Assistant Reminders</h3> <h3>Assistant Reminders</h3>
<p>Coming soon. Meanwhile, please use your Android/iOS phone to access reminders.</p> <p>Coming soon. Meanwhile, please use your Android/iOS phone to access reminders.</p>
</body> </body>
...@@ -49,7 +49,7 @@ constexpr char kAssistantRemindersWebUrl[] = R"(data:text/html, ...@@ -49,7 +49,7 @@ constexpr char kAssistantRemindersWebUrl[] = R"(data:text/html,
// TODO(dmblack): Wire up actual Assistant Settings URL. // TODO(dmblack): Wire up actual Assistant Settings URL.
constexpr char kAssistantSettingsWebUrl[] = R"(data:text/html, constexpr char kAssistantSettingsWebUrl[] = R"(data:text/html,
<html> <html>
<body style="padding:0 32px;"> <body style="font-family:Google Sans,sans-serif;padding:0 32px;">
<h3>Assistant Settings</h3> <h3>Assistant Settings</h3>
<p>Coming soon. Meanwhile, please use your Android/iOS phone to access settings.</p> <p>Coming soon. Meanwhile, please use your Android/iOS phone to access settings.</p>
</body> </body>
......
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