Commit 424c9a88 authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Remove some more dependencies on MessageCenter.

Various changes:
- Start adding DEPS exceptions in preparation for banning
ui/message_center dependencies more broadly.
- Remove a file full of constants in ui/message_center
- delete some unnecessary message_center.h includes
- remove some message center color constants in favor of direct
  use of Label::SetAutoColorReadabilityEnabled.

BUG=783018,723882
TBR=rogerta@chromium.org

Change-Id: Ia7b9332d575a77581691f65f98c945754820c212
Reviewed-on: https://chromium-review.googlesource.com/879501Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534721}
parent 8b3db9c5
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/message_center/message_center.h" #include "ui/message_center/message_center.h"
#include "ui/message_center/message_center_style.h" #include "ui/message_center/message_center_style.h"
#include "ui/message_center/views/constants.h" #include "ui/message_center/public/cpp/message_center_constants.h"
#include "ui/views/background.h" #include "ui/views/background.h"
#include "ui/views/controls/button/label_button.h" #include "ui/views/controls/button/label_button.h"
#include "ui/views/layout/box_layout.h" #include "ui/views/layout/box_layout.h"
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/image/image.h" #include "ui/gfx/image/image.h"
#include "ui/message_center/message_center.h"
#include "ui/message_center/public/cpp/notifier_id.h" #include "ui/message_center/public/cpp/notifier_id.h"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
...@@ -228,9 +227,6 @@ class BackgroundModeManagerWithExtensionsTest : public testing::Test { ...@@ -228,9 +227,6 @@ class BackgroundModeManagerWithExtensionsTest : public testing::Test {
profile_manager_ = CreateTestingProfileManager(); profile_manager_ = CreateTestingProfileManager();
profile_ = profile_manager_->CreateTestingProfile("p1"); profile_ = profile_manager_->CreateTestingProfile("p1");
// Aura clears notifications from the message center at shutdown.
message_center::MessageCenter::Initialize();
test_keep_alive_.reset( test_keep_alive_.reset(
new ScopedKeepAlive(KeepAliveOrigin::BACKGROUND_MODE_MANAGER, new ScopedKeepAlive(KeepAliveOrigin::BACKGROUND_MODE_MANAGER,
KeepAliveRestartOption::DISABLED)); KeepAliveRestartOption::DISABLED));
...@@ -276,10 +272,6 @@ class BackgroundModeManagerWithExtensionsTest : public testing::Test { ...@@ -276,10 +272,6 @@ class BackgroundModeManagerWithExtensionsTest : public testing::Test {
// before tearing down the Message Center. // before tearing down the Message Center.
profile_manager_.reset(); profile_manager_.reset();
// Message Center shutdown must occur after the KeepAlive is released
// because clearing it will end up referencing the message center.
message_center::MessageCenter::Shutdown();
// Clear the shutdown flag to isolate the remaining effect of this test. // Clear the shutdown flag to isolate the remaining effect of this test.
browser_shutdown::SetTryingToQuit(false); browser_shutdown::SetTryingToQuit(false);
} }
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/display/test/display_manager_test_api.h" #include "ui/display/test/display_manager_test_api.h"
#include "ui/gfx/geometry/vector3d_f.h" #include "ui/gfx/geometry/vector3d_f.h"
#include "ui/message_center/message_center.h"
using ash::ResolutionNotificationController; using ash::ResolutionNotificationController;
...@@ -611,16 +610,11 @@ TEST_F(DisplayPrefsTest, PreventStore) { ...@@ -611,16 +610,11 @@ TEST_F(DisplayPrefsTest, PreventStore) {
EXPECT_FALSE(property->GetInteger("width", &width)); EXPECT_FALSE(property->GetInteger("width", &width));
EXPECT_FALSE(property->GetInteger("height", &height)); EXPECT_FALSE(property->GetInteger("height", &height));
// Revert the change. When timeout, 2nd button is revert. // Revert the change.
message_center::MessageCenter::Get()->ClickOnNotificationButton( shell->resolution_notification_controller()->RevertResolutionChange(false);
ResolutionNotificationController::kNotificationId, 1);
RunAllPendingInMessageLoop(); RunAllPendingInMessageLoop();
EXPECT_FALSE(
message_center::MessageCenter::Get()->FindVisibleNotificationById(
ResolutionNotificationController::kNotificationId));
// Once the notification is removed, the specified resolution will be stored // The specified resolution will be stored by SetDisplayMode.
// by SetDisplayMode.
ash::Shell::Get()->display_manager()->SetDisplayMode( ash::Shell::Get()->display_manager()->SetDisplayMode(
id, display::ManagedDisplayMode(gfx::Size(300, 200), 60.0f, false, true)); id, display::ManagedDisplayMode(gfx::Size(300, 200), 60.0f, false, true));
UpdateDisplay("300x200#500x400|400x300|300x200"); UpdateDisplay("300x200#500x400|400x300|300x200");
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include "content/public/browser/notification_source.h" #include "content/public/browser/notification_source.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/message_center/message_center.h"
using ::testing::_; using ::testing::_;
using ::testing::Invoke; using ::testing::Invoke;
......
include_rules = [
"+ui/message_center",
]
...@@ -396,6 +396,10 @@ AutotestPrivateGetVisibleNotificationsFunction::Run() { ...@@ -396,6 +396,10 @@ AutotestPrivateGetVisibleNotificationsFunction::Run() {
DVLOG(1) << "AutotestPrivateGetVisibleNotificationsFunction"; DVLOG(1) << "AutotestPrivateGetVisibleNotificationsFunction";
std::unique_ptr<base::ListValue> values(new base::ListValue); std::unique_ptr<base::ListValue> values(new base::ListValue);
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// TODO(estade): we can't rely on the message center being available in the
// browser process (in --mash). Make autotests that use it fail loudly. See
// crbug.com/804570
CHECK(message_center::MessageCenter::Get());
for (auto* notification : for (auto* notification :
message_center::MessageCenter::Get()->GetVisibleNotifications()) { message_center::MessageCenter::Get()->GetVisibleNotifications()) {
auto result = std::make_unique<base::DictionaryValue>(); auto result = std::make_unique<base::DictionaryValue>();
......
...@@ -39,9 +39,9 @@ ...@@ -39,9 +39,9 @@
#include "storage/browser/quota/storage_observer.h" #include "storage/browser/quota/storage_observer.h"
#include "third_party/WebKit/common/quota/quota_types.mojom.h" #include "third_party/WebKit/common/quota/quota_types.mojom.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/message_center/public/cpp/message_center_constants.h"
#include "ui/message_center/public/cpp/notification.h" #include "ui/message_center/public/cpp/notification.h"
#include "ui/message_center/public/cpp/notifier_id.h" #include "ui/message_center/public/cpp/notifier_id.h"
#include "ui/message_center/views/constants.h"
using content::BrowserThread; using content::BrowserThread;
......
include_rules = [ include_rules = [
# TODO(mash): Remove. http://crbug.com/723882
"+ash",
"+dbus", "+dbus",
"+ui/message_center",
] ]
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/chromeos/devicetype_utils.h" #include "ui/chromeos/devicetype_utils.h"
#include "ui/message_center/message_center_types.h"
#include "ui/message_center/public/cpp/notification_types.h" #include "ui/message_center/public/cpp/notification_types.h"
namespace { namespace {
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/clipboard_monitor.h" #include "ui/base/clipboard/clipboard_monitor.h"
#include "ui/base/clipboard/clipboard_observer.h" #include "ui/base/clipboard/clipboard_observer.h"
#include "ui/message_center/message_center_observer.h"
class ChromeScreenshotGrabberBrowserTest class ChromeScreenshotGrabberBrowserTest
: public InProcessBrowserTest, : public InProcessBrowserTest,
......
include_rules = [
"+ui/message_center",
]
...@@ -118,7 +118,6 @@ jumbo_component("message_center") { ...@@ -118,7 +118,6 @@ jumbo_component("message_center") {
sources += [ sources += [
"views/bounded_label.cc", "views/bounded_label.cc",
"views/bounded_label.h", "views/bounded_label.h",
"views/constants.h",
"views/desktop_popup_alignment_delegate.cc", "views/desktop_popup_alignment_delegate.cc",
"views/desktop_popup_alignment_delegate.h", "views/desktop_popup_alignment_delegate.h",
"views/message_popup_collection.cc", "views/message_popup_collection.cc",
......
...@@ -278,9 +278,9 @@ BoundedLabel::BoundedLabel(const base::string16& text) ...@@ -278,9 +278,9 @@ BoundedLabel::BoundedLabel(const base::string16& text)
BoundedLabel::~BoundedLabel() { BoundedLabel::~BoundedLabel() {
} }
void BoundedLabel::SetColors(SkColor textColor, SkColor backgroundColor) { void BoundedLabel::SetColor(SkColor text_color) {
label_->SetEnabledColor(textColor); label_->SetEnabledColor(text_color);
label_->SetBackgroundColor(backgroundColor); label_->SetAutoColorReadabilityEnabled(false);
} }
void BoundedLabel::SetLineHeight(int height) { void BoundedLabel::SetLineHeight(int height) {
......
...@@ -38,7 +38,7 @@ class MESSAGE_CENTER_EXPORT BoundedLabel : public views::View { ...@@ -38,7 +38,7 @@ class MESSAGE_CENTER_EXPORT BoundedLabel : public views::View {
BoundedLabel(const base::string16& text); BoundedLabel(const base::string16& text);
~BoundedLabel() override; ~BoundedLabel() override;
void SetColors(SkColor textColor, SkColor backgroundColor); void SetColor(SkColor text_color);
void SetLineHeight(int height); // Pass in 0 for default height. void SetLineHeight(int height); // Pass in 0 for default height.
void SetLineLimit(int lines); // Pass in -1 for no limit. void SetLineLimit(int lines); // Pass in -1 for no limit.
void SetText(const base::string16& text); // Additionally clears caches. void SetText(const base::string16& text); // Additionally clears caches.
......
// Copyright 2013 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.
#ifndef UI_MESSAGE_CENTER_VIEWS_CONSTANTS_H_
#define UI_MESSAGE_CENTER_VIEWS_CONSTANTS_H_
#include <stddef.h>
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/size.h"
#include "ui/message_center/public/cpp/message_center_constants.h"
namespace message_center {
// The text background colors below are used only to keep
// view::Label from modifying the text color and will not actually be drawn.
// See view::Label's RecalculateColors() for details.
const SkColor kRegularTextBackgroundColor = SK_ColorWHITE;
const SkColor kDimTextBackgroundColor = SK_ColorWHITE;
const SkColor kContextTextBackgroundColor = SK_ColorWHITE;
const int kTextBottomPadding = 12;
const int kItemTitleToMessagePadding = 3;
const int kButtonVerticalPadding = 0;
const int kButtonTitleTopPadding = 0;
const int kNotificationSettingsPadding = 5;
// Character limits: Displayed text will be subject to the line limits above,
// but we also remove trailing characters from text to reduce processing cost.
// Character limit = pixels per line * line limit / min. pixels per character.
const int kMinPixelsPerTitleCharacter = 4;
const size_t kMessageCharacterLimit =
kNotificationWidth * kMessageExpandedLineLimit / 3;
const size_t kContextMessageCharacterLimit =
kNotificationWidth * kContextMessageLineLimit / 3;
} // namespace message_center
#endif // UI_MESSAGE_CENTER_VIEWS_CONSTANTS_H_
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "ui/gfx/canvas.h" #include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/insets.h"
#include "ui/message_center/public/cpp/message_center_constants.h" #include "ui/message_center/public/cpp/message_center_constants.h"
#include "ui/message_center/views/constants.h"
#include "ui/views/background.h" #include "ui/views/background.h"
#include "ui/views/border.h" #include "ui/views/border.h"
#include "ui/views/controls/image_view.h" #include "ui/views/controls/image_view.h"
...@@ -25,8 +24,7 @@ NotificationButton::NotificationButton(views::ButtonListener* listener) ...@@ -25,8 +24,7 @@ NotificationButton::NotificationButton(views::ButtonListener* listener)
SetBackground(views::CreateSolidBackground(kNotificationBackgroundColor)); SetBackground(views::CreateSolidBackground(kNotificationBackgroundColor));
set_notify_enter_exit_on_child(true); set_notify_enter_exit_on_child(true);
SetLayoutManager(std::make_unique<views::BoxLayout>( SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::kHorizontal, views::BoxLayout::kHorizontal, gfx::Insets(0, kButtonHorizontalPadding),
gfx::Insets(kButtonVerticalPadding, kButtonHorizontalPadding),
kButtonIconToTitlePadding)); kButtonIconToTitlePadding));
SetFocusPainter(views::Painter::CreateSolidFocusPainter( SetFocusPainter(views::Painter::CreateSolidFocusPainter(
kFocusBorderColor, gfx::Insets(1, 2, 2, 2))); kFocusBorderColor, gfx::Insets(1, 2, 2, 2)));
...@@ -53,17 +51,14 @@ void NotificationButton::SetIcon(const gfx::ImageSkia& image) { ...@@ -53,17 +51,14 @@ void NotificationButton::SetIcon(const gfx::ImageSkia& image) {
} }
void NotificationButton::SetTitle(const base::string16& title) { void NotificationButton::SetTitle(const base::string16& title) {
if (title_ != NULL) if (title_)
delete title_; // This removes the title from this view's children. delete title_; // This removes the title from this view's children.
if (title.empty()) { title_ = nullptr;
title_ = NULL; if (!title.empty()) {
} else {
title_ = new views::Label(title); title_ = new views::Label(title);
title_->SetHorizontalAlignment(gfx::ALIGN_LEFT); title_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
title_->SetEnabledColor(kRegularTextColor); title_->SetEnabledColor(kRegularTextColor);
title_->SetBackgroundColor(kRegularTextBackgroundColor); title_->SetAutoColorReadabilityEnabled(false);
title_->SetBorder(
views::CreateEmptyBorder(kButtonTitleTopPadding, 0, 0, 0));
AddChildView(title_); AddChildView(title_);
} }
SetAccessibleName(title); SetAccessibleName(title);
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "ui/message_center/public/cpp/notification.h" #include "ui/message_center/public/cpp/notification.h"
#include "ui/message_center/public/cpp/notification_types.h" #include "ui/message_center/public/cpp/notification_types.h"
#include "ui/message_center/views/bounded_label.h" #include "ui/message_center/views/bounded_label.h"
#include "ui/message_center/views/constants.h"
#include "ui/message_center/views/notification_button.h" #include "ui/message_center/views/notification_button.h"
#include "ui/message_center/views/notification_control_buttons_view.h" #include "ui/message_center/views/notification_control_buttons_view.h"
#include "ui/message_center/views/padded_button.h" #include "ui/message_center/views/padded_button.h"
...@@ -52,6 +51,18 @@ namespace message_center { ...@@ -52,6 +51,18 @@ namespace message_center {
namespace { namespace {
const int kTextBottomPadding = 12;
const int kItemTitleToMessagePadding = 3;
// Character limit = pixels per line * line limit / min. pixels per character.
const int kMinPixelsPerTitleCharacter = 4;
constexpr size_t kMessageCharacterLimit =
kNotificationWidth * kMessageExpandedLineLimit / 3;
constexpr size_t kContextMessageCharacterLimit =
kNotificationWidth * kContextMessageLineLimit / 3;
// Dimensions. // Dimensions.
const int kProgressBarBottomPadding = 0; const int kProgressBarBottomPadding = 0;
...@@ -109,14 +120,14 @@ NotificationItemView::NotificationItemView(const NotificationItem& item) { ...@@ -109,14 +120,14 @@ NotificationItemView::NotificationItemView(const NotificationItem& item) {
title->set_collapse_when_hidden(true); title->set_collapse_when_hidden(true);
title->SetHorizontalAlignment(gfx::ALIGN_LEFT); title->SetHorizontalAlignment(gfx::ALIGN_LEFT);
title->SetEnabledColor(kRegularTextColor); title->SetEnabledColor(kRegularTextColor);
title->SetBackgroundColor(kRegularTextBackgroundColor); title->SetAutoColorReadabilityEnabled(false);
AddChildView(title); AddChildView(title);
views::Label* message = new views::Label(item.message); views::Label* message = new views::Label(item.message);
message->set_collapse_when_hidden(true); message->set_collapse_when_hidden(true);
message->SetHorizontalAlignment(gfx::ALIGN_LEFT); message->SetHorizontalAlignment(gfx::ALIGN_LEFT);
message->SetEnabledColor(kDimTextColor); message->SetEnabledColor(kDimTextColor);
message->SetBackgroundColor(kDimTextBackgroundColor); message->SetAutoColorReadabilityEnabled(false);
AddChildView(message); AddChildView(message);
PreferredSizeChanged(); PreferredSizeChanged();
...@@ -391,19 +402,18 @@ void NotificationView::CreateOrUpdateTitleView( ...@@ -391,19 +402,18 @@ void NotificationView::CreateOrUpdateTitleView(
const gfx::FontList& font_list = const gfx::FontList& font_list =
views::Label().font_list().DeriveWithSizeDelta(2); views::Label().font_list().DeriveWithSizeDelta(2);
int title_character_limit = constexpr int kTitleCharacterLimit =
kNotificationWidth * kMaxTitleLines / kMinPixelsPerTitleCharacter; kNotificationWidth * kMaxTitleLines / kMinPixelsPerTitleCharacter;
base::string16 title = gfx::TruncateString(notification.title(), base::string16 title = gfx::TruncateString(
title_character_limit, notification.title(), kTitleCharacterLimit, gfx::WORD_BREAK);
gfx::WORD_BREAK);
if (!title_view_) { if (!title_view_) {
int padding = kTitleLineHeight - font_list.GetHeight(); int padding = kTitleLineHeight - font_list.GetHeight();
title_view_ = new BoundedLabel(title, font_list); title_view_ = new BoundedLabel(title, font_list);
title_view_->SetLineHeight(kTitleLineHeight); title_view_->SetLineHeight(kTitleLineHeight);
title_view_->SetLineLimit(kMaxTitleLines); title_view_->SetLineLimit(kMaxTitleLines);
title_view_->SetColors(kRegularTextColor, kRegularTextBackgroundColor); title_view_->SetColor(kRegularTextColor);
title_view_->SetBorder(MakeTextBorder(padding, 3, 0)); title_view_->SetBorder(MakeTextBorder(padding, 3, 0));
top_view_->AddChildView(title_view_); top_view_->AddChildView(title_view_);
} else { } else {
...@@ -429,7 +439,7 @@ void NotificationView::CreateOrUpdateMessageView( ...@@ -429,7 +439,7 @@ void NotificationView::CreateOrUpdateMessageView(
int padding = kMessageLineHeight - views::Label().font_list().GetHeight(); int padding = kMessageLineHeight - views::Label().font_list().GetHeight();
message_view_ = new BoundedLabel(text); message_view_ = new BoundedLabel(text);
message_view_->SetLineHeight(kMessageLineHeight); message_view_->SetLineHeight(kMessageLineHeight);
message_view_->SetColors(kRegularTextColor, kDimTextBackgroundColor); message_view_->SetColor(kRegularTextColor);
message_view_->SetBorder(MakeTextBorder(padding, 4, 0)); message_view_->SetBorder(MakeTextBorder(padding, 4, 0));
top_view_->AddChildView(message_view_); top_view_->AddChildView(message_view_);
} else { } else {
...@@ -473,8 +483,7 @@ void NotificationView::CreateOrUpdateContextMessageView( ...@@ -473,8 +483,7 @@ void NotificationView::CreateOrUpdateContextMessageView(
context_message_view_ = new BoundedLabel(message); context_message_view_ = new BoundedLabel(message);
context_message_view_->SetLineLimit(kContextMessageLineLimit); context_message_view_->SetLineLimit(kContextMessageLineLimit);
context_message_view_->SetLineHeight(kMessageLineHeight); context_message_view_->SetLineHeight(kMessageLineHeight);
context_message_view_->SetColors(kDimTextColor, context_message_view_->SetColor(kDimTextColor);
kContextTextBackgroundColor);
context_message_view_->SetBorder(MakeTextBorder(padding, 4, 0)); context_message_view_->SetBorder(MakeTextBorder(padding, 4, 0));
top_view_->AddChildView(context_message_view_); top_view_->AddChildView(context_message_view_);
} else { } else {
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "ui/message_center/public/cpp/notification_types.h" #include "ui/message_center/public/cpp/notification_types.h"
#include "ui/message_center/vector_icons.h" #include "ui/message_center/vector_icons.h"
#include "ui/message_center/views/bounded_label.h" #include "ui/message_center/views/bounded_label.h"
#include "ui/message_center/views/constants.h"
#include "ui/message_center/views/notification_control_buttons_view.h" #include "ui/message_center/views/notification_control_buttons_view.h"
#include "ui/message_center/views/notification_header_view.h" #include "ui/message_center/views/notification_header_view.h"
#include "ui/message_center/views/padded_button.h" #include "ui/message_center/views/padded_button.h"
...@@ -120,8 +119,14 @@ constexpr int kMessageViewWidth = ...@@ -120,8 +119,14 @@ constexpr int kMessageViewWidth =
kLeftContentPadding.right() - kContentRowPadding.left() - kLeftContentPadding.right() - kContentRowPadding.left() -
kContentRowPadding.right(); kContentRowPadding.right();
// "Roboto-Regular, 13sp" is specified in the mock. const int kMinPixelsPerTitleCharacter = 4;
constexpr int kTextFontSize = 13;
// Character limit = pixels per line * line limit / min. pixels per character.
constexpr size_t kMessageCharacterLimit =
kNotificationWidth * kMessageExpandedLineLimit / 3;
// The default is 12, so this normally come out to 13.
constexpr int kTextFontSizeDelta = 1;
// In progress notification, if both the title and the message are long, the // In progress notification, if both the title and the message are long, the
// message would be prioritized and the title would be elided. // message would be prioritized and the title would be elided.
...@@ -132,10 +137,8 @@ constexpr double kProgressNotificationMessageRatio = 0.7; ...@@ -132,10 +137,8 @@ constexpr double kProgressNotificationMessageRatio = 0.7;
// FontList for the texts except for the header. // FontList for the texts except for the header.
gfx::FontList GetTextFontList() { gfx::FontList GetTextFontList() {
gfx::Font default_font; gfx::Font default_font;
int font_size_delta = kTextFontSize - default_font.GetFontSize(); gfx::Font font = default_font.Derive(kTextFontSizeDelta, gfx::Font::NORMAL,
gfx::Font font = default_font.Derive(font_size_delta, gfx::Font::NORMAL,
gfx::Font::Weight::NORMAL); gfx::Font::Weight::NORMAL);
DCHECK_EQ(kTextFontSize, font.GetFontSize());
return gfx::FontList(font); return gfx::FontList(font);
} }
...@@ -173,7 +176,7 @@ ItemView::ItemView(const NotificationItem& item) { ...@@ -173,7 +176,7 @@ ItemView::ItemView(const NotificationItem& item) {
title->set_collapse_when_hidden(true); title->set_collapse_when_hidden(true);
title->SetHorizontalAlignment(gfx::ALIGN_LEFT); title->SetHorizontalAlignment(gfx::ALIGN_LEFT);
title->SetEnabledColor(kRegularTextColorMD); title->SetEnabledColor(kRegularTextColorMD);
title->SetBackgroundColor(kDimTextBackgroundColor); title->SetAutoColorReadabilityEnabled(false);
AddChildView(title); AddChildView(title);
views::Label* message = new views::Label(l10n_util::GetStringFUTF16( views::Label* message = new views::Label(l10n_util::GetStringFUTF16(
...@@ -182,7 +185,7 @@ ItemView::ItemView(const NotificationItem& item) { ...@@ -182,7 +185,7 @@ ItemView::ItemView(const NotificationItem& item) {
message->set_collapse_when_hidden(true); message->set_collapse_when_hidden(true);
message->SetHorizontalAlignment(gfx::ALIGN_LEFT); message->SetHorizontalAlignment(gfx::ALIGN_LEFT);
message->SetEnabledColor(kDimTextColorMD); message->SetEnabledColor(kDimTextColorMD);
message->SetBackgroundColor(kDimTextBackgroundColor); message->SetAutoColorReadabilityEnabled(false);
AddChildView(message); AddChildView(message);
} }
...@@ -886,7 +889,7 @@ void NotificationViewMD::CreateOrUpdateMessageView( ...@@ -886,7 +889,7 @@ void NotificationViewMD::CreateOrUpdateMessageView(
if (!message_view_) { if (!message_view_) {
message_view_ = new BoundedLabel(text, font_list); message_view_ = new BoundedLabel(text, font_list);
message_view_->SetLineLimit(kMaxLinesForMessageView); message_view_->SetLineLimit(kMaxLinesForMessageView);
message_view_->SetColors(kDimTextColorMD, kContextTextBackgroundColor); message_view_->SetColor(kDimTextColorMD);
left_content_->AddChildView(message_view_); left_content_->AddChildView(message_view_);
} else { } else {
......
...@@ -25,9 +25,9 @@ ...@@ -25,9 +25,9 @@
#include "ui/message_center/message_center.h" #include "ui/message_center/message_center.h"
#include "ui/message_center/message_center_style.h" #include "ui/message_center/message_center_style.h"
#include "ui/message_center/notification_list.h" #include "ui/message_center/notification_list.h"
#include "ui/message_center/public/cpp/message_center_constants.h"
#include "ui/message_center/public/cpp/notification.h" #include "ui/message_center/public/cpp/notification.h"
#include "ui/message_center/public/cpp/notification_types.h" #include "ui/message_center/public/cpp/notification_types.h"
#include "ui/message_center/views/constants.h"
#include "ui/message_center/views/message_view_factory.h" #include "ui/message_center/views/message_view_factory.h"
#include "ui/message_center/views/notification_button.h" #include "ui/message_center/views/notification_button.h"
#include "ui/message_center/views/notification_control_buttons_view.h" #include "ui/message_center/views/notification_control_buttons_view.h"
......
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