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

Unified Diff: ui/arc/notification/arc_notification_item.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 side-by-side diff with in-line comments
Download patch
Index: ui/arc/notification/arc_notification_item.cc
diff --git a/ui/arc/notification/arc_notification_item.cc b/ui/arc/notification/arc_notification_item.cc
index 05e67ab07eecbe4533b59515abddc9a4076e4592..bed1b848612d84dd8251bf5c97a54ae1ebd73f3c 100644
--- a/ui/arc/notification/arc_notification_item.cc
+++ b/ui/arc/notification/arc_notification_item.cc
@@ -60,6 +60,11 @@ class ArcNotificationDelegate : public message_center::NotificationDelegate {
item_->Click();
}
+ void ButtonClick(int button_index) override {
+ if (item_)
+ item_->ButtonClick(button_index);
+ }
+
private:
// The destructor is private since this class is ref-counted.
~ArcNotificationDelegate() override {}
@@ -125,6 +130,11 @@ void ArcNotificationItem::UpdateWithArcNotificationData(
DCHECK(0 <= data.type && data.type <= ARC_NOTIFICATION_TYPE_MAX)
<< "Unsupported notification type: " << data.type;
+ for (size_t i = 0; i < data.buttons.size(); i++) {
+ rich_data.buttons.push_back(message_center::ButtonInfo(
+ base::UTF8ToUTF16(data.buttons.at(i)->label.get())));
+ }
+
// The identifier of the notifier, which is used to distinguish the notifiers
// in the message center.
message_center::NotifierId notifier_id(
@@ -179,6 +189,11 @@ void ArcNotificationItem::Click() {
manager_->SendNotificationClickedOnChrome(notification_key_);
}
+void ArcNotificationItem::ButtonClick(int button_index) {
+ manager_->SendNotificationButtonClickedOnChrome(
+ notification_key_, button_index);
+}
+
void ArcNotificationItem::OnImageDecoded(const SkBitmap& bitmap) {
DCHECK(thread_checker_.CalledOnValidThread());

Powered by Google App Engine
This is Rietveld 408576698