Skip to content
  • peter's avatar
    Generate Web Notification Ids in the //content layer · c45944c3
    peter authored
    Today, Web Notifications get a random Id assigned to them by the delegate
    used with the message_center::Notification object. This has a number of
    implications:
    
      (1) We don't get super smooth "update" transitions for message center
          notifications upon replacing a notification.
      (2) We continue to rely on the delegates associated with Notification
          objects, which in themselves are incompatible with notifications
          that can outlive the process they were created by.
      (3) It's not possible for the //content layer, that has knowledge of the
          notifications that *should* be showing, to close them when certain
          events occur (for instance, the Service Worker unregistering). That
          leads to unresponsive notifications.
    
    This patch makes the NotificationIdGenerator responsible for creating the
    notification Ids, giving us a clear path towards solving these issues. In
    addition, it further isolates the concept of persistent notification Ids,
    reducing the number of Ids readers of this code have to keep in mind.
    
    The NotificationDatabase's keying scheme has been changed to refer to the
    generated Id as opposed to the ever-incrementing persistent notification
    ID. This avoids needing separate association keys and removes a DELETE
    operation prior to writing data for a potentially replaced notification.
    
    TBR=mkwst (type change in /web/)
    BUG=485985, 439950
    
    Review-Url: https://codereview.chromium.org/2300093002
    Cr-Commit-Position: refs/heads/master@{#418241}
    c45944c3