Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: ui/arc/notification/arc_notification_item_impl.cc

Issue 2892893002: Initial implementation of new-style notification (Closed)
Patch Set: addressed comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/arc/notification/arc_notification_item_impl.h ('k') | ui/message_center/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/arc/notification/arc_notification_item_impl.h" 5 #include "ui/arc/notification/arc_notification_item_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 void ArcNotificationItemImpl::OnUpdatedFromAndroid( 70 void ArcNotificationItemImpl::OnUpdatedFromAndroid(
71 mojom::ArcNotificationDataPtr data) { 71 mojom::ArcNotificationDataPtr data) {
72 DCHECK(CalledOnValidThread()); 72 DCHECK(CalledOnValidThread());
73 DCHECK_EQ(notification_key_, data->key); 73 DCHECK_EQ(notification_key_, data->key);
74 74
75 message_center::RichNotificationData rich_data; 75 message_center::RichNotificationData rich_data;
76 rich_data.pinned = (data->no_clear || data->ongoing_event); 76 rich_data.pinned = (data->no_clear || data->ongoing_event);
77 rich_data.priority = ConvertAndroidPriority(data->priority); 77 rich_data.priority = ConvertAndroidPriority(data->priority);
78 if (data->small_icon) 78 if (data->small_icon)
79 rich_data.small_image = gfx::Image::CreateFrom1xBitmap(*data->small_icon); 79 rich_data.small_image = gfx::Image::CreateFrom1xBitmap(*data->small_icon);
80 if (data->accessible_name.has_value()) 80 if (data->accessible_name.has_value()) {
81 rich_data.accessible_name = base::UTF8ToUTF16(*data->accessible_name); 81 accessible_name_ = base::UTF8ToUTF16(*data->accessible_name);
82 } else {
83 accessible_name_ = base::JoinString(
84 {base::UTF8ToUTF16(data->title), base::UTF8ToUTF16(data->message)},
85 base::ASCIIToUTF16("\n"));
86 }
87 rich_data.accessible_name = accessible_name_;
82 88
83 message_center::NotifierId notifier_id( 89 message_center::NotifierId notifier_id(
84 message_center::NotifierId::SYSTEM_COMPONENT, kNotifierId); 90 message_center::NotifierId::SYSTEM_COMPONENT, kNotifierId);
85 notifier_id.profile_id = profile_id_.GetUserEmail(); 91 notifier_id.profile_id = profile_id_.GetUserEmail();
86 92
87 auto notification = base::MakeUnique<message_center::Notification>( 93 auto notification = base::MakeUnique<message_center::Notification>(
88 message_center::NOTIFICATION_TYPE_CUSTOM, notification_id_, 94 message_center::NOTIFICATION_TYPE_CUSTOM, notification_id_,
89 base::UTF8ToUTF16(data->title), base::UTF8ToUTF16(data->message), 95 base::UTF8ToUTF16(data->title), base::UTF8ToUTF16(data->message),
90 gfx::Image(), 96 gfx::Image(),
91 base::UTF8ToUTF16("arc"), // display source 97 base::UTF8ToUTF16("arc"), // display source
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 194 }
189 195
190 const std::string& ArcNotificationItemImpl::GetNotificationKey() const { 196 const std::string& ArcNotificationItemImpl::GetNotificationKey() const {
191 return notification_key_; 197 return notification_key_;
192 } 198 }
193 199
194 const std::string& ArcNotificationItemImpl::GetNotificationId() const { 200 const std::string& ArcNotificationItemImpl::GetNotificationId() const {
195 return notification_id_; 201 return notification_id_;
196 } 202 }
197 203
204 const base::string16& ArcNotificationItemImpl::GetAccessibleName() const {
205 return accessible_name_;
206 }
207
198 } // namespace arc 208 } // namespace arc
OLDNEW
« no previous file with comments | « ui/arc/notification/arc_notification_item_impl.h ('k') | ui/message_center/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698