Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / notifications / notification_object_proxy.h
index 9870ac1..eb25729 100644 (file)
@@ -7,43 +7,35 @@
 
 #include <string>
 
+#include "base/memory/scoped_ptr.h"
 #include "chrome/browser/notifications/notification_delegate.h"
 
 namespace content {
 class DesktopNotificationDelegate;
-class RenderFrameHost;
 }
 
 // A NotificationObjectProxy stands in for the JavaScript Notification object
 // which corresponds to a notification toast on the desktop.  It can be signaled
 // when various events occur regarding the desktop notification, and the
 // attached JS listeners will be invoked in the renderer or worker process.
-class NotificationObjectProxy
-    : public NotificationDelegate {
+class NotificationObjectProxy : public NotificationDelegate {
  public:
-  // Creates a Proxy object with the necessary callback information.
-  NotificationObjectProxy(content::RenderFrameHost* render_frame_host,
-                          content::DesktopNotificationDelegate* delegate);
+  // Creates a Proxy object with the necessary callback information. The Proxy
+  // will take ownership of |delegate|.
+  NotificationObjectProxy(
+      scoped_ptr<content::DesktopNotificationDelegate> delegate);
 
   // NotificationDelegate implementation.
-  virtual void Display() OVERRIDE;
-  virtual void Error() OVERRIDE;
-  virtual void Close(bool by_user) OVERRIDE;
-  virtual void Click() OVERRIDE;
-  virtual std::string id() const OVERRIDE;
-  virtual int process_id() const OVERRIDE;
-  virtual content::WebContents* GetWebContents() const OVERRIDE;
+  void Display() override;
+  void Close(bool by_user) override;
+  void Click() override;
+  std::string id() const override;
 
  protected:
-  friend class base::RefCountedThreadSafe<NotificationObjectProxy>;
-
-  virtual ~NotificationObjectProxy() {}
+  ~NotificationObjectProxy() override;
 
  private:
-  // Callback information to find the JS Notification object where it lives.
-  int render_process_id_;
-  int render_frame_id_;
-  content::DesktopNotificationDelegate* delegate_;
+  scoped_ptr<content::DesktopNotificationDelegate> delegate_;
   bool displayed_;
   std::string id_;
 };