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

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

Issue 1603753003: Support buttons on ARC Notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 10 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_manager.h ('k') | no next file » | 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_notification_manager.h" 5 #include "ui/arc/notification/arc_notification_manager.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "ui/arc/notification/arc_notification_item.h" 8 #include "ui/arc/notification/arc_notification_item.h"
9 9
10 namespace arc { 10 namespace arc {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 VLOG(3) << "Chrome requests to fire a click event on notification (key: " 80 VLOG(3) << "Chrome requests to fire a click event on notification (key: "
81 << key << "), but it is gone."; 81 << key << "), but it is gone.";
82 return; 82 return;
83 } 83 }
84 84
85 arc_bridge_service() 85 arc_bridge_service()
86 ->notifications_instance() 86 ->notifications_instance()
87 ->SendNotificationEventToAndroid(key, ArcNotificationEvent::BODY_CLICKED); 87 ->SendNotificationEventToAndroid(key, ArcNotificationEvent::BODY_CLICKED);
88 } 88 }
89 89
90 void ArcNotificationManager::SendNotificationButtonClickedOnChrome(
91 const std::string& key, int button_index) {
92 if (!items_.contains(key)) {
93 VLOG(3) << "Chrome requests to fire a click event on notification (key: "
94 << key << "), but it is gone.";
95 return;
96 }
97
98 arc::ArcNotificationEvent command;
99 switch (button_index) {
100 case 0:
101 command = ArcNotificationEvent::BUTTON1_CLICKED;
102 break;
103 case 1:
104 command = ArcNotificationEvent::BUTTON2_CLICKED;
105 break;
106 case 2:
107 command = ArcNotificationEvent::BUTTON3_CLICKED;
108 break;
109 case 3:
110 command = ArcNotificationEvent::BUTTON4_CLICKED;
111 break;
112 case 4:
113 command = ArcNotificationEvent::BUTTON5_CLICKED;
114 break;
115 default:
116 VLOG(3) << "Invalid button index (key: " << key << ", index: " <<
117 button_index << ").";
118 return;
119 }
120
121 arc_bridge_service()
122 ->notifications_instance()->SendNotificationEventToAndroid(key, command);
123 }
124
90 } // namespace arc 125 } // namespace arc
OLDNEW
« no previous file with comments | « ui/arc/notification/arc_notification_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698