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

Side by Side Diff: content/renderer/pepper/pepper_helper_impl.h

Issue 22300003: Move broker creation out of PepperHelperImpl to PPB_Broker_Impl in the effort to eliminate PepperHe… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 4 months 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 | Annotate | Revision Log
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_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_H_ 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 22 matching lines...) Expand all
33 namespace WebKit { 33 namespace WebKit {
34 class WebGamepads; 34 class WebGamepads;
35 class WebURLResponse; 35 class WebURLResponse;
36 struct WebCompositionUnderline; 36 struct WebCompositionUnderline;
37 struct WebCursorInfo; 37 struct WebCursorInfo;
38 } 38 }
39 39
40 namespace content { 40 namespace content {
41 class ContextProviderCommandBuffer; 41 class ContextProviderCommandBuffer;
42 class GamepadSharedMemoryReader; 42 class GamepadSharedMemoryReader;
43 class PepperBroker;
44 class PluginModule; 43 class PluginModule;
45 class PPB_Broker_Impl;
46 class RenderViewImpl; 44 class RenderViewImpl;
47 struct WebPluginInfo; 45 struct WebPluginInfo;
48 46
49 class PepperHelperImpl : public PepperHelper, 47 class PepperHelperImpl : public PepperHelper,
50 public base::SupportsWeakPtr<PepperHelperImpl>, 48 public base::SupportsWeakPtr<PepperHelperImpl>,
51 public RenderViewObserver { 49 public RenderViewObserver {
52 public: 50 public:
53 explicit PepperHelperImpl(RenderViewImpl* render_view); 51 explicit PepperHelperImpl(RenderViewImpl* render_view);
54 virtual ~PepperHelperImpl(); 52 virtual ~PepperHelperImpl();
55 53
56 RenderViewImpl* render_view() { return render_view_; } 54 RenderViewImpl* render_view() { return render_view_; }
57 55
58 // A pointer is returned immediately, but it is not ready to be used until
59 // BrokerConnected has been called.
60 // The caller is responsible for calling Disconnect() on the returned pointer
61 // to clean up the corresponding resources allocated during this call.
62 PepperBroker* ConnectToBroker(PPB_Broker_Impl* client);
63
64 // Removes broker from pending_connect_broker_ if present. Returns true if so.
65 bool StopWaitingForBrokerConnection(PepperBroker* broker);
66
67 // Notifies that |instance| has changed the cursor. 56 // Notifies that |instance| has changed the cursor.
68 // This will update the cursor appearance if it is currently over the plugin 57 // This will update the cursor appearance if it is currently over the plugin
69 // instance. 58 // instance.
70 void DidChangeCursor(PepperPluginInstanceImpl* instance, 59 void DidChangeCursor(PepperPluginInstanceImpl* instance,
71 const WebKit::WebCursorInfo& cursor); 60 const WebKit::WebCursorInfo& cursor);
72 61
73 // Notifies that |instance| has received a mouse event. 62 // Notifies that |instance| has received a mouse event.
74 void DidReceiveMouseEvent(PepperPluginInstanceImpl* instance); 63 void DidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
75 64
76 // Notification that the given plugin is focused or unfocused. 65 // Notification that the given plugin is focused or unfocused.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 ui::Range* range) const OVERRIDE; 123 ui::Range* range) const OVERRIDE;
135 virtual void OnImeSetComposition( 124 virtual void OnImeSetComposition(
136 const string16& text, 125 const string16& text,
137 const std::vector<WebKit::WebCompositionUnderline>& underlines, 126 const std::vector<WebKit::WebCompositionUnderline>& underlines,
138 int selection_start, 127 int selection_start,
139 int selection_end) OVERRIDE; 128 int selection_end) OVERRIDE;
140 virtual void OnImeConfirmComposition(const string16& text) OVERRIDE; 129 virtual void OnImeConfirmComposition(const string16& text) OVERRIDE;
141 virtual void WillHandleMouseEvent() OVERRIDE; 130 virtual void WillHandleMouseEvent() OVERRIDE;
142 131
143 // RenderViewObserver implementation. 132 // RenderViewObserver implementation.
144 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
145 virtual void OnDestruct() OVERRIDE; 133 virtual void OnDestruct() OVERRIDE;
146 134
147 void OnPpapiBrokerChannelCreated(int request_id,
148 base::ProcessId broker_pid,
149 const IPC::ChannelHandle& handle);
150 void OnPpapiBrokerPermissionResult(int request_id, bool result);
151
152 // Attempts to create a PPAPI plugin for the given filepath. On success, it 135 // Attempts to create a PPAPI plugin for the given filepath. On success, it
153 // will return the newly-created module. 136 // will return the newly-created module.
154 // 137 //
155 // There are two reasons for failure. The first is that the plugin isn't 138 // There are two reasons for failure. The first is that the plugin isn't
156 // a PPAPI plugin. In this case, |*pepper_plugin_was_registered| will be set 139 // a PPAPI plugin. In this case, |*pepper_plugin_was_registered| will be set
157 // to false and the caller may want to fall back on creating an NPAPI plugin. 140 // to false and the caller may want to fall back on creating an NPAPI plugin.
158 // the second is that the plugin failed to initialize. In this case, 141 // the second is that the plugin failed to initialize. In this case,
159 // |*pepper_plugin_was_registered| will be set to true and the caller should 142 // |*pepper_plugin_was_registered| will be set to true and the caller should
160 // not fall back on any other plugin types. 143 // not fall back on any other plugin types.
161 scoped_refptr<PluginModule> CreatePepperPluginModule( 144 scoped_refptr<PluginModule> CreatePepperPluginModule(
162 const WebPluginInfo& webplugin_info, 145 const WebPluginInfo& webplugin_info,
163 bool* pepper_plugin_was_registered); 146 bool* pepper_plugin_was_registered);
164 147
165 // Asynchronously attempts to create a PPAPI broker for the given plugin.
166 scoped_refptr<PepperBroker> CreateBroker(PluginModule* plugin_module);
167
168 // Create a new HostDispatcher for proxying, hook it to the PluginModule, 148 // Create a new HostDispatcher for proxying, hook it to the PluginModule,
169 // and perform other common initialization. 149 // and perform other common initialization.
170 RendererPpapiHost* CreateOutOfProcessModule( 150 RendererPpapiHost* CreateOutOfProcessModule(
171 PluginModule* module, 151 PluginModule* module,
172 const base::FilePath& path, 152 const base::FilePath& path,
173 ppapi::PpapiPermissions permissions, 153 ppapi::PpapiPermissions permissions,
174 const IPC::ChannelHandle& channel_handle, 154 const IPC::ChannelHandle& channel_handle,
175 base::ProcessId plugin_pid, 155 base::ProcessId plugin_pid,
176 int plugin_child_id, 156 int plugin_child_id,
177 bool is_external); 157 bool is_external);
178 158
179 // Pointer to the RenderView that owns us. 159 // Pointer to the RenderView that owns us.
180 RenderViewImpl* render_view_; 160 RenderViewImpl* render_view_;
181 161
182 std::set<PepperPluginInstanceImpl*> active_instances_; 162 std::set<PepperPluginInstanceImpl*> active_instances_;
183 163
184 typedef IDMap<scoped_refptr<PepperBroker>, IDMapOwnPointer> BrokerMap;
185 BrokerMap pending_connect_broker_;
186
187 typedef IDMap<base::WeakPtr<PPB_Broker_Impl> > PermissionRequestMap;
188 PermissionRequestMap pending_permission_requests_;
189
190 // Whether or not the focus is on a PPAPI plugin 164 // Whether or not the focus is on a PPAPI plugin
191 PepperPluginInstanceImpl* focused_plugin_; 165 PepperPluginInstanceImpl* focused_plugin_;
192 166
193 // Current text input composition text. Empty if no composition is in 167 // Current text input composition text. Empty if no composition is in
194 // progress. 168 // progress.
195 string16 composition_text_; 169 string16 composition_text_;
196 170
197 // The plugin instance that received the last mouse event. It is set to NULL 171 // The plugin instance that received the last mouse event. It is set to NULL
198 // if the last mouse event went to elements other than Pepper plugins. 172 // if the last mouse event went to elements other than Pepper plugins.
199 // |last_mouse_event_target_| is not owned by this class. We can know about 173 // |last_mouse_event_target_| is not owned by this class. We can know about
200 // when it is destroyed via InstanceDeleted(). 174 // when it is destroyed via InstanceDeleted().
201 PepperPluginInstanceImpl* last_mouse_event_target_; 175 PepperPluginInstanceImpl* last_mouse_event_target_;
202 176
203 scoped_ptr<GamepadSharedMemoryReader> gamepad_shared_memory_reader_; 177 scoped_ptr<GamepadSharedMemoryReader> gamepad_shared_memory_reader_;
204 178
205 scoped_refptr<ContextProviderCommandBuffer> offscreen_context3d_; 179 scoped_refptr<ContextProviderCommandBuffer> offscreen_context3d_;
206 180
207 DISALLOW_COPY_AND_ASSIGN(PepperHelperImpl); 181 DISALLOW_COPY_AND_ASSIGN(PepperHelperImpl);
208 }; 182 };
209 183
210 } // namespace content 184 } // namespace content
211 185
212 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_H_ 186 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698