blob: 6d4aa6401bfa16a33a84e3e834fc94e47c7a339f (
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 2013 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 CONTENT_PUBLIC_RENDERER_RENDER_FRAME_OBSERVER_H_
#define CONTENT_PUBLIC_RENDERER_RENDER_FRAME_OBSERVER_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "content/common/content_export.h"
#include "ipc/ipc_listener.h"
#include "ipc/ipc_sender.h"
namespace content {
class RendererPpapiHost;
class RenderFrame;
class RenderFrameImpl;
// Base class for objects that want to filter incoming IPCs, and also get
// notified of changes to the frame.
class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener,
public IPC::Sender {
public:
// By default, observers will be deleted when the RenderFrame goes away. If
// they want to outlive it, they can override this function.
virtual void OnDestruct();
// Called when a Pepper plugin is created.
virtual void DidCreatePepperPlugin(RendererPpapiHost* host) {}
// IPC::Listener implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
// IPC::Sender implementation.
virtual bool Send(IPC::Message* message) OVERRIDE;
RenderFrame* render_frame() const;
int routing_id() const { return routing_id_; }
protected:
explicit RenderFrameObserver(RenderFrame* render_frame);
virtual ~RenderFrameObserver();
private:
friend class RenderFrameImpl;
// This is called by the RenderFrame when it's going away so that this object
// can null out its pointer.
void RenderFrameGone();
RenderFrame* render_frame_;
// The routing ID of the associated RenderFrame.
int routing_id_;
DISALLOW_COPY_AND_ASSIGN(RenderFrameObserver);
};
} // namespace content
#endif // CONTENT_PUBLIC_RENDERER_RENDER_FRAME_OBSERVER_H_
|