Commit 672fd5cd authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Add material design icon to ARC initial notification.

This CL adds new material design icon to ARC notification.
This CL also removes notification buttons on initial notification
based on UX review (https://crbug.com/726241#c20).

The icon and the accent color are effective only when
chrome://flags/#enable-message-center-new-style-notification
is Enabled (which is ToT default).

TEST=manual
BUG=726241

Change-Id: Id617ad8fa8ab42f5494cf53fd27100397a09ceee
Reviewed-on: https://chromium-review.googlesource.com/662837Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Reviewed-by: default avatarYusuke Sato <yusukes@chromium.org>
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#502165}
parent a0ff0ea2
......@@ -123,6 +123,7 @@ aggregate_vector_icons("chrome_vector_icons") {
"arc_migrate_encryption_notification.icon",
"notification_captive_portal.icon",
"notification_google.icon",
"notification_play_prism.icon",
"notification_warning.icon",
"warning_badge_circle.1x.icon",
"warning_badge_circle.icon",
......
// Copyright 2017 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.
CANVAS_DIMENSIONS, 18,
MOVE_TO, 15.36f, 8.1f,
R_LINE_TO, -2.38f, -1.39f,
LINE_TO, 10.76f, 9,
R_LINE_TO, 2.22f, 2.29f,
R_LINE_TO, 2.38f, -1.39f,
CUBIC_TO, 15.79f, 9.65f, 16, 9.33f, 16, 9,
R_CUBIC_TO, 0, -0.33f, -0.21f, -0.65f, -0.64f, -0.9f,
CLOSE,
MOVE_TO, 3.33f, 1.36f,
R_LINE_TO, 6.55f, 6.74f,
R_LINE_TO, 1.98f, -2.04f,
LINE_TO, 3.54f, 1.21f,
R_CUBIC_TO, -0.05f, -0.03f, -0.11f, -0.06f, -0.16f, -0.08f,
R_CUBIC_TO, -0.13f, -0.06f, -0.23f, 0.04f, -0.12f, 0.17f,
R_CUBIC_TO, 0.02f, 0.02f, 0.05f, 0.04f, 0.07f, 0.06f,
CLOSE,
R_MOVE_TO, 0, 15.28f,
R_LINE_TO, -0.06f, 0.06f,
R_CUBIC_TO, -0.12f, 0.12f, -0.02f, 0.22f, 0.12f, 0.17f,
R_CUBIC_TO, 0.06f, -0.02f, 0.11f, -0.05f, 0.16f, -0.08f,
R_LINE_TO, 8.31f, -4.85f,
R_LINE_TO, -1.98f, -2.04f,
R_CUBIC_TO, 0, 0, -5.6f, 5.77f, -6.55f, 6.74f,
CLOSE,
MOVE_TO, 9, 9,
LINE_TO, 2.3f, 2.1f,
CUBIC_TO, 2.15f, 1.95f, 2, 2.05f, 2, 2.26f,
R_V_LINE_TO, 13.49f,
R_CUBIC_TO, 0, 0.21f, 0.15f, 0.3f, 0.3f, 0.15f,
LINE_TO, 9, 9,
CLOSE,
END
......@@ -11,6 +11,7 @@
#include "base/macros.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/chromeos/arc/arc_optin_uma.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
#include "chrome/browser/profiles/profile.h"
......@@ -26,6 +27,7 @@
#include "ui/message_center/message_center_observer.h"
#include "ui/message_center/notification.h"
#include "ui/message_center/notification_delegate.h"
#include "ui/message_center/public/cpp/message_center_switches.h"
#include "url/gurl.h"
namespace {
......@@ -63,6 +65,8 @@ class ArcAuthNotificationDelegate
// message_center::NotificationDelegate
void Display() override { StartObserving(); }
// TODO(tetsui): Remove this method when IsNewStyleNotificationEnabled() flag
// is removed.
void ButtonClick(int button_index) override {
StopObserving();
if (button_index == 0) {
......@@ -148,22 +152,35 @@ void ArcAuthNotification::Show() {
notifier_id.profile_id =
multi_user_util::GetAccountIdFromProfile(profile_).GetUserEmail();
message_center::RichNotificationData data;
data.buttons.push_back(message_center::ButtonInfo(
l10n_util::GetStringUTF16(IDS_ARC_OPEN_PLAY_STORE_NOTIFICATION_BUTTON)));
data.buttons.push_back(message_center::ButtonInfo(
l10n_util::GetStringUTF16(IDS_ARC_CANCEL_NOTIFICATION_BUTTON)));
ui::ResourceBundle& resource_bundle = ui::ResourceBundle::GetSharedInstance();
std::unique_ptr<message_center::Notification> notification(
new message_center::Notification(
message_center::NOTIFICATION_TYPE_SIMPLE, kFirstRunNotificationId,
l10n_util::GetStringFUTF16(IDS_ARC_NOTIFICATION_TITLE,
ui::GetChromeOSDeviceName()),
l10n_util::GetStringUTF16(IDS_ARC_NOTIFICATION_MESSAGE),
resource_bundle.GetImageNamed(IDR_ARC_PLAY_STORE_NOTIFICATION),
l10n_util::GetStringUTF16(IDS_ARC_NOTIFICATION_DISPLAY_SOURCE),
GURL(), notifier_id, data,
new ArcAuthNotificationDelegate(profile_)));
std::unique_ptr<message_center::Notification> notification;
if (message_center::IsNewStyleNotificationEnabled()) {
notification = message_center::Notification::CreateSystemNotification(
message_center::NOTIFICATION_TYPE_SIMPLE, kFirstRunNotificationId,
l10n_util::GetStringFUTF16(IDS_ARC_NOTIFICATION_TITLE,
ui::GetChromeOSDeviceName()),
l10n_util::GetStringUTF16(IDS_ARC_NOTIFICATION_MESSAGE), gfx::Image(),
l10n_util::GetStringUTF16(IDS_ARC_NOTIFICATION_DISPLAY_SOURCE), GURL(),
notifier_id, message_center::RichNotificationData(),
new ArcAuthNotificationDelegate(profile_), kNotificationPlayPrismIcon,
message_center::SystemNotificationWarningLevel::NORMAL);
} else {
message_center::RichNotificationData data;
data.buttons.push_back(message_center::ButtonInfo(l10n_util::GetStringUTF16(
IDS_ARC_OPEN_PLAY_STORE_NOTIFICATION_BUTTON)));
data.buttons.push_back(message_center::ButtonInfo(
l10n_util::GetStringUTF16(IDS_ARC_CANCEL_NOTIFICATION_BUTTON)));
ui::ResourceBundle& resource_bundle =
ui::ResourceBundle::GetSharedInstance();
notification = std::make_unique<message_center::Notification>(
message_center::NOTIFICATION_TYPE_SIMPLE, kFirstRunNotificationId,
l10n_util::GetStringFUTF16(IDS_ARC_NOTIFICATION_TITLE,
ui::GetChromeOSDeviceName()),
l10n_util::GetStringUTF16(IDS_ARC_NOTIFICATION_MESSAGE),
resource_bundle.GetImageNamed(IDR_ARC_PLAY_STORE_NOTIFICATION),
l10n_util::GetStringUTF16(IDS_ARC_NOTIFICATION_DISPLAY_SOURCE), GURL(),
notifier_id, data, new ArcAuthNotificationDelegate(profile_));
}
message_center::MessageCenter::Get()->AddNotification(
std::move(notification));
}
......
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