| OLD | NEW |
| 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_INSTANCE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #include "ui/base/ime/text_input_type.h" | 56 #include "ui/base/ime/text_input_type.h" |
| 57 #include "ui/gfx/rect.h" | 57 #include "ui/gfx/rect.h" |
| 58 #include "url/gurl.h" | 58 #include "url/gurl.h" |
| 59 | 59 |
| 60 struct PP_Point; | 60 struct PP_Point; |
| 61 struct _NPP; | 61 struct _NPP; |
| 62 | 62 |
| 63 class SkBitmap; | 63 class SkBitmap; |
| 64 class TransportDIB; | 64 class TransportDIB; |
| 65 | 65 |
| 66 namespace WebKit { | 66 namespace blink { |
| 67 class WebInputEvent; | 67 class WebInputEvent; |
| 68 class WebLayer; | 68 class WebLayer; |
| 69 class WebMouseEvent; | 69 class WebMouseEvent; |
| 70 class WebPluginContainer; | 70 class WebPluginContainer; |
| 71 class WebURLLoader; | 71 class WebURLLoader; |
| 72 class WebURLResponse; | 72 class WebURLResponse; |
| 73 struct WebCompositionUnderline; | 73 struct WebCompositionUnderline; |
| 74 struct WebCursorInfo; | 74 struct WebCursorInfo; |
| 75 struct WebURLError; | 75 struct WebURLError; |
| 76 struct WebPrintParams; | 76 struct WebPrintParams; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 public ppapi::PPB_Instance_Shared, | 118 public ppapi::PPB_Instance_Shared, |
| 119 public NON_EXPORTED_BASE(cc::TextureLayerClient) { | 119 public NON_EXPORTED_BASE(cc::TextureLayerClient) { |
| 120 public: | 120 public: |
| 121 // Create and return a PepperPluginInstanceImpl object which supports the most | 121 // Create and return a PepperPluginInstanceImpl object which supports the most |
| 122 // recent version of PPP_Instance possible by querying the given | 122 // recent version of PPP_Instance possible by querying the given |
| 123 // get_plugin_interface function. If the plugin does not support any valid | 123 // get_plugin_interface function. If the plugin does not support any valid |
| 124 // PPP_Instance interface, returns NULL. | 124 // PPP_Instance interface, returns NULL. |
| 125 static PepperPluginInstanceImpl* Create( | 125 static PepperPluginInstanceImpl* Create( |
| 126 RenderViewImpl* render_view, | 126 RenderViewImpl* render_view, |
| 127 PluginModule* module, | 127 PluginModule* module, |
| 128 WebKit::WebPluginContainer* container, | 128 blink::WebPluginContainer* container, |
| 129 const GURL& plugin_url); | 129 const GURL& plugin_url); |
| 130 RenderViewImpl* render_view() const { return render_view_; } | 130 RenderViewImpl* render_view() const { return render_view_; } |
| 131 PluginModule* module() const { return module_.get(); } | 131 PluginModule* module() const { return module_.get(); } |
| 132 MessageChannel& message_channel() { return *message_channel_; } | 132 MessageChannel& message_channel() { return *message_channel_; } |
| 133 | 133 |
| 134 WebKit::WebPluginContainer* container() const { return container_; } | 134 blink::WebPluginContainer* container() const { return container_; } |
| 135 | 135 |
| 136 // Returns the PP_Instance uniquely identifying this instance. Guaranteed | 136 // Returns the PP_Instance uniquely identifying this instance. Guaranteed |
| 137 // nonzero. | 137 // nonzero. |
| 138 PP_Instance pp_instance() const { return pp_instance_; } | 138 PP_Instance pp_instance() const { return pp_instance_; } |
| 139 | 139 |
| 140 ppapi::thunk::ResourceCreationAPI& resource_creation() { | 140 ppapi::thunk::ResourceCreationAPI& resource_creation() { |
| 141 return *resource_creation_.get(); | 141 return *resource_creation_.get(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 // Does some pre-destructor cleanup on the instance. This is necessary | 144 // Does some pre-destructor cleanup on the instance. This is necessary |
| 145 // because some cleanup depends on the plugin instance still existing (like | 145 // because some cleanup depends on the plugin instance still existing (like |
| 146 // calling the plugin's DidDestroy function). This function is called from | 146 // calling the plugin's DidDestroy function). This function is called from |
| 147 // the WebPlugin implementation when WebKit is about to remove the plugin. | 147 // the WebPlugin implementation when WebKit is about to remove the plugin. |
| 148 void Delete(); | 148 void Delete(); |
| 149 | 149 |
| 150 // Paints the current backing store to the web page. | 150 // Paints the current backing store to the web page. |
| 151 void Paint(WebKit::WebCanvas* canvas, | 151 void Paint(blink::WebCanvas* canvas, |
| 152 const gfx::Rect& plugin_rect, | 152 const gfx::Rect& plugin_rect, |
| 153 const gfx::Rect& paint_rect); | 153 const gfx::Rect& paint_rect); |
| 154 | 154 |
| 155 // Schedules a paint of the page for the given region. The coordinates are | 155 // Schedules a paint of the page for the given region. The coordinates are |
| 156 // relative to the top-left of the plugin. This does nothing if the plugin | 156 // relative to the top-left of the plugin. This does nothing if the plugin |
| 157 // has not yet been positioned. You can supply an empty gfx::Rect() to | 157 // has not yet been positioned. You can supply an empty gfx::Rect() to |
| 158 // invalidate the entire plugin. | 158 // invalidate the entire plugin. |
| 159 void InvalidateRect(const gfx::Rect& rect); | 159 void InvalidateRect(const gfx::Rect& rect); |
| 160 | 160 |
| 161 // Schedules a scroll of the plugin. This uses optimized scrolling only for | 161 // Schedules a scroll of the plugin. This uses optimized scrolling only for |
| 162 // full-frame plugins, as otherwise there could be other elements on top. The | 162 // full-frame plugins, as otherwise there could be other elements on top. The |
| 163 // slow path can also be triggered if there is an overlapping frame. | 163 // slow path can also be triggered if there is an overlapping frame. |
| 164 void ScrollRect(int dx, int dy, const gfx::Rect& rect); | 164 void ScrollRect(int dx, int dy, const gfx::Rect& rect); |
| 165 | 165 |
| 166 // Commit the backing texture to the screen once the side effects some | 166 // Commit the backing texture to the screen once the side effects some |
| 167 // rendering up to an offscreen SwapBuffers are visible. | 167 // rendering up to an offscreen SwapBuffers are visible. |
| 168 void CommitBackingTexture(); | 168 void CommitBackingTexture(); |
| 169 | 169 |
| 170 // Called when the out-of-process plugin implementing this instance crashed. | 170 // Called when the out-of-process plugin implementing this instance crashed. |
| 171 void InstanceCrashed(); | 171 void InstanceCrashed(); |
| 172 | 172 |
| 173 // PPB_Instance and PPB_Instance_Private implementation. | 173 // PPB_Instance and PPB_Instance_Private implementation. |
| 174 bool full_frame() const { return full_frame_; } | 174 bool full_frame() const { return full_frame_; } |
| 175 const ppapi::ViewData& view_data() const { return view_data_; } | 175 const ppapi::ViewData& view_data() const { return view_data_; } |
| 176 | 176 |
| 177 // PPP_Instance and PPP_Instance_Private. | 177 // PPP_Instance and PPP_Instance_Private. |
| 178 bool Initialize(const std::vector<std::string>& arg_names, | 178 bool Initialize(const std::vector<std::string>& arg_names, |
| 179 const std::vector<std::string>& arg_values, | 179 const std::vector<std::string>& arg_values, |
| 180 bool full_frame); | 180 bool full_frame); |
| 181 bool HandleDocumentLoad(const WebKit::WebURLResponse& response); | 181 bool HandleDocumentLoad(const blink::WebURLResponse& response); |
| 182 bool HandleInputEvent(const WebKit::WebInputEvent& event, | 182 bool HandleInputEvent(const blink::WebInputEvent& event, |
| 183 WebKit::WebCursorInfo* cursor_info); | 183 blink::WebCursorInfo* cursor_info); |
| 184 PP_Var GetInstanceObject(); | 184 PP_Var GetInstanceObject(); |
| 185 void ViewChanged(const gfx::Rect& position, const gfx::Rect& clip, | 185 void ViewChanged(const gfx::Rect& position, const gfx::Rect& clip, |
| 186 const std::vector<gfx::Rect>& cut_outs_rects); | 186 const std::vector<gfx::Rect>& cut_outs_rects); |
| 187 | 187 |
| 188 // Handlers for composition events. | 188 // Handlers for composition events. |
| 189 bool HandleCompositionStart(const base::string16& text); | 189 bool HandleCompositionStart(const base::string16& text); |
| 190 bool HandleCompositionUpdate( | 190 bool HandleCompositionUpdate( |
| 191 const base::string16& text, | 191 const base::string16& text, |
| 192 const std::vector<WebKit::WebCompositionUnderline>& underlines, | 192 const std::vector<blink::WebCompositionUnderline>& underlines, |
| 193 int selection_start, | 193 int selection_start, |
| 194 int selection_end); | 194 int selection_end); |
| 195 bool HandleCompositionEnd(const base::string16& text); | 195 bool HandleCompositionEnd(const base::string16& text); |
| 196 bool HandleTextInput(const base::string16& text); | 196 bool HandleTextInput(const base::string16& text); |
| 197 | 197 |
| 198 // Gets the current text input status. | 198 // Gets the current text input status. |
| 199 ui::TextInputType text_input_type() const { return text_input_type_; } | 199 ui::TextInputType text_input_type() const { return text_input_type_; } |
| 200 gfx::Rect GetCaretBounds() const; | 200 gfx::Rect GetCaretBounds() const; |
| 201 bool IsPluginAcceptingCompositionEvents() const; | 201 bool IsPluginAcceptingCompositionEvents() const; |
| 202 void GetSurroundingText(base::string16* text, gfx::Range* range) const; | 202 void GetSurroundingText(base::string16* text, gfx::Range* range) const; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 void RequestSurroundingText(size_t desired_number_of_characters); | 234 void RequestSurroundingText(size_t desired_number_of_characters); |
| 235 void Zoom(double factor, bool text_only); | 235 void Zoom(double factor, bool text_only); |
| 236 bool StartFind(const base::string16& search_text, | 236 bool StartFind(const base::string16& search_text, |
| 237 bool case_sensitive, | 237 bool case_sensitive, |
| 238 int identifier); | 238 int identifier); |
| 239 void SelectFindResult(bool forward); | 239 void SelectFindResult(bool forward); |
| 240 void StopFind(); | 240 void StopFind(); |
| 241 | 241 |
| 242 bool SupportsPrintInterface(); | 242 bool SupportsPrintInterface(); |
| 243 bool IsPrintScalingDisabled(); | 243 bool IsPrintScalingDisabled(); |
| 244 int PrintBegin(const WebKit::WebPrintParams& print_params); | 244 int PrintBegin(const blink::WebPrintParams& print_params); |
| 245 bool PrintPage(int page_number, WebKit::WebCanvas* canvas); | 245 bool PrintPage(int page_number, blink::WebCanvas* canvas); |
| 246 void PrintEnd(); | 246 void PrintEnd(); |
| 247 | 247 |
| 248 bool CanRotateView(); | 248 bool CanRotateView(); |
| 249 void RotateView(WebKit::WebPlugin::RotationType type); | 249 void RotateView(blink::WebPlugin::RotationType type); |
| 250 | 250 |
| 251 // There are 2 implementations of the fullscreen interface | 251 // There are 2 implementations of the fullscreen interface |
| 252 // PPB_FlashFullscreen is used by Pepper Flash. | 252 // PPB_FlashFullscreen is used by Pepper Flash. |
| 253 // PPB_Fullscreen is intended for other applications including NaCl. | 253 // PPB_Fullscreen is intended for other applications including NaCl. |
| 254 // The two interface are mutually exclusive. | 254 // The two interface are mutually exclusive. |
| 255 | 255 |
| 256 // Implementation of PPB_FlashFullscreen. | 256 // Implementation of PPB_FlashFullscreen. |
| 257 | 257 |
| 258 // Because going to fullscreen is asynchronous (but going out is not), there | 258 // Because going to fullscreen is asynchronous (but going out is not), there |
| 259 // are 3 states: | 259 // are 3 states: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 bool SetFullscreen(bool fullscreen); | 303 bool SetFullscreen(bool fullscreen); |
| 304 | 304 |
| 305 // Implementation of PPP_Messaging. | 305 // Implementation of PPP_Messaging. |
| 306 void HandleMessage(PP_Var message); | 306 void HandleMessage(PP_Var message); |
| 307 | 307 |
| 308 // Returns true if the plugin is processing a user gesture. | 308 // Returns true if the plugin is processing a user gesture. |
| 309 bool IsProcessingUserGesture(); | 309 bool IsProcessingUserGesture(); |
| 310 | 310 |
| 311 // Returns the user gesture token to use for creating a WebScopedUserGesture, | 311 // Returns the user gesture token to use for creating a WebScopedUserGesture, |
| 312 // if IsProcessingUserGesture returned true. | 312 // if IsProcessingUserGesture returned true. |
| 313 WebKit::WebUserGestureToken CurrentUserGestureToken(); | 313 blink::WebUserGestureToken CurrentUserGestureToken(); |
| 314 | 314 |
| 315 // A mouse lock request was pending and this reports success or failure. | 315 // A mouse lock request was pending and this reports success or failure. |
| 316 void OnLockMouseACK(bool succeeded); | 316 void OnLockMouseACK(bool succeeded); |
| 317 // A mouse lock was in place, but has been lost. | 317 // A mouse lock was in place, but has been lost. |
| 318 void OnMouseLockLost(); | 318 void OnMouseLockLost(); |
| 319 // A mouse lock is enabled and mouse events are being delivered. | 319 // A mouse lock is enabled and mouse events are being delivered. |
| 320 void HandleMouseLockedInputEvent(const WebKit::WebMouseEvent& event); | 320 void HandleMouseLockedInputEvent(const blink::WebMouseEvent& event); |
| 321 | 321 |
| 322 // Simulates an input event to the plugin by passing it down to WebKit, | 322 // Simulates an input event to the plugin by passing it down to WebKit, |
| 323 // which sends it back up to the plugin as if it came from the user. | 323 // which sends it back up to the plugin as if it came from the user. |
| 324 void SimulateInputEvent(const ppapi::InputEventData& input_event); | 324 void SimulateInputEvent(const ppapi::InputEventData& input_event); |
| 325 | 325 |
| 326 // Simulates an IME event at the level of RenderView which sends it back up to | 326 // Simulates an IME event at the level of RenderView which sends it back up to |
| 327 // the plugin as if it came from the user. | 327 // the plugin as if it came from the user. |
| 328 bool SimulateIMEEvent(const ppapi::InputEventData& input_event); | 328 bool SimulateIMEEvent(const ppapi::InputEventData& input_event); |
| 329 void SimulateImeSetCompositionEvent( | 329 void SimulateImeSetCompositionEvent( |
| 330 const ppapi::InputEventData& input_event); | 330 const ppapi::InputEventData& input_event); |
| 331 | 331 |
| 332 // The document loader is valid when the plugin is "full-frame" and in this | 332 // The document loader is valid when the plugin is "full-frame" and in this |
| 333 // case is non-NULL as long as the corresponding loader resource is alive. | 333 // case is non-NULL as long as the corresponding loader resource is alive. |
| 334 // This pointer is non-owning, so the loader must use set_document_loader to | 334 // This pointer is non-owning, so the loader must use set_document_loader to |
| 335 // clear itself when it is destroyed. | 335 // clear itself when it is destroyed. |
| 336 WebKit::WebURLLoaderClient* document_loader() const { | 336 blink::WebURLLoaderClient* document_loader() const { |
| 337 return document_loader_; | 337 return document_loader_; |
| 338 } | 338 } |
| 339 void set_document_loader(WebKit::WebURLLoaderClient* loader) { | 339 void set_document_loader(blink::WebURLLoaderClient* loader) { |
| 340 document_loader_ = loader; | 340 document_loader_ = loader; |
| 341 } | 341 } |
| 342 | 342 |
| 343 ContentDecryptorDelegate* GetContentDecryptorDelegate(); | 343 ContentDecryptorDelegate* GetContentDecryptorDelegate(); |
| 344 | 344 |
| 345 // PluginInstance implementation | 345 // PluginInstance implementation |
| 346 virtual RenderView* GetRenderView() OVERRIDE; | 346 virtual RenderView* GetRenderView() OVERRIDE; |
| 347 virtual WebKit::WebPluginContainer* GetContainer() OVERRIDE; | 347 virtual blink::WebPluginContainer* GetContainer() OVERRIDE; |
| 348 virtual v8::Isolate* GetIsolate() const OVERRIDE; | 348 virtual v8::Isolate* GetIsolate() const OVERRIDE; |
| 349 virtual ppapi::VarTracker* GetVarTracker() OVERRIDE; | 349 virtual ppapi::VarTracker* GetVarTracker() OVERRIDE; |
| 350 virtual const GURL& GetPluginURL() OVERRIDE; | 350 virtual const GURL& GetPluginURL() OVERRIDE; |
| 351 virtual base::FilePath GetModulePath() OVERRIDE; | 351 virtual base::FilePath GetModulePath() OVERRIDE; |
| 352 virtual PP_Resource CreateImage(gfx::ImageSkia* source_image, | 352 virtual PP_Resource CreateImage(gfx::ImageSkia* source_image, |
| 353 float scale) OVERRIDE; | 353 float scale) OVERRIDE; |
| 354 virtual PP_ExternalPluginResult SwitchToOutOfProcessProxy( | 354 virtual PP_ExternalPluginResult SwitchToOutOfProcessProxy( |
| 355 const base::FilePath& file_path, | 355 const base::FilePath& file_path, |
| 356 ppapi::PpapiPermissions permissions, | 356 ppapi::PpapiPermissions permissions, |
| 357 const IPC::ChannelHandle& channel_handle, | 357 const IPC::ChannelHandle& channel_handle, |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 | 503 |
| 504 private: | 504 private: |
| 505 friend class base::RefCounted<PepperPluginInstanceImpl>; | 505 friend class base::RefCounted<PepperPluginInstanceImpl>; |
| 506 friend class PpapiUnittest; | 506 friend class PpapiUnittest; |
| 507 | 507 |
| 508 // Delete should be called by the WebPlugin before this destructor. | 508 // Delete should be called by the WebPlugin before this destructor. |
| 509 virtual ~PepperPluginInstanceImpl(); | 509 virtual ~PepperPluginInstanceImpl(); |
| 510 | 510 |
| 511 // Class to record document load notifications and play them back once the | 511 // Class to record document load notifications and play them back once the |
| 512 // real document loader becomes available. Used only by external instances. | 512 // real document loader becomes available. Used only by external instances. |
| 513 class ExternalDocumentLoader : public WebKit::WebURLLoaderClient { | 513 class ExternalDocumentLoader : public blink::WebURLLoaderClient { |
| 514 public: | 514 public: |
| 515 ExternalDocumentLoader(); | 515 ExternalDocumentLoader(); |
| 516 virtual ~ExternalDocumentLoader(); | 516 virtual ~ExternalDocumentLoader(); |
| 517 | 517 |
| 518 void ReplayReceivedData(WebURLLoaderClient* document_loader); | 518 void ReplayReceivedData(WebURLLoaderClient* document_loader); |
| 519 | 519 |
| 520 // WebKit::WebURLLoaderClient implementation. | 520 // blink::WebURLLoaderClient implementation. |
| 521 virtual void didReceiveData(WebKit::WebURLLoader* loader, | 521 virtual void didReceiveData(blink::WebURLLoader* loader, |
| 522 const char* data, | 522 const char* data, |
| 523 int data_length, | 523 int data_length, |
| 524 int encoded_data_length); | 524 int encoded_data_length); |
| 525 virtual void didFinishLoading(WebKit::WebURLLoader* loader, | 525 virtual void didFinishLoading(blink::WebURLLoader* loader, |
| 526 double finish_time); | 526 double finish_time); |
| 527 virtual void didFail(WebKit::WebURLLoader* loader, | 527 virtual void didFail(blink::WebURLLoader* loader, |
| 528 const WebKit::WebURLError& error); | 528 const blink::WebURLError& error); |
| 529 | 529 |
| 530 private: | 530 private: |
| 531 std::list<std::string> data_; | 531 std::list<std::string> data_; |
| 532 bool finished_loading_; | 532 bool finished_loading_; |
| 533 scoped_ptr<WebKit::WebURLError> error_; | 533 scoped_ptr<blink::WebURLError> error_; |
| 534 }; | 534 }; |
| 535 | 535 |
| 536 // Implements PPB_Gamepad_API. This is just to avoid having an excessive | 536 // Implements PPB_Gamepad_API. This is just to avoid having an excessive |
| 537 // number of interfaces implemented by PepperPluginInstanceImpl. | 537 // number of interfaces implemented by PepperPluginInstanceImpl. |
| 538 class GamepadImpl : public ppapi::thunk::PPB_Gamepad_API, | 538 class GamepadImpl : public ppapi::thunk::PPB_Gamepad_API, |
| 539 public ppapi::Resource { | 539 public ppapi::Resource { |
| 540 public: | 540 public: |
| 541 GamepadImpl(); | 541 GamepadImpl(); |
| 542 // Resource implementation. | 542 // Resource implementation. |
| 543 virtual ppapi::thunk::PPB_Gamepad_API* AsPPB_Gamepad_API() OVERRIDE; | 543 virtual ppapi::thunk::PPB_Gamepad_API* AsPPB_Gamepad_API() OVERRIDE; |
| 544 virtual void Sample(PP_Instance instance, | 544 virtual void Sample(PP_Instance instance, |
| 545 PP_GamepadsSampleData* data) OVERRIDE; | 545 PP_GamepadsSampleData* data) OVERRIDE; |
| 546 private: | 546 private: |
| 547 virtual ~GamepadImpl(); | 547 virtual ~GamepadImpl(); |
| 548 }; | 548 }; |
| 549 | 549 |
| 550 // See the static Create functions above for creating PepperPluginInstanceImpl | 550 // See the static Create functions above for creating PepperPluginInstanceImpl |
| 551 // objects. This constructor is private so that we can hide the | 551 // objects. This constructor is private so that we can hide the |
| 552 // PPP_Instance_Combined details while still having 1 constructor to maintain | 552 // PPP_Instance_Combined details while still having 1 constructor to maintain |
| 553 // for member initialization. | 553 // for member initialization. |
| 554 PepperPluginInstanceImpl(RenderViewImpl* render_view, | 554 PepperPluginInstanceImpl(RenderViewImpl* render_view, |
| 555 PluginModule* module, | 555 PluginModule* module, |
| 556 ppapi::PPP_Instance_Combined* instance_interface, | 556 ppapi::PPP_Instance_Combined* instance_interface, |
| 557 WebKit::WebPluginContainer* container, | 557 blink::WebPluginContainer* container, |
| 558 const GURL& plugin_url); | 558 const GURL& plugin_url); |
| 559 | 559 |
| 560 bool LoadFindInterface(); | 560 bool LoadFindInterface(); |
| 561 bool LoadInputEventInterface(); | 561 bool LoadInputEventInterface(); |
| 562 bool LoadMessagingInterface(); | 562 bool LoadMessagingInterface(); |
| 563 bool LoadMouseLockInterface(); | 563 bool LoadMouseLockInterface(); |
| 564 bool LoadPdfInterface(); | 564 bool LoadPdfInterface(); |
| 565 bool LoadPrintInterface(); | 565 bool LoadPrintInterface(); |
| 566 bool LoadPrivateInterface(); | 566 bool LoadPrivateInterface(); |
| 567 bool LoadSelectionInterface(); | 567 bool LoadSelectionInterface(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 583 void SendDidChangeView(); | 583 void SendDidChangeView(); |
| 584 | 584 |
| 585 // Reports the current plugin geometry to the plugin by calling | 585 // Reports the current plugin geometry to the plugin by calling |
| 586 // DidChangeView. | 586 // DidChangeView. |
| 587 void ReportGeometry(); | 587 void ReportGeometry(); |
| 588 | 588 |
| 589 // Queries the plugin for supported print formats and sets |format| to the | 589 // Queries the plugin for supported print formats and sets |format| to the |
| 590 // best format to use. Returns false if the plugin does not support any | 590 // best format to use. Returns false if the plugin does not support any |
| 591 // print format that we can handle (we can handle only PDF). | 591 // print format that we can handle (we can handle only PDF). |
| 592 bool GetPreferredPrintOutputFormat(PP_PrintOutputFormat_Dev* format); | 592 bool GetPreferredPrintOutputFormat(PP_PrintOutputFormat_Dev* format); |
| 593 bool PrintPDFOutput(PP_Resource print_output, WebKit::WebCanvas* canvas); | 593 bool PrintPDFOutput(PP_Resource print_output, blink::WebCanvas* canvas); |
| 594 | 594 |
| 595 // Updates the layer for compositing. This creates a layer and attaches to the | 595 // Updates the layer for compositing. This creates a layer and attaches to the |
| 596 // container if: | 596 // container if: |
| 597 // - we have a bound Graphics3D | 597 // - we have a bound Graphics3D |
| 598 // - the Graphics3D has a texture | 598 // - the Graphics3D has a texture |
| 599 // - we are not in Flash full-screen mode (or transitioning to it) | 599 // - we are not in Flash full-screen mode (or transitioning to it) |
| 600 // Otherwise it destroys the layer. | 600 // Otherwise it destroys the layer. |
| 601 // It does either operation lazily. | 601 // It does either operation lazily. |
| 602 void UpdateLayer(); | 602 void UpdateLayer(); |
| 603 | 603 |
| 604 // Internal helper function for PrintPage(). | 604 // Internal helper function for PrintPage(). |
| 605 bool PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges, | 605 bool PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges, |
| 606 int num_ranges, | 606 int num_ranges, |
| 607 WebKit::WebCanvas* canvas); | 607 blink::WebCanvas* canvas); |
| 608 | 608 |
| 609 void DoSetCursor(WebKit::WebCursorInfo* cursor); | 609 void DoSetCursor(blink::WebCursorInfo* cursor); |
| 610 | 610 |
| 611 // Internal helper functions for HandleCompositionXXX(). | 611 // Internal helper functions for HandleCompositionXXX(). |
| 612 bool SendCompositionEventToPlugin( | 612 bool SendCompositionEventToPlugin( |
| 613 PP_InputEvent_Type type, | 613 PP_InputEvent_Type type, |
| 614 const base::string16& text); | 614 const base::string16& text); |
| 615 bool SendCompositionEventWithUnderlineInformationToPlugin( | 615 bool SendCompositionEventWithUnderlineInformationToPlugin( |
| 616 PP_InputEvent_Type type, | 616 PP_InputEvent_Type type, |
| 617 const base::string16& text, | 617 const base::string16& text, |
| 618 const std::vector<WebKit::WebCompositionUnderline>& underlines, | 618 const std::vector<blink::WebCompositionUnderline>& underlines, |
| 619 int selection_start, | 619 int selection_start, |
| 620 int selection_end); | 620 int selection_end); |
| 621 | 621 |
| 622 // Internal helper function for XXXInputEvents(). | 622 // Internal helper function for XXXInputEvents(). |
| 623 void RequestInputEventsHelper(uint32_t event_classes); | 623 void RequestInputEventsHelper(uint32_t event_classes); |
| 624 | 624 |
| 625 // Checks if the security origin of the document containing this instance can | 625 // Checks if the security origin of the document containing this instance can |
| 626 // assess the security origin of the main frame document. | 626 // assess the security origin of the main frame document. |
| 627 bool CanAccessMainFrame() const; | 627 bool CanAccessMainFrame() const; |
| 628 | 628 |
| 629 // Returns true if the WebView the plugin is in renders via the accelerated | 629 // Returns true if the WebView the plugin is in renders via the accelerated |
| 630 // compositing path. | 630 // compositing path. |
| 631 bool IsViewAccelerated(); | 631 bool IsViewAccelerated(); |
| 632 | 632 |
| 633 // Track, set and reset size attributes to control the size of the plugin | 633 // Track, set and reset size attributes to control the size of the plugin |
| 634 // in and out of fullscreen mode. | 634 // in and out of fullscreen mode. |
| 635 void KeepSizeAttributesBeforeFullscreen(); | 635 void KeepSizeAttributesBeforeFullscreen(); |
| 636 void SetSizeAttributesForFullscreen(); | 636 void SetSizeAttributesForFullscreen(); |
| 637 void ResetSizeAttributesAfterFullscreen(); | 637 void ResetSizeAttributesAfterFullscreen(); |
| 638 | 638 |
| 639 bool IsMouseLocked(); | 639 bool IsMouseLocked(); |
| 640 bool LockMouse(); | 640 bool LockMouse(); |
| 641 MouseLockDispatcher* GetMouseLockDispatcher(); | 641 MouseLockDispatcher* GetMouseLockDispatcher(); |
| 642 MouseLockDispatcher::LockTarget* GetOrCreateLockTargetAdapter(); | 642 MouseLockDispatcher::LockTarget* GetOrCreateLockTargetAdapter(); |
| 643 void UnSetAndDeleteLockTargetAdapter(); | 643 void UnSetAndDeleteLockTargetAdapter(); |
| 644 | 644 |
| 645 void DidDataFromWebURLResponse( | 645 void DidDataFromWebURLResponse( |
| 646 const WebKit::WebURLResponse& response, | 646 const blink::WebURLResponse& response, |
| 647 int pending_host_id, | 647 int pending_host_id, |
| 648 const ppapi::URLResponseInfoData& data); | 648 const ppapi::URLResponseInfoData& data); |
| 649 | 649 |
| 650 RenderViewImpl* render_view_; | 650 RenderViewImpl* render_view_; |
| 651 scoped_refptr<PluginModule> module_; | 651 scoped_refptr<PluginModule> module_; |
| 652 scoped_ptr<ppapi::PPP_Instance_Combined> instance_interface_; | 652 scoped_ptr<ppapi::PPP_Instance_Combined> instance_interface_; |
| 653 // If this is the NaCl plugin, we create a new module when we switch to the | 653 // If this is the NaCl plugin, we create a new module when we switch to the |
| 654 // IPC-based PPAPI proxy. Store the original module and instance interface | 654 // IPC-based PPAPI proxy. Store the original module and instance interface |
| 655 // so we can shut down properly. | 655 // so we can shut down properly. |
| 656 scoped_refptr<PluginModule> original_module_; | 656 scoped_refptr<PluginModule> original_module_; |
| 657 scoped_ptr<ppapi::PPP_Instance_Combined> original_instance_interface_; | 657 scoped_ptr<ppapi::PPP_Instance_Combined> original_instance_interface_; |
| 658 | 658 |
| 659 PP_Instance pp_instance_; | 659 PP_Instance pp_instance_; |
| 660 | 660 |
| 661 // NULL until we have been initialized. | 661 // NULL until we have been initialized. |
| 662 WebKit::WebPluginContainer* container_; | 662 blink::WebPluginContainer* container_; |
| 663 scoped_refptr<cc::TextureLayer> texture_layer_; | 663 scoped_refptr<cc::TextureLayer> texture_layer_; |
| 664 scoped_ptr<WebKit::WebLayer> web_layer_; | 664 scoped_ptr<blink::WebLayer> web_layer_; |
| 665 bool layer_bound_to_fullscreen_; | 665 bool layer_bound_to_fullscreen_; |
| 666 bool layer_is_hardware_; | 666 bool layer_is_hardware_; |
| 667 | 667 |
| 668 // Plugin URL. | 668 // Plugin URL. |
| 669 GURL plugin_url_; | 669 GURL plugin_url_; |
| 670 | 670 |
| 671 // Indicates whether this is a full frame instance, which means it represents | 671 // Indicates whether this is a full frame instance, which means it represents |
| 672 // an entire document rather than an embed tag. | 672 // an entire document rather than an embed tag. |
| 673 bool full_frame_; | 673 bool full_frame_; |
| 674 | 674 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 #endif // defined(OS_MACOSX) | 730 #endif // defined(OS_MACOSX) |
| 731 // Always when printing to PDF on Linux and when printing for preview on Mac | 731 // Always when printing to PDF on Linux and when printing for preview on Mac |
| 732 // and Win, the entire document goes into one metafile. However, when users | 732 // and Win, the entire document goes into one metafile. However, when users |
| 733 // print only a subset of all the pages, it is impossible to know if a call | 733 // print only a subset of all the pages, it is impossible to know if a call |
| 734 // to PrintPage() is the last call. Thus in PrintPage(), just store the page | 734 // to PrintPage() is the last call. Thus in PrintPage(), just store the page |
| 735 // number in |ranges_|. The hack is in PrintEnd(), where a valid |canvas_| | 735 // number in |ranges_|. The hack is in PrintEnd(), where a valid |canvas_| |
| 736 // is preserved in PrintWebViewHelper::PrintPages. This makes it possible | 736 // is preserved in PrintWebViewHelper::PrintPages. This makes it possible |
| 737 // to generate the entire PDF given the variables below: | 737 // to generate the entire PDF given the variables below: |
| 738 // | 738 // |
| 739 // The most recently used WebCanvas, guaranteed to be valid. | 739 // The most recently used WebCanvas, guaranteed to be valid. |
| 740 skia::RefPtr<WebKit::WebCanvas> canvas_; | 740 skia::RefPtr<blink::WebCanvas> canvas_; |
| 741 // An array of page ranges. | 741 // An array of page ranges. |
| 742 std::vector<PP_PrintPageNumberRange_Dev> ranges_; | 742 std::vector<PP_PrintPageNumberRange_Dev> ranges_; |
| 743 | 743 |
| 744 scoped_refptr<ppapi::Resource> gamepad_impl_; | 744 scoped_refptr<ppapi::Resource> gamepad_impl_; |
| 745 | 745 |
| 746 // The plugin print interface. | 746 // The plugin print interface. |
| 747 const PPP_Printing_Dev* plugin_print_interface_; | 747 const PPP_Printing_Dev* plugin_print_interface_; |
| 748 | 748 |
| 749 // The plugin 3D interface. | 749 // The plugin 3D interface. |
| 750 const PPP_Graphics3D* plugin_graphics_3d_interface_; | 750 const PPP_Graphics3D* plugin_graphics_3d_interface_; |
| 751 | 751 |
| 752 // Contains the cursor if it's set by the plugin. | 752 // Contains the cursor if it's set by the plugin. |
| 753 scoped_ptr<WebKit::WebCursorInfo> cursor_; | 753 scoped_ptr<blink::WebCursorInfo> cursor_; |
| 754 | 754 |
| 755 // Set to true if this plugin thinks it will always be on top. This allows us | 755 // Set to true if this plugin thinks it will always be on top. This allows us |
| 756 // to use a more optimized painting path in some cases. | 756 // to use a more optimized painting path in some cases. |
| 757 bool always_on_top_; | 757 bool always_on_top_; |
| 758 // Even if |always_on_top_| is true, the plugin is not fully visible if there | 758 // Even if |always_on_top_| is true, the plugin is not fully visible if there |
| 759 // are some cut-out areas (occupied by iframes higher in the stacking order). | 759 // are some cut-out areas (occupied by iframes higher in the stacking order). |
| 760 // This information is used in the optimized painting path. | 760 // This information is used in the optimized painting path. |
| 761 std::vector<gfx::Rect> cut_outs_rects_; | 761 std::vector<gfx::Rect> cut_outs_rects_; |
| 762 | 762 |
| 763 // Implementation of PPB_FlashFullscreen. | 763 // Implementation of PPB_FlashFullscreen. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 776 | 776 |
| 777 // Since entering fullscreen mode is an asynchronous operation, we set this | 777 // Since entering fullscreen mode is an asynchronous operation, we set this |
| 778 // variable to the desired state at the time we issue the fullscreen change | 778 // variable to the desired state at the time we issue the fullscreen change |
| 779 // request. The plugin will receive a DidChangeView event when it goes | 779 // request. The plugin will receive a DidChangeView event when it goes |
| 780 // fullscreen. | 780 // fullscreen. |
| 781 bool desired_fullscreen_state_; | 781 bool desired_fullscreen_state_; |
| 782 | 782 |
| 783 // WebKit does not resize the plugin when going into fullscreen mode, so we do | 783 // WebKit does not resize the plugin when going into fullscreen mode, so we do |
| 784 // this here by modifying the various plugin attributes and then restoring | 784 // this here by modifying the various plugin attributes and then restoring |
| 785 // them on exit. | 785 // them on exit. |
| 786 WebKit::WebString width_before_fullscreen_; | 786 blink::WebString width_before_fullscreen_; |
| 787 WebKit::WebString height_before_fullscreen_; | 787 blink::WebString height_before_fullscreen_; |
| 788 WebKit::WebString border_before_fullscreen_; | 788 blink::WebString border_before_fullscreen_; |
| 789 WebKit::WebString style_before_fullscreen_; | 789 blink::WebString style_before_fullscreen_; |
| 790 gfx::Size screen_size_for_fullscreen_; | 790 gfx::Size screen_size_for_fullscreen_; |
| 791 | 791 |
| 792 // The MessageChannel used to implement bidirectional postMessage for the | 792 // The MessageChannel used to implement bidirectional postMessage for the |
| 793 // instance. | 793 // instance. |
| 794 scoped_ptr<MessageChannel> message_channel_; | 794 scoped_ptr<MessageChannel> message_channel_; |
| 795 | 795 |
| 796 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. | 796 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. |
| 797 SkBitmap* sad_plugin_; | 797 SkBitmap* sad_plugin_; |
| 798 | 798 |
| 799 typedef std::set<PluginObject*> PluginObjectSet; | 799 typedef std::set<PluginObject*> PluginObjectSet; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 813 // Text selection status. | 813 // Text selection status. |
| 814 std::string surrounding_text_; | 814 std::string surrounding_text_; |
| 815 size_t selection_caret_; | 815 size_t selection_caret_; |
| 816 size_t selection_anchor_; | 816 size_t selection_anchor_; |
| 817 | 817 |
| 818 scoped_refptr<ppapi::TrackedCallback> lock_mouse_callback_; | 818 scoped_refptr<ppapi::TrackedCallback> lock_mouse_callback_; |
| 819 | 819 |
| 820 // Track pending user gestures so out-of-process plugins can respond to | 820 // Track pending user gestures so out-of-process plugins can respond to |
| 821 // a user gesture after it has been processed. | 821 // a user gesture after it has been processed. |
| 822 PP_TimeTicks pending_user_gesture_; | 822 PP_TimeTicks pending_user_gesture_; |
| 823 WebKit::WebUserGestureToken pending_user_gesture_token_; | 823 blink::WebUserGestureToken pending_user_gesture_token_; |
| 824 | 824 |
| 825 // We store the arguments so we can re-send them if we are reset to talk to | 825 // We store the arguments so we can re-send them if we are reset to talk to |
| 826 // NaCl via the IPC NaCl proxy. | 826 // NaCl via the IPC NaCl proxy. |
| 827 std::vector<std::string> argn_; | 827 std::vector<std::string> argn_; |
| 828 std::vector<std::string> argv_; | 828 std::vector<std::string> argv_; |
| 829 | 829 |
| 830 // Non-owning pointer to the document loader, if any. | 830 // Non-owning pointer to the document loader, if any. |
| 831 WebKit::WebURLLoaderClient* document_loader_; | 831 blink::WebURLLoaderClient* document_loader_; |
| 832 // State for deferring document loads. Used only by external instances. | 832 // State for deferring document loads. Used only by external instances. |
| 833 WebKit::WebURLResponse external_document_response_; | 833 blink::WebURLResponse external_document_response_; |
| 834 scoped_ptr<ExternalDocumentLoader> external_document_loader_; | 834 scoped_ptr<ExternalDocumentLoader> external_document_loader_; |
| 835 bool external_document_load_; | 835 bool external_document_load_; |
| 836 | 836 |
| 837 // The ContentDecryptorDelegate forwards PPP_ContentDecryptor_Private | 837 // The ContentDecryptorDelegate forwards PPP_ContentDecryptor_Private |
| 838 // calls and handles PPB_ContentDecryptor_Private calls. | 838 // calls and handles PPB_ContentDecryptor_Private calls. |
| 839 scoped_ptr<ContentDecryptorDelegate> content_decryptor_delegate_; | 839 scoped_ptr<ContentDecryptorDelegate> content_decryptor_delegate_; |
| 840 | 840 |
| 841 // Dummy NPP value used when calling in to WebBindings, to allow the bindings | 841 // Dummy NPP value used when calling in to WebBindings, to allow the bindings |
| 842 // to correctly track NPObjects belonging to this plugin instance. | 842 // to correctly track NPObjects belonging to this plugin instance. |
| 843 scoped_ptr<struct _NPP> npp_; | 843 scoped_ptr<struct _NPP> npp_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 855 // view change events. | 855 // view change events. |
| 856 base::WeakPtrFactory<PepperPluginInstanceImpl> view_change_weak_ptr_factory_; | 856 base::WeakPtrFactory<PepperPluginInstanceImpl> view_change_weak_ptr_factory_; |
| 857 | 857 |
| 858 friend class PpapiPluginInstanceTest; | 858 friend class PpapiPluginInstanceTest; |
| 859 DISALLOW_COPY_AND_ASSIGN(PepperPluginInstanceImpl); | 859 DISALLOW_COPY_AND_ASSIGN(PepperPluginInstanceImpl); |
| 860 }; | 860 }; |
| 861 | 861 |
| 862 } // namespace content | 862 } // namespace content |
| 863 | 863 |
| 864 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ | 864 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ |
| OLD | NEW |