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

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

Issue 2318463002: arc: Make ChromeVox read an ARC custom notification (Closed)
Patch Set: rebase and cleanup Created 4 years, 3 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 | « components/arc/common/notifications.mojom ('k') | ui/message_center/notification.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_custom_notification_item.h" 5 #include "ui/arc/notification/arc_custom_notification_item.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/arc/bitmap/bitmap_type_converters.h" 10 #include "components/arc/bitmap/bitmap_type_converters.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 DCHECK(CalledOnValidThread()); 58 DCHECK(CalledOnValidThread());
59 DCHECK_EQ(notification_key(), data.key); 59 DCHECK_EQ(notification_key(), data.key);
60 60
61 if (CacheArcNotificationData(data)) 61 if (CacheArcNotificationData(data))
62 return; 62 return;
63 63
64 message_center::RichNotificationData rich_data; 64 message_center::RichNotificationData rich_data;
65 rich_data.pinned = (data.no_clear || data.ongoing_event); 65 rich_data.pinned = (data.no_clear || data.ongoing_event);
66 rich_data.priority = ConvertAndroidPriority(data.priority); 66 rich_data.priority = ConvertAndroidPriority(data.priority);
67 rich_data.small_image = ConvertAndroidSmallIcon(data.small_icon); 67 rich_data.small_image = ConvertAndroidSmallIcon(data.small_icon);
68 if (!data.accessible_name.is_null())
69 rich_data.accessible_name = base::UTF8ToUTF16(data.accessible_name.get());
68 70
69 message_center::NotifierId notifier_id( 71 message_center::NotifierId notifier_id(
70 message_center::NotifierId::SYSTEM_COMPONENT, kNotifierId); 72 message_center::NotifierId::SYSTEM_COMPONENT, kNotifierId);
71 notifier_id.profile_id = profile_id().GetUserEmail(); 73 notifier_id.profile_id = profile_id().GetUserEmail();
72 74
73 DCHECK(!data.title.is_null()); 75 DCHECK(!data.title.is_null());
74 DCHECK(!data.message.is_null()); 76 DCHECK(!data.message.is_null());
75 SetNotification(base::MakeUnique<message_center::Notification>( 77 SetNotification(base::MakeUnique<message_center::Notification>(
76 message_center::NOTIFICATION_TYPE_CUSTOM, notification_id(), 78 message_center::NOTIFICATION_TYPE_CUSTOM, notification_id(),
77 base::UTF8ToUTF16(data.title.get()), 79 base::UTF8ToUTF16(data.title.get()),
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 118 }
117 119
118 void ArcCustomNotificationItem::DecrementWindowRefCount() { 120 void ArcCustomNotificationItem::DecrementWindowRefCount() {
119 DCHECK_GT(window_ref_count_, 0); 121 DCHECK_GT(window_ref_count_, 0);
120 --window_ref_count_; 122 --window_ref_count_;
121 if (window_ref_count_ == 0) 123 if (window_ref_count_ == 0)
122 manager()->CloseNotificationWindow(notification_key()); 124 manager()->CloseNotificationWindow(notification_key());
123 } 125 }
124 126
125 } // namespace arc 127 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/common/notifications.mojom ('k') | ui/message_center/notification.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698