blob: a55aaec4f8605243658c4fd1b0145c7d6a084d7a (
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
|
// Copyright (c) 2012 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_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_
#define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_
#include "base/id_map.h"
#include "base/threading/non_thread_safe.h"
#include "content/public/renderer/render_process_observer.h"
#include "ipc/ipc_sender.h"
namespace WebKit {
class WebFrame;
struct WebPluginParams;
}
namespace content {
class BrowserPlugin;
class RenderViewImpl;
// BrowserPluginManager manages the routing of messages to the appropriate
// BrowserPlugin object based on its instance ID. There is only one
// BrowserPluginManager per renderer process, and it should only be accessed
// by the render thread.
class CONTENT_EXPORT BrowserPluginManager : public IPC::Sender,
public RenderProcessObserver,
public base::NonThreadSafe {
public:
// Returns the one BrowserPluginManager for this process.
static BrowserPluginManager* Get();
BrowserPluginManager();
virtual ~BrowserPluginManager();
// Creates a new BrowserPlugin object with a unique identifier.
// BrowserPlugin is responsible for associating itself with the
// BrowserPluginManager via AddBrowserPlugin. When it is destroyed, it is
// responsible for removing its association via RemoveBrowserPlugin.
virtual BrowserPlugin* CreateBrowserPlugin(
RenderViewImpl* render_view,
WebKit::WebFrame* frame,
const WebKit::WebPluginParams& params) = 0;
void AddBrowserPlugin(int instance_id, BrowserPlugin* browser_plugin);
void RemoveBrowserPlugin(int instance_id);
BrowserPlugin* GetBrowserPlugin(int instance_id) const;
protected:
IDMap<BrowserPlugin> instances_;
int browser_plugin_counter_;
};
} // namespace content
#endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_MANAGER_H_
|