cros: badge arc apps when a notification comes in.
To badge an app when the notification comes in, the
notification must have an app id.
ARC notifications currently come with the dummy app id.
They come with package name, so we can derive app id by:
- Looking up activity id (based on package name).
- Calling GetAppId(package_name, activity_name).
Bug: 806330
Change-Id: I94b1e5e7d719578323f2b01f56a3eaa6ea572cd8
Reviewed-on: https://chromium-review.googlesource.com/912460
Commit-Queue: Alex Newcomer <[email protected]>
Reviewed-by: Hidehiko Abe <[email protected]>
Reviewed-by: Xiyuan Xia <[email protected]>
Reviewed-by: Yoshiki Iguchi <[email protected]>
Cr-Commit-Position: refs/heads/master@{#540555}
diff --git a/ash/shelf/shelf_controller.cc b/ash/shelf/shelf_controller.cc
index 5a69f13..d0f4b352 100644
--- a/ash/shelf/shelf_controller.cc
+++ b/ash/shelf/shelf_controller.cc
@@ -14,6 +14,7 @@
#include "ash/session/session_controller.h"
#include "ash/shelf/app_list_shelf_item_delegate.h"
#include "ash/shelf/shelf.h"
+#include "ash/shelf/shelf_constants.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
@@ -374,12 +375,21 @@
message_center::MessageCenter::Get()->FindVisibleNotificationById(
notification_id);
- // TODO(newcomer): Support ARC app notifications.
- if (!notification || notification->notifier_id().type !=
- message_center::NotifierId::APPLICATION) {
+ if (!notification)
+ return;
+
+ // Skip this if the notification shouldn't badge an app.
+ if (notification->notifier_id().type !=
+ message_center::NotifierId::APPLICATION &&
+ notification->notifier_id().type !=
+ message_center::NotifierId::ARC_APPLICATION) {
return;
}
+ // Skip this if the notification doesn't have a valid app id.
+ if (notification->notifier_id().id == ash::kDefaultArcNotifierId)
+ return;
+
model_.AddNotificationRecord(notification->notifier_id().id, notification_id);
}