OLD | NEW |
---|---|
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 Loading... | |
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 |
OLD | NEW |