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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance_impl.h

Issue 19744007: Create a public API around webkit::ppapi::PluginInstance and use it in chrome. After this, webkit/p… (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 WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_IMPL_H_
6 #define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ 6 #define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_IMPL_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
17 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
18 #include "cc/layers/texture_layer_client.h" 17 #include "cc/layers/texture_layer_client.h"
19 #include "ppapi/c/dev/pp_cursor_type_dev.h" 18 #include "ppapi/c/dev/pp_cursor_type_dev.h"
20 #include "ppapi/c/dev/ppp_find_dev.h" 19 #include "ppapi/c/dev/ppp_find_dev.h"
21 #include "ppapi/c/dev/ppp_printing_dev.h" 20 #include "ppapi/c/dev/ppp_printing_dev.h"
22 #include "ppapi/c/dev/ppp_selection_dev.h" 21 #include "ppapi/c/dev/ppp_selection_dev.h"
23 #include "ppapi/c/dev/ppp_text_input_dev.h" 22 #include "ppapi/c/dev/ppp_text_input_dev.h"
24 #include "ppapi/c/dev/ppp_zoom_dev.h" 23 #include "ppapi/c/dev/ppp_zoom_dev.h"
25 #include "ppapi/c/pp_completion_callback.h" 24 #include "ppapi/c/pp_completion_callback.h"
26 #include "ppapi/c/pp_instance.h" 25 #include "ppapi/c/pp_instance.h"
27 #include "ppapi/c/pp_resource.h"
28 #include "ppapi/c/pp_time.h" 26 #include "ppapi/c/pp_time.h"
29 #include "ppapi/c/pp_var.h" 27 #include "ppapi/c/pp_var.h"
30 #include "ppapi/c/ppb_audio_config.h" 28 #include "ppapi/c/ppb_audio_config.h"
31 #include "ppapi/c/ppb_gamepad.h" 29 #include "ppapi/c/ppb_gamepad.h"
32 #include "ppapi/c/ppb_input_event.h" 30 #include "ppapi/c/ppb_input_event.h"
33 #include "ppapi/c/ppp_graphics_3d.h" 31 #include "ppapi/c/ppp_graphics_3d.h"
34 #include "ppapi/c/ppp_input_event.h" 32 #include "ppapi/c/ppp_input_event.h"
35 #include "ppapi/c/ppp_messaging.h" 33 #include "ppapi/c/ppp_messaging.h"
36 #include "ppapi/c/ppp_mouse_lock.h" 34 #include "ppapi/c/ppp_mouse_lock.h"
37 #include "ppapi/c/private/ppb_content_decryptor_private.h" 35 #include "ppapi/c/private/ppb_content_decryptor_private.h"
38 #include "ppapi/c/private/ppp_instance_private.h" 36 #include "ppapi/c/private/ppp_instance_private.h"
39 #include "ppapi/shared_impl/ppb_instance_shared.h" 37 #include "ppapi/shared_impl/ppb_instance_shared.h"
40 #include "ppapi/shared_impl/ppb_view_shared.h" 38 #include "ppapi/shared_impl/ppb_view_shared.h"
41 #include "ppapi/shared_impl/singleton_resource_id.h" 39 #include "ppapi/shared_impl/singleton_resource_id.h"
42 #include "ppapi/shared_impl/tracked_callback.h" 40 #include "ppapi/shared_impl/tracked_callback.h"
43 #include "ppapi/thunk/ppb_gamepad_api.h" 41 #include "ppapi/thunk/ppb_gamepad_api.h"
44 #include "ppapi/thunk/resource_creation_api.h" 42 #include "ppapi/thunk/resource_creation_api.h"
45 #include "skia/ext/refptr.h" 43 #include "skia/ext/refptr.h"
46 #include "third_party/WebKit/public/platform/WebCanvas.h" 44 #include "third_party/WebKit/public/platform/WebCanvas.h"
47 #include "third_party/WebKit/public/platform/WebString.h" 45 #include "third_party/WebKit/public/platform/WebString.h"
48 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" 46 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
49 #include "third_party/WebKit/public/platform/WebURLResponse.h" 47 #include "third_party/WebKit/public/platform/WebURLResponse.h"
50 #include "third_party/WebKit/public/web/WebPlugin.h" 48 #include "third_party/WebKit/public/web/WebPlugin.h"
51 #include "third_party/WebKit/public/web/WebUserGestureToken.h" 49 #include "third_party/WebKit/public/web/WebUserGestureToken.h"
52 #include "ui/base/ime/text_input_type.h" 50 #include "ui/base/ime/text_input_type.h"
53 #include "ui/gfx/rect.h" 51 #include "ui/gfx/rect.h"
54 #include "url/gurl.h" 52 #include "url/gurl.h"
55 #include "webkit/plugins/ppapi/plugin_delegate.h" 53 #include "webkit/plugins/ppapi/plugin_delegate.h"
54 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
56 #include "webkit/plugins/ppapi/ppp_pdf.h" 55 #include "webkit/plugins/ppapi/ppp_pdf.h"
57 #include "webkit/plugins/webkit_plugins_export.h" 56 #include "webkit/plugins/webkit_plugins_export.h"
58 57
59 struct PP_Point; 58 struct PP_Point;
60 struct _NPP; 59 struct _NPP;
61 60
62 class SkBitmap; 61 class SkBitmap;
63 class TransportDIB; 62 class TransportDIB;
64 63
65 namespace IPC {
66 struct ChannelHandle;
67 }
68
69 namespace WebKit { 64 namespace WebKit {
70 class WebInputEvent; 65 class WebInputEvent;
71 class WebLayer; 66 class WebLayer;
72 class WebMouseEvent; 67 class WebMouseEvent;
73 class WebPluginContainer; 68 class WebPluginContainer;
74 class WebURLLoader; 69 class WebURLLoader;
75 class WebURLResponse; 70 class WebURLResponse;
76 struct WebCompositionUnderline; 71 struct WebCompositionUnderline;
77 struct WebCursorInfo; 72 struct WebCursorInfo;
78 struct WebURLError; 73 struct WebURLError;
79 struct WebPrintParams; 74 struct WebPrintParams;
80 } 75 }
81 76
82 namespace cc { 77 namespace cc {
83 class TextureLayer; 78 class TextureLayer;
84 } 79 }
85 80
86 namespace content {
87 class RenderView;
88 }
89
90 namespace gfx {
91 class ImageSkia;
92 }
93
94 namespace ppapi { 81 namespace ppapi {
95 class PpapiPermissions;
96 class Resource; 82 class Resource;
97 class VarTracker;
98 struct InputEventData; 83 struct InputEventData;
99 struct PPP_Instance_Combined; 84 struct PPP_Instance_Combined;
100 struct URLRequestInfoData;
101 } 85 }
102 86
103 namespace ui { 87 namespace ui {
104 class Range; 88 class Range;
105 } 89 }
106 90
107 namespace v8 { 91 namespace v8 {
108 class Isolate; 92 class Isolate;
109 } 93 }
110 94
111 namespace webkit { 95 namespace webkit {
112 namespace ppapi { 96 namespace ppapi {
113 97
114 class ContentDecryptorDelegate; 98 class ContentDecryptorDelegate;
115 class FullscreenContainer; 99 class FullscreenContainer;
116 class MessageChannel; 100 class MessageChannel;
117 class PluginDelegate; 101 class PluginDelegate;
118 class PluginModule; 102 class PluginModule;
119 class PluginObject; 103 class PluginObject;
120 class PPB_Graphics3D_Impl; 104 class PPB_Graphics3D_Impl;
121 class PPB_ImageData_Impl; 105 class PPB_ImageData_Impl;
122 class PPB_URLLoader_Impl; 106 class PPB_URLLoader_Impl;
123 107
124 // Represents one time a plugin appears on one web page. 108 // Represents one time a plugin appears on one web page.
125 // 109 //
126 // Note: to get from a PP_Instance to a PluginInstance*, use the 110 // Note: to get from a PP_Instance to a PluginInstance*, use the
127 // ResourceTracker. 111 // ResourceTracker.
128 class WEBKIT_PLUGINS_EXPORT PluginInstance : 112 class WEBKIT_PLUGINS_EXPORT PluginInstanceImpl :
129 public base::RefCounted<PluginInstance>, 113 public base::RefCounted<PluginInstanceImpl>,
130 public base::SupportsWeakPtr<PluginInstance>, 114 public base::SupportsWeakPtr<PluginInstanceImpl>,
115 public NON_EXPORTED_BASE(PluginInstance),
131 public ::ppapi::PPB_Instance_Shared { 116 public ::ppapi::PPB_Instance_Shared {
132 public: 117 public:
133 // Create and return a PluginInstance object which supports the most recent 118 // Create and return a PluginInstanceImpl object which supports the most
134 // version of PPP_Instance possible by querying the given get_plugin_interface 119 // recent version of PPP_Instance possible by querying the given
135 // function. If the plugin does not support any valid PPP_Instance interface, 120 // get_plugin_interface function. If the plugin does not support any valid
136 // returns NULL. 121 // PPP_Instance interface, returns NULL.
137 static PluginInstance* Create(PluginDelegate* delegate, 122 static PluginInstanceImpl* Create(PluginDelegate* delegate,
138 content::RenderView* render_view, 123 content::RenderView* render_view,
139 PluginModule* module, 124 PluginModule* module,
140 WebKit::WebPluginContainer* container, 125 WebKit::WebPluginContainer* container,
141 const GURL& plugin_url); 126 const GURL& plugin_url);
142 // Delete should be called by the WebPlugin before this destructor. 127 // Delete should be called by the WebPlugin before this destructor.
143 virtual ~PluginInstance(); 128 virtual ~PluginInstanceImpl();
144 129
145 PluginDelegate* delegate() const { return delegate_; } 130 PluginDelegate* delegate() const { return delegate_; }
146 content::RenderView* render_view() const {return render_view_; }
147 PluginModule* module() const { return module_.get(); } 131 PluginModule* module() const { return module_.get(); }
148 MessageChannel& message_channel() { return *message_channel_; } 132 MessageChannel& message_channel() { return *message_channel_; }
149 133
150 WebKit::WebPluginContainer* container() const { return container_; } 134 WebKit::WebPluginContainer* container() const { return container_; }
151 135
152 void set_always_on_top(bool on_top) { always_on_top_ = on_top; }
153
154 // Returns the PP_Instance uniquely identifying this instance. Guaranteed 136 // Returns the PP_Instance uniquely identifying this instance. Guaranteed
155 // nonzero. 137 // nonzero.
156 PP_Instance pp_instance() const { return pp_instance_; } 138 PP_Instance pp_instance() const { return pp_instance_; }
157 139
158 ::ppapi::PPP_Instance_Combined* instance_interface() const { 140 ::ppapi::PPP_Instance_Combined* instance_interface() const {
159 return instance_interface_.get(); 141 return instance_interface_.get();
160 } 142 }
161 143
162 ::ppapi::thunk::ResourceCreationAPI& resource_creation() { 144 ::ppapi::thunk::ResourceCreationAPI& resource_creation() {
163 return *resource_creation_.get(); 145 return *resource_creation_.get();
(...skipping 22 matching lines...) Expand all
186 void ScrollRect(int dx, int dy, const gfx::Rect& rect); 168 void ScrollRect(int dx, int dy, const gfx::Rect& rect);
187 169
188 // Commit the backing texture to the screen once the side effects some 170 // Commit the backing texture to the screen once the side effects some
189 // rendering up to an offscreen SwapBuffers are visible. 171 // rendering up to an offscreen SwapBuffers are visible.
190 void CommitBackingTexture(); 172 void CommitBackingTexture();
191 173
192 // Called when the out-of-process plugin implementing this instance crashed. 174 // Called when the out-of-process plugin implementing this instance crashed.
193 void InstanceCrashed(); 175 void InstanceCrashed();
194 176
195 // PPB_Instance and PPB_Instance_Private implementation. 177 // PPB_Instance and PPB_Instance_Private implementation.
196 const GURL& plugin_url() const { return plugin_url_; }
197 bool full_frame() const { return full_frame_; } 178 bool full_frame() const { return full_frame_; }
198 const ::ppapi::ViewData& view_data() const { return view_data_; } 179 const ::ppapi::ViewData& view_data() const { return view_data_; }
199 180
200 // PPP_Instance and PPP_Instance_Private. 181 // PPP_Instance and PPP_Instance_Private.
201 bool Initialize(const std::vector<std::string>& arg_names, 182 bool Initialize(const std::vector<std::string>& arg_names,
202 const std::vector<std::string>& arg_values, 183 const std::vector<std::string>& arg_values,
203 bool full_frame); 184 bool full_frame);
204 bool HandleDocumentLoad(const WebKit::WebURLResponse& response); 185 bool HandleDocumentLoad(const WebKit::WebURLResponse& response);
205 bool HandleInputEvent(const WebKit::WebInputEvent& event, 186 bool HandleInputEvent(const WebKit::WebInputEvent& event,
206 WebKit::WebCursorInfo* cursor_info); 187 WebKit::WebCursorInfo* cursor_info);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 // flash_fullscreen_ == true 275 // flash_fullscreen_ == true
295 // 276 //
296 // In normal state, events come from webkit and painting goes back to it. 277 // In normal state, events come from webkit and painting goes back to it.
297 // In fullscreen state, events come from the fullscreen container, and 278 // In fullscreen state, events come from the fullscreen container, and
298 // painting goes back to it. 279 // painting goes back to it.
299 // In pending state, events from webkit are ignored, and as soon as we 280 // In pending state, events from webkit are ignored, and as soon as we
300 // receive events from the fullscreen container, we go to the fullscreen 281 // receive events from the fullscreen container, we go to the fullscreen
301 // state. 282 // state.
302 bool FlashIsFullscreenOrPending(); 283 bool FlashIsFullscreenOrPending();
303 284
304 // Switches between fullscreen and normal mode. If |delay_report| is set to
305 // false, it may report the new state through DidChangeView immediately. If
306 // true, it will delay it. When called from the plugin, delay_report should
307 // be true to avoid re-entrancy.
308 void FlashSetFullscreen(bool fullscreen, bool delay_report);
309
310 // Updates |flash_fullscreen_| and sends focus change notification if 285 // Updates |flash_fullscreen_| and sends focus change notification if
311 // necessary. 286 // necessary.
312 void UpdateFlashFullscreenState(bool flash_fullscreen); 287 void UpdateFlashFullscreenState(bool flash_fullscreen);
313 288
314 FullscreenContainer* fullscreen_container() const { 289 FullscreenContainer* fullscreen_container() const {
315 return fullscreen_container_; 290 return fullscreen_container_;
316 } 291 }
317 292
318 // Implementation of PPB_Fullscreen. 293 // Implementation of PPB_Fullscreen.
319 294
(...skipping 10 matching lines...) Expand all
330 305
331 bool flash_fullscreen() const { return flash_fullscreen_; } 306 bool flash_fullscreen() const { return flash_fullscreen_; }
332 307
333 // Switches between fullscreen and normal mode. The transition is 308 // Switches between fullscreen and normal mode. The transition is
334 // asynchronous. WebKit will trigger corresponding VewChanged calls. 309 // asynchronous. WebKit will trigger corresponding VewChanged calls.
335 // Returns true on success, false on failure (e.g. trying to enter fullscreen 310 // Returns true on success, false on failure (e.g. trying to enter fullscreen
336 // when not processing a user gesture or trying to set fullscreen when 311 // when not processing a user gesture or trying to set fullscreen when
337 // already in fullscreen mode). 312 // already in fullscreen mode).
338 bool SetFullscreen(bool fullscreen); 313 bool SetFullscreen(bool fullscreen);
339 314
340 // Implementation of PPB_Flash.
341 int32_t Navigate(const ::ppapi::URLRequestInfoData& request,
342 const char* target,
343 bool from_user_action);
344 bool IsRectTopmost(const gfx::Rect& rect);
345
346 // Implementation of PPP_Messaging. 315 // Implementation of PPP_Messaging.
347 void HandleMessage(PP_Var message); 316 void HandleMessage(PP_Var message);
348 317
349 PluginDelegate::PlatformContext3D* CreateContext3D(); 318 PluginDelegate::PlatformContext3D* CreateContext3D();
350 319
351 // Returns true iff the plugin is a full-page plugin (i.e. not in an iframe
352 // or embedded in a page).
353 bool IsFullPagePlugin() const;
354
355 // Returns true if the plugin is processing a user gesture. 320 // Returns true if the plugin is processing a user gesture.
356 bool IsProcessingUserGesture(); 321 bool IsProcessingUserGesture();
357 322
358 // Returns the user gesture token to use for creating a WebScopedUserGesture, 323 // Returns the user gesture token to use for creating a WebScopedUserGesture,
359 // if IsProcessingUserGesture returned true. 324 // if IsProcessingUserGesture returned true.
360 WebKit::WebUserGestureToken CurrentUserGestureToken(); 325 WebKit::WebUserGestureToken CurrentUserGestureToken();
361 326
362 // A mouse lock request was pending and this reports success or failure. 327 // A mouse lock request was pending and this reports success or failure.
363 void OnLockMouseACK(bool succeeded); 328 void OnLockMouseACK(bool succeeded);
364 // A mouse lock was in place, but has been lost. 329 // A mouse lock was in place, but has been lost.
(...skipping 17 matching lines...) Expand all
382 // clear itself when it is destroyed. 347 // clear itself when it is destroyed.
383 WebKit::WebURLLoaderClient* document_loader() const { 348 WebKit::WebURLLoaderClient* document_loader() const {
384 return document_loader_; 349 return document_loader_;
385 } 350 }
386 void set_document_loader(WebKit::WebURLLoaderClient* loader) { 351 void set_document_loader(WebKit::WebURLLoaderClient* loader) {
387 document_loader_ = loader; 352 document_loader_ = loader;
388 } 353 }
389 354
390 ContentDecryptorDelegate* GetContentDecryptorDelegate(); 355 ContentDecryptorDelegate* GetContentDecryptorDelegate();
391 356
357 // webkit::ppapi::PluginInstance implementation
358 content::RenderView* GetRenderView();
359 virtual WebKit::WebPluginContainer* GetContainer();
360 virtual ::ppapi::VarTracker* GetVarTracker();
361 virtual const GURL& GetPluginURL();
362 virtual base::FilePath GetModulePath();
363 virtual PP_Resource CreateExternalFileReference(
364 const base::FilePath& external_file_path);
365 virtual PP_Resource CreateImage(gfx::ImageSkia* source_image,
366 float scale);
367 virtual PP_ExternalPluginResult SwitchToOutOfProcessProxy(
368 const base::FilePath& file_path,
369 ::ppapi::PpapiPermissions permissions,
370 const IPC::ChannelHandle& channel_handle,
371 base::ProcessId plugin_pid,
372 int plugin_child_id);
373 virtual void SetAlwaysOnTop(bool on_top);
374 virtual bool IsFullPagePlugin();
375 virtual void FlashSetFullscreen(bool fullscreen, bool delay_report);
376 virtual bool IsRectTopmost(const gfx::Rect& rect);
377 virtual int32_t Navigate(const ::ppapi::URLRequestInfoData& request,
378 const char* target,
379 bool from_user_action);
380
392 // PPB_Instance_API implementation. 381 // PPB_Instance_API implementation.
393 virtual PP_Bool BindGraphics(PP_Instance instance, 382 virtual PP_Bool BindGraphics(PP_Instance instance,
394 PP_Resource device) OVERRIDE; 383 PP_Resource device) OVERRIDE;
395 virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE; 384 virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE;
396 virtual const ::ppapi::ViewData* GetViewData(PP_Instance instance) OVERRIDE; 385 virtual const ::ppapi::ViewData* GetViewData(PP_Instance instance) OVERRIDE;
397 virtual PP_Bool FlashIsFullscreen(PP_Instance instance) OVERRIDE; 386 virtual PP_Bool FlashIsFullscreen(PP_Instance instance) OVERRIDE;
398 virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE; 387 virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE;
399 virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE; 388 virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE;
400 virtual PP_Var ExecuteScript(PP_Instance instance, 389 virtual PP_Var ExecuteScript(PP_Instance instance,
401 PP_Var script, 390 PP_Var script,
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 bool IsValidInstanceOf(PluginModule* module); 502 bool IsValidInstanceOf(PluginModule* module);
514 503
515 // Returns the plugin NPP identifier that this plugin will use to identify 504 // Returns the plugin NPP identifier that this plugin will use to identify
516 // itself when making NPObject scripting calls to WebBindings. 505 // itself when making NPObject scripting calls to WebBindings.
517 struct _NPP* instanceNPP(); 506 struct _NPP* instanceNPP();
518 507
519 // Returns the v8::Isolate that was current when this Instance was created. 508 // Returns the v8::Isolate that was current when this Instance was created.
520 // This is not inlined so as to avoid an unnecessary header include of v8.h. 509 // This is not inlined so as to avoid an unnecessary header include of v8.h.
521 v8::Isolate* GetIsolate() const; 510 v8::Isolate* GetIsolate() const;
522 511
523 static PluginInstance* Get(PP_Instance instance_id);
524
525 ::ppapi::VarTracker* GetVarTracker();
526
527 // Returns a reference to a file with the given path.
528 // The returned object will have a refcount of 0 (just like "new").
529 PP_Resource CreateExternalFileReference(
530 const base::FilePath& external_file_path);
531
532 // Creates a PPB_ImageData given a Skia image.
533 PP_Resource CreateImage(gfx::ImageSkia* source_image, float scale);
534
535 // Returns the location of this module.
536 base::FilePath GetModulePath();
537
538 // Switches this instance with one that uses the out of process IPC proxy.
539 PP_ExternalPluginResult SwitchToOutOfProcessProxy(
540 const base::FilePath& file_path,
541 ::ppapi::PpapiPermissions permissions,
542 const IPC::ChannelHandle& channel_handle,
543 base::ProcessId plugin_pid,
544 int plugin_child_id);
545
546 private: 512 private:
547 friend class PpapiUnittest; 513 friend class PpapiUnittest;
548 514
549 // Class to record document load notifications and play them back once the 515 // Class to record document load notifications and play them back once the
550 // real document loader becomes available. Used only by NaCl instances. 516 // real document loader becomes available. Used only by NaCl instances.
551 class NaClDocumentLoader : public WebKit::WebURLLoaderClient { 517 class NaClDocumentLoader : public WebKit::WebURLLoaderClient {
552 public: 518 public:
553 NaClDocumentLoader(); 519 NaClDocumentLoader();
554 virtual ~NaClDocumentLoader(); 520 virtual ~NaClDocumentLoader();
555 521
556 void ReplayReceivedData(WebURLLoaderClient* document_loader); 522 void ReplayReceivedData(WebURLLoaderClient* document_loader);
557 523
558 // WebKit::WebURLLoaderClient implementation. 524 // WebKit::WebURLLoaderClient implementation.
559 virtual void didReceiveData(WebKit::WebURLLoader* loader, 525 virtual void didReceiveData(WebKit::WebURLLoader* loader,
560 const char* data, 526 const char* data,
561 int data_length, 527 int data_length,
562 int encoded_data_length); 528 int encoded_data_length);
563 virtual void didFinishLoading(WebKit::WebURLLoader* loader, 529 virtual void didFinishLoading(WebKit::WebURLLoader* loader,
564 double finish_time); 530 double finish_time);
565 virtual void didFail(WebKit::WebURLLoader* loader, 531 virtual void didFail(WebKit::WebURLLoader* loader,
566 const WebKit::WebURLError& error); 532 const WebKit::WebURLError& error);
567 533
568 private: 534 private:
569 std::list<std::string> data_; 535 std::list<std::string> data_;
570 bool finished_loading_; 536 bool finished_loading_;
571 scoped_ptr<WebKit::WebURLError> error_; 537 scoped_ptr<WebKit::WebURLError> error_;
572 }; 538 };
573 539
574 // Implements PPB_Gamepad_API. This is just to avoid having an excessive 540 // Implements PPB_Gamepad_API. This is just to avoid having an excessive
575 // number of interfaces implemented by PluginInstance. 541 // number of interfaces implemented by PluginInstanceImpl.
576 class GamepadImpl : public ::ppapi::thunk::PPB_Gamepad_API, 542 class GamepadImpl : public ::ppapi::thunk::PPB_Gamepad_API,
577 public ::ppapi::Resource { 543 public ::ppapi::Resource {
578 public: 544 public:
579 explicit GamepadImpl(PluginDelegate* delegate); 545 explicit GamepadImpl(PluginDelegate* delegate);
580 // Resource implementation. 546 // Resource implementation.
581 virtual ::ppapi::thunk::PPB_Gamepad_API* AsPPB_Gamepad_API() OVERRIDE; 547 virtual ::ppapi::thunk::PPB_Gamepad_API* AsPPB_Gamepad_API() OVERRIDE;
582 virtual void Sample(PP_Instance instance, 548 virtual void Sample(PP_Instance instance,
583 PP_GamepadsSampleData* data) OVERRIDE; 549 PP_GamepadsSampleData* data) OVERRIDE;
584 private: 550 private:
585 PluginDelegate* delegate_; 551 PluginDelegate* delegate_;
586 }; 552 };
587 553
588 // See the static Create functions above for creating PluginInstance objects. 554 // See the static Create functions above for creating PluginInstanceImpl
589 // This constructor is private so that we can hide the PPP_Instance_Combined 555 // objects. This constructor is private so that we can hide the
590 // details while still having 1 constructor to maintain for member 556 // PPP_Instance_Combined details while still having 1 constructor to maintain
591 // initialization. 557 // for member initialization.
592 PluginInstance(PluginDelegate* delegate, 558 PluginInstanceImpl(PluginDelegate* delegate,
593 content::RenderView* render_view, 559 content::RenderView* render_view,
594 PluginModule* module, 560 PluginModule* module,
595 ::ppapi::PPP_Instance_Combined* instance_interface, 561 ::ppapi::PPP_Instance_Combined* instance_interface,
596 WebKit::WebPluginContainer* container, 562 WebKit::WebPluginContainer* container,
597 const GURL& plugin_url); 563 const GURL& plugin_url);
598 564
599 bool LoadFindInterface(); 565 bool LoadFindInterface();
600 bool LoadInputEventInterface(); 566 bool LoadInputEventInterface();
601 bool LoadMessagingInterface(); 567 bool LoadMessagingInterface();
602 bool LoadMouseLockInterface(); 568 bool LoadMouseLockInterface();
603 bool LoadPdfInterface(); 569 bool LoadPdfInterface();
604 bool LoadPrintInterface(); 570 bool LoadPrintInterface();
605 bool LoadPrivateInterface(); 571 bool LoadPrivateInterface();
606 bool LoadSelectionInterface(); 572 bool LoadSelectionInterface();
607 bool LoadTextInputInterface(); 573 bool LoadTextInputInterface();
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 // Indicates if we've ever sent a didChangeView to the plugin. This ensures we 679 // Indicates if we've ever sent a didChangeView to the plugin. This ensures we
714 // always send an initial notification, even if the position and clip are the 680 // always send an initial notification, even if the position and clip are the
715 // same as the default values. 681 // same as the default values.
716 bool sent_initial_did_change_view_; 682 bool sent_initial_did_change_view_;
717 683
718 // We use a weak ptr factory for scheduling DidChangeView events so that we 684 // We use a weak ptr factory for scheduling DidChangeView events so that we
719 // can tell whether updates are pending and consolidate them. When there's 685 // can tell whether updates are pending and consolidate them. When there's
720 // already a weak ptr pending (HasWeakPtrs is true), code should update the 686 // already a weak ptr pending (HasWeakPtrs is true), code should update the
721 // view_data_ but not send updates. This also allows us to cancel scheduled 687 // view_data_ but not send updates. This also allows us to cancel scheduled
722 // view change events. 688 // view change events.
723 base::WeakPtrFactory<PluginInstance> view_change_weak_ptr_factory_; 689 base::WeakPtrFactory<PluginInstanceImpl> view_change_weak_ptr_factory_;
724 690
725 // The current device context for painting in 2D and 3D. 691 // The current device context for painting in 2D and 3D.
726 scoped_refptr<PPB_Graphics3D_Impl> bound_graphics_3d_; 692 scoped_refptr<PPB_Graphics3D_Impl> bound_graphics_3d_;
727 PluginDelegate::PlatformGraphics2D* bound_graphics_2d_platform_; 693 PluginDelegate::PlatformGraphics2D* bound_graphics_2d_platform_;
728 694
729 // We track two types of focus, one from WebKit, which is the focus among 695 // We track two types of focus, one from WebKit, which is the focus among
730 // all elements of the page, one one from the browser, which is whether the 696 // all elements of the page, one one from the browser, which is whether the
731 // tab/window has focus. We tell the plugin it has focus only when both of 697 // tab/window has focus. We tell the plugin it has focus only when both of
732 // these values are set to true. 698 // these values are set to true.
733 bool has_webkit_focus_; 699 bool has_webkit_focus_;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 845
880 // Dummy NPP value used when calling in to WebBindings, to allow the bindings 846 // Dummy NPP value used when calling in to WebBindings, to allow the bindings
881 // to correctly track NPObjects belonging to this plugin instance. 847 // to correctly track NPObjects belonging to this plugin instance.
882 scoped_ptr<struct _NPP> npp_; 848 scoped_ptr<struct _NPP> npp_;
883 849
884 // We store the isolate at construction so that we can be sure to use the 850 // We store the isolate at construction so that we can be sure to use the
885 // Isolate in which this Instance was created when interacting with v8. 851 // Isolate in which this Instance was created when interacting with v8.
886 v8::Isolate* isolate_; 852 v8::Isolate* isolate_;
887 853
888 friend class PpapiPluginInstanceTest; 854 friend class PpapiPluginInstanceTest;
889 DISALLOW_COPY_AND_ASSIGN(PluginInstance); 855 DISALLOW_COPY_AND_ASSIGN(PluginInstanceImpl);
890 }; 856 };
891 857
892 } // namespace ppapi 858 } // namespace ppapi
893 } // namespace webkit 859 } // namespace webkit
894 860
895 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ 861 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698