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

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: Created 4 years, 11 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
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 if (!items_.contains(key)) { 84 if (!items_.contains(key)) {
85 VLOG(3) << "Chrome requests to fire a click event on notification (key: " 85 VLOG(3) << "Chrome requests to fire a click event on notification (key: "
86 << key << "), but it is gone."; 86 << key << "), but it is gone.";
87 return; 87 return;
88 } 88 }
89 89
90 arc_bridge_->notifications_instance()->SendNotificationEventToAndroid( 90 arc_bridge_->notifications_instance()->SendNotificationEventToAndroid(
91 key, ARC_NOTIFICATION_EVENT_BODY_CLICKED); 91 key, ARC_NOTIFICATION_EVENT_BODY_CLICKED);
92 } 92 }
93 93
94 void ArcNotificationManager::SendNotificationButtonClickedOnChrome(
95 const std::string& key, int button_index) {
96 if (!items_.contains(key)) {
97 VLOG(3) << "Chrome requests to fire a click event on notification (key: "
98 << key << "), but it is gone.";
hidehiko 2016/01/22 07:47:03 nit: maybe "it has gone"?
yoshiki 2016/01/25 15:45:50 Done.
99 return;
100 }
101
102 arc::ArcNotificationEvent command;
103 switch (button_index) {
104 case 0: command = ARC_NOTIFICATION_EVENT_BUTTON1_CLICKED; break;
hidehiko 2016/01/22 07:47:03 Let's follow the style guide: https://google.githu
yoshiki 2016/01/25 15:45:50 Done.
105 case 1: command = ARC_NOTIFICATION_EVENT_BUTTON2_CLICKED; break;
106 case 2: command = ARC_NOTIFICATION_EVENT_BUTTON3_CLICKED; break;
107 case 3: command = ARC_NOTIFICATION_EVENT_BUTTON4_CLICKED; break;
108 case 4: command = ARC_NOTIFICATION_EVENT_BUTTON5_CLICKED; break;
109 default:
110 VLOG(3) << "Invalid button index (key: " << key << ", index: " <<
111 button_index << ").";
112 return;
113 }
114
115 arc_bridge_->notifications_instance()->SendNotificationEventToAndroid(
116 key, command);
117 }
118
94 } // namespace arc 119 } // namespace arc
OLDNEW
« ui/arc/notification/arc_notification_item.h ('K') | « 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