Commit 124ae73c authored by Yue Li's avatar Yue Li Committed by Commit Bot

Add icon for assistant hotword enable notification

Also update icon for assistant server notifications.

Bug: b/111936939
Test: Manual Test
Change-Id: I91d013daba51174d9532b6806484f1ed42809f14
Reviewed-on: https://chromium-review.googlesource.com/1162976
Commit-Queue: Yue Li <updowndota@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581007}
parent b797c412
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#include "ash/assistant/assistant_controller.h" #include "ash/assistant/assistant_controller.h"
#include "ash/new_window_controller.h" #include "ash/new_window_controller.h"
#include "ash/public/cpp/vector_icons/vector_icons.h"
#include "ash/public/interfaces/voice_interaction_controller.mojom.h" #include "ash/public/interfaces/voice_interaction_controller.mojom.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h" #include "ash/strings/grit/ash_strings.h"
#include "ash/voice_interaction/voice_interaction_controller.h" #include "ash/voice_interaction/voice_interaction_controller.h"
...@@ -152,7 +152,7 @@ void AssistantNotificationController::OnShowNotification( ...@@ -152,7 +152,7 @@ void AssistantNotificationController::OnShowNotification(
new AssistantNotificationDelegate(weak_factory_.GetWeakPtr(), new AssistantNotificationDelegate(weak_factory_.GetWeakPtr(),
assistant_controller_->GetWeakPtr(), assistant_controller_->GetWeakPtr(),
notification.Clone()), notification.Clone()),
kAssistantIcon, kNotificationAssistantIcon,
message_center::SystemNotificationWarningLevel::NORMAL); message_center::SystemNotificationWarningLevel::NORMAL);
system_notification->set_priority(message_center::DEFAULT_PRIORITY); system_notification->set_priority(message_center::DEFAULT_PRIORITY);
message_center->AddNotification(std::move(system_notification)); message_center->AddNotification(std::move(system_notification));
......
...@@ -110,7 +110,8 @@ MessageCenterController::MessageCenterController() { ...@@ -110,7 +110,8 @@ MessageCenterController::MessageCenterController() {
std::make_unique<PopupNotificationBlocker>(MessageCenter::Get()); std::make_unique<PopupNotificationBlocker>(MessageCenter::Get());
} }
message_center::RegisterVectorIcons({&kNotificationCaptivePortalIcon, message_center::RegisterVectorIcons({&kNotificationAssistantIcon,
&kNotificationCaptivePortalIcon,
&kNotificationCellularAlertIcon, &kNotificationCellularAlertIcon,
&kNotificationDownloadIcon, &kNotificationDownloadIcon,
&kNotificationEndOfSupportIcon, &kNotificationEndOfSupportIcon,
......
...@@ -9,6 +9,7 @@ aggregate_vector_icons("ash_public_vector_icons") { ...@@ -9,6 +9,7 @@ aggregate_vector_icons("ash_public_vector_icons") {
icon_directory = "." icon_directory = "."
icons = [ icons = [
"notification_assistant.icon",
"notification_captive_portal.icon", "notification_captive_portal.icon",
"notification_cellular_alert.icon", "notification_cellular_alert.icon",
"notification_download.icon", "notification_download.icon",
......
// 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.
CANVAS_DIMENSIONS, 96,
CIRCLE, 86, 30, 6,
NEW_PATH,
CIRCLE, 68, 44, 12,
NEW_PATH,
CIRCLE, 68, 74, 14,
NEW_PATH,
CIRCLE, 28, 32, 24
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "chrome/browser/ui/ash/assistant/assistant_setup.h" #include "chrome/browser/ui/ash/assistant/assistant_setup.h"
#include "ash/public/cpp/vector_icons/vector_icons.h"
#include "ash/public/interfaces/assistant_controller.mojom.h" #include "ash/public/interfaces/assistant_controller.mojom.h"
#include "ash/public/interfaces/constants.mojom.h" #include "ash/public/interfaces/constants.mojom.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
...@@ -18,14 +19,17 @@ ...@@ -18,14 +19,17 @@
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/connector.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/message_center/public/cpp/notification.h" #include "ui/message_center/public/cpp/notification.h"
#include "ui/message_center/public/cpp/notification_delegate.h" #include "ui/message_center/public/cpp/notification_delegate.h"
namespace { namespace {
constexpr char kAssistantDisplaySource[] = "Assistant";
constexpr char kAssistantSubPage[] = "googleAssistant"; constexpr char kAssistantSubPage[] = "googleAssistant";
constexpr char kHotwordNotificationId[] = "assistant/hotword"; constexpr char kHotwordNotificationId[] = "assistant/hotword";
constexpr char kNotifierAssistant[] = "assistant"; constexpr char kNotifierAssistant[] = "assistant";
constexpr int kAssistantIconSize = 24;
// Delegate for assistant hotword notification. // Delegate for assistant hotword notification.
class AssistantHotwordNotificationDelegate class AssistantHotwordNotificationDelegate
...@@ -111,7 +115,8 @@ void AssistantSetup::OnStateChanged(ash::mojom::VoiceInteractionState state) { ...@@ -111,7 +115,8 @@ void AssistantSetup::OnStateChanged(ash::mojom::VoiceInteractionState state) {
const base::string16 title = const base::string16 title =
l10n_util::GetStringUTF16(IDS_ASSISTANT_HOTWORD_NOTIFICATION_TITLE); l10n_util::GetStringUTF16(IDS_ASSISTANT_HOTWORD_NOTIFICATION_TITLE);
const base::string16 display_source = base::UTF8ToUTF16(kNotifierAssistant); const base::string16 display_source =
base::UTF8ToUTF16(kAssistantDisplaySource);
message_center::Notification notification( message_center::Notification notification(
message_center::NOTIFICATION_TYPE_SIMPLE, kHotwordNotificationId, title, message_center::NOTIFICATION_TYPE_SIMPLE, kHotwordNotificationId, title,
...@@ -120,6 +125,10 @@ void AssistantSetup::OnStateChanged(ash::mojom::VoiceInteractionState state) { ...@@ -120,6 +125,10 @@ void AssistantSetup::OnStateChanged(ash::mojom::VoiceInteractionState state) {
kNotifierAssistant), kNotifierAssistant),
{}, base::MakeRefCounted<AssistantHotwordNotificationDelegate>(profile)); {}, base::MakeRefCounted<AssistantHotwordNotificationDelegate>(profile));
gfx::Image image(CreateVectorIcon(ash::kNotificationAssistantIcon,
kAssistantIconSize, gfx::kGoogleBlue700));
notification.set_small_image(image);
NotificationDisplayService::GetForProfile(profile)->Display( NotificationDisplayService::GetForProfile(profile)->Display(
NotificationHandler::Type::TRANSIENT, notification); NotificationHandler::Type::TRANSIENT, 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