Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / browser / renderer_host / pepper / pepper_renderer_connection.h
blob109da1f28567649d022e8eef6bcc7f5a9f910b6d
1 // Copyright 2013 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 CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_RENDERER_CONNECTION_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_RENDERER_CONNECTION_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "content/public/browser/browser_message_filter.h"
14 #include "ppapi/c/pp_instance.h"
15 #include "ppapi/c/pp_resource.h"
17 class GURL;
19 namespace ppapi {
20 namespace proxy {
21 class ResourceMessageCallParams;
25 namespace content {
27 class BrowserPpapiHostImpl;
28 struct PepperRendererInstanceData;
30 // This class represents a connection from the browser to the renderer for
31 // sending/receiving pepper ResourceHost related messages. When the browser
32 // and renderer communicate about ResourceHosts, they should pass the plugin
33 // process ID to identify which plugin they are talking about.
34 class PepperRendererConnection : public BrowserMessageFilter {
35 public:
36 explicit PepperRendererConnection(int render_process_id);
38 // BrowserMessageFilter overrides.
39 bool OnMessageReceived(const IPC::Message& msg) override;
41 private:
42 ~PepperRendererConnection() override;
44 // Returns the host for the child process for the given |child_process_id|.
45 // If |child_process_id| is 0, returns the host owned by this
46 // PepperRendererConnection, which serves as the host for in-process plugins.
47 BrowserPpapiHostImpl* GetHostForChildProcess(int child_process_id) const;
49 void OnMsgCreateResourceHostsFromHost(
50 int routing_id,
51 int child_process_id,
52 const ppapi::proxy::ResourceMessageCallParams& params,
53 PP_Instance instance,
54 const std::vector<IPC::Message>& nested_msgs);
56 void OnMsgDidCreateInProcessInstance(
57 PP_Instance instance,
58 const PepperRendererInstanceData& instance_data);
59 void OnMsgDidDeleteInProcessInstance(PP_Instance instance);
61 int render_process_id_;
63 // We have a single BrowserPpapiHost per-renderer for all in-process plugins
64 // running. This is just a work-around allowing new style resources to work
65 // with the browser when running in-process but it means that plugin-specific
66 // information (like the plugin name) won't be available.
67 scoped_ptr<BrowserPpapiHostImpl> in_process_host_;
69 DISALLOW_COPY_AND_ASSIGN(PepperRendererConnection);
72 } // namespace content
74 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_RENDERER_CONNECTION_H_