blob: 1fac9c50e67febad74dcc8255337f602e2bc21df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_DESKTOP_NOTIFICATION_HANDLER_H_
#define CHROME_BROWSER_DESKTOP_NOTIFICATION_HANDLER_H_
#pragma once
#include "content/browser/tab_contents/tab_contents_observer.h"
struct DesktopNotificationHostMsg_Show_Params;
class RenderProcessHost;
// Per-tab Desktop notification handler. Handles desktop notification IPCs
// coming in from the renderer.
class DesktopNotificationHandler {
public:
// tab_contents will be NULL when this object is used with non-tab contents,
// i.e. ExtensionHost.
DesktopNotificationHandler(TabContents* tab_contents,
RenderProcessHost* process);
virtual ~DesktopNotificationHandler() {}
bool OnMessageReceived(const IPC::Message& message);
RenderProcessHost* GetRenderProcessHost();
private:
// IPC handlers.
void OnShow(const IPC::Message& message,
const DesktopNotificationHostMsg_Show_Params& params);
void OnCancel(const IPC::Message& message, int notification_id);
void OnRequestPermission(const IPC::Message& message,
const GURL& origin,
int callback_id);
private:
TabContents* tab_;
RenderProcessHost* process_;
DISALLOW_COPY_AND_ASSIGN(DesktopNotificationHandler);
};
// A wrapper around DesktopNotificationHandler that implements
// TabContentsObserver.
class DesktopNotificationHandlerForTC : public TabContentsObserver {
public:
// tab_contents will be NULL when this object is used with non-tab contents,
// i.e. ExtensionHost.
DesktopNotificationHandlerForTC(TabContents* tab_contents,
RenderProcessHost* process);
// TabContentsObserver implementation.
virtual bool OnMessageReceived(const IPC::Message& message);
private:
DesktopNotificationHandler handler_;
};
#endif // CHROME_BROWSER_DESKTOP_NOTIFICATION_HANDLER_H_
|