Home | History | Annotate | Download | only in notifications
      1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DELEGATE_H_
      6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DELEGATE_H_
      7 
      8 #include <string>
      9 
     10 #include "base/memory/ref_counted.h"
     11 #include "ui/message_center/notification_delegate.h"
     12 
     13 namespace content {
     14 class RenderViewHost;
     15 }
     16 
     17 // Delegate for a notification. This class has two roles: to implement callback
     18 // methods for notification, and to provide an identity of the associated
     19 // notification.
     20 class NotificationDelegate : public message_center::NotificationDelegate {
     21  public:
     22   // Returns unique id of the notification.
     23   virtual std::string id() const = 0;
     24 
     25   // Returns the id of renderer process which creates the notification, or -1.
     26   virtual int process_id() const;
     27 
     28   // Returns the RenderViewHost that generated the notification, or NULL.
     29   virtual content::RenderViewHost* GetRenderViewHost() const = 0;
     30 
     31   // Lets the delegate know that no more rendering will be necessary.
     32   virtual void ReleaseRenderViewHost();
     33 
     34  protected:
     35   virtual ~NotificationDelegate() {}
     36 };
     37 
     38 #endif  // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DELEGATE_H_
     39