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

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: plumb through render_process_id Created 6 years, 1 month 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 : public NotificationDelegate {
23 : public NotificationDelegate {
24 public: 22 public:
25 // Creates a Proxy object with the necessary callback information. The Proxy 23 // Creates a Proxy object with the necessary callback information. The Proxy
26 // will take ownership of |delegate|. 24 // will take ownership of |delegate|.
27 NotificationObjectProxy( 25 NotificationObjectProxy(
28 scoped_ptr<content::DesktopNotificationDelegate> delegate); 26 scoped_ptr<content::DesktopNotificationDelegate> delegate);
29 27
30 // NotificationDelegate implementation. 28 // NotificationDelegate implementation.
31 void Display() override; 29 void Display() override;
32 void Error() override; 30 void Error() override;
33 void Close(bool by_user) override; 31 void Close(bool by_user) override;
34 void Click() override; 32 void Click() override;
35 std::string id() const override; 33 std::string id() const override;
36 34
37 protected: 35 protected:
38 friend class base::RefCountedThreadSafe<NotificationObjectProxy>;
39
40 ~NotificationObjectProxy() override; 36 ~NotificationObjectProxy() override;
41 37
42 private: 38 private:
43 scoped_ptr<content::DesktopNotificationDelegate> delegate_; 39 scoped_ptr<content::DesktopNotificationDelegate> delegate_;
44 bool displayed_; 40 bool displayed_;
45 std::string id_; 41 std::string id_;
46 }; 42 };
47 43
48 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ 44 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698