• Matthew Mourgos's avatar
    CrOS Shelf: Use AppRegistryCache for shelf notification badging · 424039c5
    Matthew Mourgos authored
    Before this, the MessageCenterObserver was used to allow the ShelfModel
    to keep track of existing notifications. This allowed the ShelfModel to
    correctly update the apps that had a notification.
    
    In this CL, the ShelfController no longer observes the MessageCenter and
    instead observes the AppRegistryCache to get notification updates. With
    this method, the ShelfModel no longer needs to keep a map of existing
    notifications. Instead, the AppRegistryCache calls OnAppUpdate()
    whenever an app's notification badge status has changed.
    
    Also, in order to get the initial notification badge status for new
    ShelfItems, the ShelfControlelr observes changes to the ShelfModel.
    When a new item is added to the model, the ShelfController uses the
    AppRegistryCache to update the model with the current notification
    badge status.
    
    Bug: 1080827
    Change-Id: I1c37626170387a8e81cec0f6f3c06026ac62a976
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2219164Reviewed-by: default avatarNancy Wang <nancylingwang@chromium.org>
    Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
    Commit-Queue: Matthew Mourgos <mmourgos@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#786304}
    424039c5
shelf_model.cc 11 KB