OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_DESKTOP_NOTIFICATION_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_DESKTOP_NOTIFICATION_HANDLER_H_ |
6 #define CHROME_BROWSER_DESKTOP_NOTIFICATION_HANDLER_H_ | 6 #define CHROME_BROWSER_DESKTOP_NOTIFICATION_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "content/browser/renderer_host/render_view_host_observer.h" | 9 #include "content/browser/renderer_host/render_view_host_observer.h" |
10 | 10 |
11 class GURL; | 11 class GURL; |
12 struct DesktopNotificationHostMsg_Show_Params; | 12 struct DesktopNotificationHostMsg_Show_Params; |
13 | 13 |
14 // Per-tab Desktop notification handler. Handles desktop notification IPCs | 14 // Per-tab Desktop notification handler. Handles desktop notification IPCs |
15 // coming in from the renderer. | 15 // coming in from the renderer. |
16 class DesktopNotificationHandler : public RenderViewHostObserver { | 16 class DesktopNotificationHandler : public RenderViewHostObserver { |
17 public: | 17 public: |
18 explicit DesktopNotificationHandler(RenderViewHost* render_view_host); | 18 static DesktopNotificationHandler* Create(RenderViewHost* render_view_host); |
19 virtual ~DesktopNotificationHandler(); | 19 virtual ~DesktopNotificationHandler(); |
20 | 20 |
21 private: | 21 private: |
| 22 explicit DesktopNotificationHandler(RenderViewHost* render_view_host); |
| 23 |
22 // RenderViewHostObserver implementation. | 24 // RenderViewHostObserver implementation. |
23 virtual bool OnMessageReceived(const IPC::Message& message); | 25 virtual bool OnMessageReceived(const IPC::Message& message); |
24 | 26 |
25 // IPC handlers. | 27 // IPC handlers. |
26 void OnShow(const DesktopNotificationHostMsg_Show_Params& params); | 28 void OnShow(const DesktopNotificationHostMsg_Show_Params& params); |
27 void OnCancel(int notification_id); | 29 void OnCancel(int notification_id); |
28 void OnRequestPermission(const GURL& origin, int callback_id); | 30 void OnRequestPermission(const GURL& origin, int callback_id); |
29 | 31 |
30 private: | 32 private: |
31 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationHandler); | 33 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationHandler); |
32 }; | 34 }; |
33 | 35 |
34 #endif // CHROME_BROWSER_DESKTOP_NOTIFICATION_HANDLER_H_ | 36 #endif // CHROME_BROWSER_DESKTOP_NOTIFICATION_HANDLER_H_ |
35 | 37 |
OLD | NEW |