Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / notifications / notification_object_proxy.h
blobf8bd8e3a6136deb2dec9442f307c2f41d055e34c
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/notifications/notification_delegate.h"
13 namespace content {
14 class BrowserContext;
15 class DesktopNotificationDelegate;
18 // A NotificationObjectProxy stands in for the JavaScript Notification object
19 // which corresponds to a notification toast on the desktop. It can be signaled
20 // when various events occur regarding the desktop notification, and the
21 // attached JS listeners will be invoked in the renderer or worker process.
22 class NotificationObjectProxy : public NotificationDelegate {
23 public:
24 // Creates a Proxy object with the necessary callback information. The Proxy
25 // will take ownership of |delegate|.
26 NotificationObjectProxy(
27 content::BrowserContext* browser_context,
28 scoped_ptr<content::DesktopNotificationDelegate> delegate);
30 // NotificationDelegate implementation.
31 void Display() override;
32 void Close(bool by_user) override;
33 void Click() override;
34 void ButtonClick(int button_index) override;
35 std::string id() const override;
37 protected:
38 ~NotificationObjectProxy() override;
40 private:
41 content::BrowserContext* browser_context_;
42 scoped_ptr<content::DesktopNotificationDelegate> delegate_;
43 bool displayed_;
44 std::string id_;
46 DISALLOW_COPY_AND_ASSIGN(NotificationObjectProxy);
49 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_