Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(685)

Side by Side Diff: content/browser/renderer_host/pepper/browser_ppapi_host_impl.h

Issue 725353003: Don't pass ProcessHandle through ChildProcessHostDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/process/process.h"
16 #include "content/browser/renderer_host/pepper/content_browser_pepper_host_facto ry.h" 17 #include "content/browser/renderer_host/pepper/content_browser_pepper_host_facto ry.h"
17 #include "content/browser/renderer_host/pepper/ssl_context_helper.h" 18 #include "content/browser/renderer_host/pepper/ssl_context_helper.h"
18 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
19 #include "content/common/pepper_renderer_instance_data.h" 20 #include "content/common/pepper_renderer_instance_data.h"
20 #include "content/public/browser/browser_ppapi_host.h" 21 #include "content/public/browser/browser_ppapi_host.h"
21 #include "content/public/common/process_type.h" 22 #include "content/public/common/process_type.h"
22 #include "ipc/message_filter.h" 23 #include "ipc/message_filter.h"
23 #include "ppapi/host/ppapi_host.h" 24 #include "ppapi/host/ppapi_host.h"
24 25
25 #if !defined(ENABLE_PLUGINS) 26 #if !defined(ENABLE_PLUGINS)
26 #error "Plugins should be enabled" 27 #error "Plugins should be enabled"
27 #endif 28 #endif
28 29
29 namespace content { 30 namespace content {
30 31
31 class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost { 32 class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost {
32 public: 33 public:
33 // The creator is responsible for calling set_plugin_process_handle as soon 34 // The creator is responsible for calling set_plugin_process as soon as it is
34 // as it is known (we start the process asynchronously so it won't be known 35 // known (we start the process asynchronously so it won't be known when this
35 // when this object is created). 36 // object is created).
36 // |external_plugin| signfies that this is a proxy created for an embedder's 37 // |external_plugin| signfies that this is a proxy created for an embedder's
37 // plugin, i.e. using BrowserPpapiHost::CreateExternalPluginProcess. 38 // plugin, i.e. using BrowserPpapiHost::CreateExternalPluginProcess.
38 BrowserPpapiHostImpl(IPC::Sender* sender, 39 BrowserPpapiHostImpl(IPC::Sender* sender,
39 const ppapi::PpapiPermissions& permissions, 40 const ppapi::PpapiPermissions& permissions,
40 const std::string& plugin_name, 41 const std::string& plugin_name,
41 const base::FilePath& plugin_path, 42 const base::FilePath& plugin_path,
42 const base::FilePath& profile_data_directory, 43 const base::FilePath& profile_data_directory,
43 bool in_process, 44 bool in_process,
44 bool external_plugin); 45 bool external_plugin);
45 ~BrowserPpapiHostImpl() override; 46 ~BrowserPpapiHostImpl() override;
46 47
47 // BrowserPpapiHost. 48 // BrowserPpapiHost.
48 ppapi::host::PpapiHost* GetPpapiHost() override; 49 ppapi::host::PpapiHost* GetPpapiHost() override;
49 base::ProcessHandle GetPluginProcessHandle() const override; 50 const base::Process& GetPluginProcess() const override;
50 bool IsValidInstance(PP_Instance instance) const override; 51 bool IsValidInstance(PP_Instance instance) const override;
51 bool GetRenderFrameIDsForInstance(PP_Instance instance, 52 bool GetRenderFrameIDsForInstance(PP_Instance instance,
52 int* render_process_id, 53 int* render_process_id,
53 int* render_frame_id) const override; 54 int* render_frame_id) const override;
54 const std::string& GetPluginName() override; 55 const std::string& GetPluginName() override;
55 const base::FilePath& GetPluginPath() override; 56 const base::FilePath& GetPluginPath() override;
56 const base::FilePath& GetProfileDataDirectory() override; 57 const base::FilePath& GetProfileDataDirectory() override;
57 GURL GetDocumentURLForInstance(PP_Instance instance) override; 58 GURL GetDocumentURLForInstance(PP_Instance instance) override;
58 GURL GetPluginURLForInstance(PP_Instance instance) override; 59 GURL GetPluginURLForInstance(PP_Instance instance) override;
59 void SetOnKeepaliveCallback( 60 void SetOnKeepaliveCallback(
60 const BrowserPpapiHost::OnKeepaliveCallback& callback) override; 61 const BrowserPpapiHost::OnKeepaliveCallback& callback) override;
61 62
62 void set_plugin_process_handle(base::ProcessHandle handle) { 63 void set_plugin_process(base::Process process) {
63 plugin_process_handle_ = handle; 64 plugin_process_ = process.Pass();
64 } 65 }
65 66
66 bool external_plugin() const { return external_plugin_; } 67 bool external_plugin() const { return external_plugin_; }
67 68
68 // These two functions are notifications that an instance has been created 69 // These two functions are notifications that an instance has been created
69 // or destroyed. They allow us to maintain a mapping of PP_Instance to data 70 // or destroyed. They allow us to maintain a mapping of PP_Instance to data
70 // associated with the instance including view IDs in the browser process. 71 // associated with the instance including view IDs in the browser process.
71 void AddInstance(PP_Instance instance, 72 void AddInstance(PP_Instance instance,
72 const PepperRendererInstanceData& instance_data); 73 const PepperRendererInstanceData& instance_data);
73 void DeleteInstance(PP_Instance instance); 74 void DeleteInstance(PP_Instance instance);
(...skipping 30 matching lines...) Expand all
104 105
105 // Non owning pointers cleared in OnHostDestroyed() 106 // Non owning pointers cleared in OnHostDestroyed()
106 ppapi::host::PpapiHost* ppapi_host_; 107 ppapi::host::PpapiHost* ppapi_host_;
107 BrowserPpapiHostImpl* browser_ppapi_host_impl_; 108 BrowserPpapiHostImpl* browser_ppapi_host_impl_;
108 }; 109 };
109 110
110 // Reports plugin activity to the callback set with SetOnKeepaliveCallback. 111 // Reports plugin activity to the callback set with SetOnKeepaliveCallback.
111 void OnKeepalive(); 112 void OnKeepalive();
112 113
113 scoped_ptr<ppapi::host::PpapiHost> ppapi_host_; 114 scoped_ptr<ppapi::host::PpapiHost> ppapi_host_;
114 base::ProcessHandle plugin_process_handle_; 115 base::Process plugin_process_;
115 std::string plugin_name_; 116 std::string plugin_name_;
116 base::FilePath plugin_path_; 117 base::FilePath plugin_path_;
117 base::FilePath profile_data_directory_; 118 base::FilePath profile_data_directory_;
118 119
119 // If true, this refers to a plugin running in the renderer process. 120 // If true, this refers to a plugin running in the renderer process.
120 bool in_process_; 121 bool in_process_;
121 122
122 // If true, this is an external plugin, i.e. created by the embedder using 123 // If true, this is an external plugin, i.e. created by the embedder using
123 // BrowserPpapiHost::CreateExternalPluginProcess. 124 // BrowserPpapiHost::CreateExternalPluginProcess.
124 bool external_plugin_; 125 bool external_plugin_;
125 126
126 scoped_refptr<SSLContextHelper> ssl_context_helper_; 127 scoped_refptr<SSLContextHelper> ssl_context_helper_;
127 128
128 // Tracks all PP_Instances in this plugin and associated renderer-related 129 // Tracks all PP_Instances in this plugin and associated renderer-related
129 // data. 130 // data.
130 typedef std::map<PP_Instance, PepperRendererInstanceData> InstanceMap; 131 typedef std::map<PP_Instance, PepperRendererInstanceData> InstanceMap;
131 InstanceMap instance_map_; 132 InstanceMap instance_map_;
132 133
133 scoped_refptr<HostMessageFilter> message_filter_; 134 scoped_refptr<HostMessageFilter> message_filter_;
134 135
135 BrowserPpapiHost::OnKeepaliveCallback on_keepalive_callback_; 136 BrowserPpapiHost::OnKeepaliveCallback on_keepalive_callback_;
136 137
137 DISALLOW_COPY_AND_ASSIGN(BrowserPpapiHostImpl); 138 DISALLOW_COPY_AND_ASSIGN(BrowserPpapiHostImpl);
138 }; 139 };
139 140
140 } // namespace content 141 } // namespace content
141 142
142 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ 143 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/ppapi_plugin_process_host.cc ('k') | content/browser/renderer_host/pepper/browser_ppapi_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698