Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(661)

Side by Side Diff: chrome/browser/notifications/notification_object_proxy.h

Issue 578883003: Remove the strict dependency on WebContents for Web Notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/notifications/notification_delegate.h" 11 #include "chrome/browser/notifications/notification_delegate.h"
12 12
13 namespace content { 13 namespace content {
14 class DesktopNotificationDelegate; 14 class DesktopNotificationDelegate;
15 class RenderFrameHost;
16 } 15 }
17 16
18 // A NotificationObjectProxy stands in for the JavaScript Notification object 17 // A NotificationObjectProxy stands in for the JavaScript Notification object
19 // which corresponds to a notification toast on the desktop. It can be signaled 18 // which corresponds to a notification toast on the desktop. It can be signaled
20 // when various events occur regarding the desktop notification, and the 19 // when various events occur regarding the desktop notification, and the
21 // attached JS listeners will be invoked in the renderer or worker process. 20 // attached JS listeners will be invoked in the renderer or worker process.
22 class NotificationObjectProxy 21 class NotificationObjectProxy
23 : public NotificationDelegate { 22 : public NotificationDelegate {
24 public: 23 public:
25 // Creates a Proxy object with the necessary callback information. The Proxy 24 // Creates a Proxy object with the necessary callback information. The Proxy
26 // will take ownership of |delegate|. 25 // will take ownership of |delegate|.
27 NotificationObjectProxy( 26 NotificationObjectProxy(
28 content::RenderFrameHost* render_frame_host,
29 scoped_ptr<content::DesktopNotificationDelegate> delegate); 27 scoped_ptr<content::DesktopNotificationDelegate> delegate);
30 28
31 // NotificationDelegate implementation. 29 // NotificationDelegate implementation.
32 virtual void Display() OVERRIDE; 30 virtual void Display() OVERRIDE;
33 virtual void Error() OVERRIDE; 31 virtual void Error() OVERRIDE;
34 virtual void Close(bool by_user) OVERRIDE; 32 virtual void Close(bool by_user) OVERRIDE;
35 virtual void Click() OVERRIDE; 33 virtual void Click() OVERRIDE;
36 virtual std::string id() const OVERRIDE; 34 virtual std::string id() const OVERRIDE;
37 virtual content::WebContents* GetWebContents() const OVERRIDE; 35 virtual content::WebContents* GetWebContents() const OVERRIDE;
38 36
39 protected: 37 protected:
40 friend class base::RefCountedThreadSafe<NotificationObjectProxy>;
41
42 virtual ~NotificationObjectProxy(); 38 virtual ~NotificationObjectProxy();
43 39
44 private: 40 private:
45 // Callback information to find the JS Notification object where it lives.
46 int render_process_id_;
47 int render_frame_id_;
48 scoped_ptr<content::DesktopNotificationDelegate> delegate_; 41 scoped_ptr<content::DesktopNotificationDelegate> delegate_;
49 bool displayed_; 42 bool displayed_;
50 std::string id_; 43 std::string id_;
51 }; 44 };
52 45
53 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ 46 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698