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

Side by Side Diff: webkit/plugins/ppapi/plugin_delegate.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_PLUGIN_DELEGATE_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_
6 #define WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ 6 #define WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 class P2PTransport; 104 class P2PTransport;
105 class NetworkListObserver; 105 class NetworkListObserver;
106 } // namespace webkit_glue 106 } // namespace webkit_glue
107 107
108 namespace webkit { 108 namespace webkit {
109 109
110 namespace ppapi { 110 namespace ppapi {
111 111
112 class FileIO; 112 class FileIO;
113 class FullscreenContainer; 113 class FullscreenContainer;
114 class PluginInstance; 114 class PluginInstanceImpl;
115 class PluginModule; 115 class PluginModule;
116 class PPB_Broker_Impl; 116 class PPB_Broker_Impl;
117 class PPB_Flash_Menu_Impl; 117 class PPB_Flash_Menu_Impl;
118 class PPB_ImageData_Impl; 118 class PPB_ImageData_Impl;
119 class PPB_TCPSocket_Private_Impl; 119 class PPB_TCPSocket_Private_Impl;
120 120
121 // Virtual interface that the browser implements to implement features for 121 // Virtual interface that the browser implements to implement features for
122 // PPAPI plugins. 122 // PPAPI plugins.
123 class PluginDelegate { 123 class PluginDelegate {
124 public: 124 public:
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 class WEBKIT_PLUGINS_EXPORT PlatformGraphics2D { 196 class WEBKIT_PLUGINS_EXPORT PlatformGraphics2D {
197 public: 197 public:
198 virtual ~PlatformGraphics2D() {} 198 virtual ~PlatformGraphics2D() {}
199 199
200 virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) = 0; 200 virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) = 0;
201 201
202 // Assciates this device with the given plugin instance. You can pass NULL 202 // Assciates this device with the given plugin instance. You can pass NULL
203 // to clear the existing device. Returns true on success. In this case, a 203 // to clear the existing device. Returns true on success. In this case, a
204 // repaint of the page will also be scheduled. Failure means that the device 204 // repaint of the page will also be scheduled. Failure means that the device
205 // is already bound to a different instance, and nothing will happen. 205 // is already bound to a different instance, and nothing will happen.
206 virtual bool BindToInstance(PluginInstance* new_instance) = 0; 206 virtual bool BindToInstance(PluginInstanceImpl* new_instance) = 0;
207 207
208 // Paints the current backing store to the web page. 208 // Paints the current backing store to the web page.
209 virtual void Paint(WebKit::WebCanvas* canvas, 209 virtual void Paint(WebKit::WebCanvas* canvas,
210 const gfx::Rect& plugin_rect, 210 const gfx::Rect& plugin_rect,
211 const gfx::Rect& paint_rect) = 0; 211 const gfx::Rect& paint_rect) = 0;
212 212
213 // Notifications about the view's progress painting. See PluginInstance. 213 // Notifications about the view's progress painting. See PluginInstance.
214 // These messages are used to send Flush callbacks to the plugin. 214 // These messages are used to send Flush callbacks to the plugin.
215 virtual void ViewWillInitiatePaint() = 0; 215 virtual void ViewWillInitiatePaint() = 0;
216 virtual void ViewInitiatedPaint() = 0; 216 virtual void ViewInitiatedPaint() = 0;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 // When there are no more references, this renderer's dispatcher is 354 // When there are no more references, this renderer's dispatcher is
355 // destroyed, allowing the broker to shutdown if appropriate. 355 // destroyed, allowing the broker to shutdown if appropriate.
356 // Callers should not reference this object after calling Disconnect(). 356 // Callers should not reference this object after calling Disconnect().
357 virtual void Disconnect(webkit::ppapi::PPB_Broker_Impl* client) = 0; 357 virtual void Disconnect(webkit::ppapi::PPB_Broker_Impl* client) = 0;
358 358
359 protected: 359 protected:
360 virtual ~Broker() {} 360 virtual ~Broker() {}
361 }; 361 };
362 362
363 // Notification that the given plugin is focused or unfocused. 363 // Notification that the given plugin is focused or unfocused.
364 virtual void PluginFocusChanged(webkit::ppapi::PluginInstance* instance, 364 virtual void PluginFocusChanged(webkit::ppapi::PluginInstanceImpl* instance,
365 bool focused) = 0; 365 bool focused) = 0;
366 // Notification that the text input status of the given plugin is changed. 366 // Notification that the text input status of the given plugin is changed.
367 virtual void PluginTextInputTypeChanged( 367 virtual void PluginTextInputTypeChanged(
368 webkit::ppapi::PluginInstance* instance) = 0; 368 webkit::ppapi::PluginInstanceImpl* instance) = 0;
369 // Notification that the caret position in the given plugin is changed. 369 // Notification that the caret position in the given plugin is changed.
370 virtual void PluginCaretPositionChanged( 370 virtual void PluginCaretPositionChanged(
371 webkit::ppapi::PluginInstance* instance) = 0; 371 webkit::ppapi::PluginInstanceImpl* instance) = 0;
372 // Notification that the plugin requested to cancel the current composition. 372 // Notification that the plugin requested to cancel the current composition.
373 virtual void PluginRequestedCancelComposition( 373 virtual void PluginRequestedCancelComposition(
374 webkit::ppapi::PluginInstance* instance) = 0; 374 webkit::ppapi::PluginInstanceImpl* instance) = 0;
375 // Notification that the text selection in the given plugin is changed. 375 // Notification that the text selection in the given plugin is changed.
376 virtual void PluginSelectionChanged( 376 virtual void PluginSelectionChanged(
377 webkit::ppapi::PluginInstance* instance) = 0; 377 webkit::ppapi::PluginInstanceImpl* instance) = 0;
378 // Requests simulating IME events for testing purpose. 378 // Requests simulating IME events for testing purpose.
379 virtual void SimulateImeSetComposition( 379 virtual void SimulateImeSetComposition(
380 const base::string16& text, 380 const base::string16& text,
381 const std::vector<WebKit::WebCompositionUnderline>& underlines, 381 const std::vector<WebKit::WebCompositionUnderline>& underlines,
382 int selection_start, 382 int selection_start,
383 int selection_end) = 0; 383 int selection_end) = 0;
384 virtual void SimulateImeConfirmComposition(const base::string16& text) = 0; 384 virtual void SimulateImeConfirmComposition(const base::string16& text) = 0;
385 385
386 // Notification that the given plugin has crashed. When a plugin crashes, all 386 // Notification that the given plugin has crashed. When a plugin crashes, all
387 // instances associated with that plugin will notify that they've crashed via 387 // instances associated with that plugin will notify that they've crashed via
388 // this function. 388 // this function.
389 virtual void PluginCrashed(PluginInstance* instance) = 0; 389 virtual void PluginCrashed(PluginInstanceImpl* instance) = 0;
390 390
391 // Indicates that the given instance has been created. 391 // Indicates that the given instance has been created.
392 virtual void InstanceCreated(PluginInstance* instance) = 0; 392 virtual void InstanceCreated(PluginInstanceImpl* instance) = 0;
393 393
394 // Indicates that the given instance is being destroyed. This is called from 394 // Indicates that the given instance is being destroyed. This is called from
395 // the destructor, so it's important that the instance is not dereferenced 395 // the destructor, so it's important that the instance is not dereferenced
396 // from this call. 396 // from this call.
397 virtual void InstanceDeleted(PluginInstance* instance) = 0; 397 virtual void InstanceDeleted(PluginInstanceImpl* instance) = 0;
398 398
399 // Creates the resource creation API for the given instance. 399 // Creates the resource creation API for the given instance.
400 virtual scoped_ptr< ::ppapi::thunk::ResourceCreationAPI> 400 virtual scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
401 CreateResourceCreationAPI(PluginInstance* instance) = 0; 401 CreateResourceCreationAPI(PluginInstanceImpl* instance) = 0;
402 402
403 // Returns a pointer (ownership not transferred) to the bitmap to paint the 403 // Returns a pointer (ownership not transferred) to the bitmap to paint the
404 // sad plugin screen with. Returns NULL on failure. 404 // sad plugin screen with. Returns NULL on failure.
405 virtual SkBitmap* GetSadPluginBitmap() = 0; 405 virtual SkBitmap* GetSadPluginBitmap() = 0;
406 406
407 // Creates a replacement plug-in that is shown when the plug-in at |file_path| 407 // Creates a replacement plug-in that is shown when the plug-in at |file_path|
408 // couldn't be loaded. 408 // couldn't be loaded.
409 virtual WebKit::WebPlugin* CreatePluginReplacement( 409 virtual WebKit::WebPlugin* CreatePluginReplacement(
410 const base::FilePath& file_path) = 0; 410 const base::FilePath& file_path) = 0;
411 411
412 // The caller will own the pointer returned from this. 412 // The caller will own the pointer returned from this.
413 virtual PlatformImage2D* CreateImage2D(int width, int height) = 0; 413 virtual PlatformImage2D* CreateImage2D(int width, int height) = 0;
414 414
415 // Returns the internal PlatformGraphics2D implementation. 415 // Returns the internal PlatformGraphics2D implementation.
416 virtual PlatformGraphics2D* GetGraphics2D(PluginInstance* instance, 416 virtual PlatformGraphics2D* GetGraphics2D(PluginInstanceImpl* instance,
417 PP_Resource graphics_2d) = 0; 417 PP_Resource graphics_2d) = 0;
418 418
419 // The caller will own the pointer returned from this. 419 // The caller will own the pointer returned from this.
420 virtual PlatformContext3D* CreateContext3D() = 0; 420 virtual PlatformContext3D* CreateContext3D() = 0;
421 421
422 // If |device_id| is empty, the default video capture device will be used. The 422 // If |device_id| is empty, the default video capture device will be used. The
423 // user can start using the returned object to capture video right away. 423 // user can start using the returned object to capture video right away.
424 // Otherwise, the specified device will be used. The user needs to wait till 424 // Otherwise, the specified device will be used. The user needs to wait till
425 // |handler| gets an OnInitialized() notification to start using the returned 425 // |handler| gets an OnInitialized() notification to start using the returned
426 // object. 426 // object.
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 webkit_glue::NetworkListObserver* observer) = 0; 602 webkit_glue::NetworkListObserver* observer) = 0;
603 603
604 // For PPB_X509Certificate_Private. 604 // For PPB_X509Certificate_Private.
605 virtual bool X509CertificateParseDER( 605 virtual bool X509CertificateParseDER(
606 const std::vector<char>& der, 606 const std::vector<char>& der,
607 ::ppapi::PPB_X509Certificate_Fields* fields) = 0; 607 ::ppapi::PPB_X509Certificate_Fields* fields) = 0;
608 608
609 // Create a fullscreen container for a plugin instance. This effectively 609 // Create a fullscreen container for a plugin instance. This effectively
610 // switches the plugin to fullscreen. 610 // switches the plugin to fullscreen.
611 virtual FullscreenContainer* CreateFullscreenContainer( 611 virtual FullscreenContainer* CreateFullscreenContainer(
612 PluginInstance* instance) = 0; 612 PluginInstanceImpl* instance) = 0;
613 613
614 // Gets the size of the screen. The fullscreen window will be created at that 614 // Gets the size of the screen. The fullscreen window will be created at that
615 // size. 615 // size.
616 virtual gfx::Size GetScreenSize() = 0; 616 virtual gfx::Size GetScreenSize() = 0;
617 617
618 // Returns a string with the name of the default 8-bit char encoding. 618 // Returns a string with the name of the default 8-bit char encoding.
619 virtual std::string GetDefaultEncoding() = 0; 619 virtual std::string GetDefaultEncoding() = 0;
620 620
621 // Sets the minimum and maximum zoom factors. 621 // Sets the minimum and maximum zoom factors.
622 virtual void ZoomLimitsChanged(double minimum_factor, 622 virtual void ZoomLimitsChanged(double minimum_factor,
623 double maximum_factor) = 0; 623 double maximum_factor) = 0;
624 624
625 // Create an anonymous shared memory segment of size |size| bytes, and return 625 // Create an anonymous shared memory segment of size |size| bytes, and return
626 // a pointer to it, or NULL on error. Caller owns the returned pointer. 626 // a pointer to it, or NULL on error. Caller owns the returned pointer.
627 virtual base::SharedMemory* CreateAnonymousSharedMemory(size_t size) = 0; 627 virtual base::SharedMemory* CreateAnonymousSharedMemory(size_t size) = 0;
628 628
629 // Returns the current preferences. 629 // Returns the current preferences.
630 virtual ::ppapi::Preferences GetPreferences() = 0; 630 virtual ::ppapi::Preferences GetPreferences() = 0;
631 631
632 // Locks the mouse for |instance|. If false is returned, the lock is not 632 // Locks the mouse for |instance|. If false is returned, the lock is not
633 // possible. If true is returned then the lock is pending. Success or 633 // possible. If true is returned then the lock is pending. Success or
634 // failure will be delivered asynchronously via 634 // failure will be delivered asynchronously via
635 // PluginInstance::OnLockMouseACK(). 635 // PluginInstance::OnLockMouseACK().
636 virtual bool LockMouse(PluginInstance* instance) = 0; 636 virtual bool LockMouse(PluginInstanceImpl* instance) = 0;
637 637
638 // Unlocks the mouse if |instance| currently owns the mouse lock. Whenever an 638 // Unlocks the mouse if |instance| currently owns the mouse lock. Whenever an
639 // plugin instance has lost the mouse lock, it will be notified by 639 // plugin instance has lost the mouse lock, it will be notified by
640 // PluginInstance::OnMouseLockLost(). Please note that UnlockMouse() is not 640 // PluginInstance::OnMouseLockLost(). Please note that UnlockMouse() is not
641 // the only cause of losing mouse lock. For example, a user may press the Esc 641 // the only cause of losing mouse lock. For example, a user may press the Esc
642 // key to quit the mouse lock mode, which also results in an OnMouseLockLost() 642 // key to quit the mouse lock mode, which also results in an OnMouseLockLost()
643 // call to the current mouse lock owner. 643 // call to the current mouse lock owner.
644 virtual void UnlockMouse(PluginInstance* instance) = 0; 644 virtual void UnlockMouse(PluginInstanceImpl* instance) = 0;
645 645
646 // Returns true iff |instance| currently owns the mouse lock. 646 // Returns true iff |instance| currently owns the mouse lock.
647 virtual bool IsMouseLocked(PluginInstance* instance) = 0; 647 virtual bool IsMouseLocked(PluginInstanceImpl* instance) = 0;
648 648
649 // Notifies that |instance| has changed the cursor. 649 // Notifies that |instance| has changed the cursor.
650 // This will update the cursor appearance if it is currently over the plugin 650 // This will update the cursor appearance if it is currently over the plugin
651 // instance. 651 // instance.
652 virtual void DidChangeCursor(PluginInstance* instance, 652 virtual void DidChangeCursor(PluginInstanceImpl* instance,
653 const WebKit::WebCursorInfo& cursor) = 0; 653 const WebKit::WebCursorInfo& cursor) = 0;
654 654
655 // Notifies that |instance| has received a mouse event. 655 // Notifies that |instance| has received a mouse event.
656 virtual void DidReceiveMouseEvent(PluginInstance* instance) = 0; 656 virtual void DidReceiveMouseEvent(PluginInstanceImpl* instance) = 0;
657 657
658 // Determines if the browser entered fullscreen mode. 658 // Determines if the browser entered fullscreen mode.
659 virtual bool IsInFullscreenMode() = 0; 659 virtual bool IsInFullscreenMode() = 0;
660 660
661 // Retrieve current gamepad data. 661 // Retrieve current gamepad data.
662 virtual void SampleGamepads(WebKit::WebGamepads* data) = 0; 662 virtual void SampleGamepads(WebKit::WebGamepads* data) = 0;
663 663
664 // Returns true if the containing page is visible. 664 // Returns true if the containing page is visible.
665 virtual bool IsPageVisible() const = 0; 665 virtual bool IsPageVisible() const = 0;
666 666
(...skipping 18 matching lines...) Expand all
685 bool should_close_source) const = 0; 685 bool should_close_source) const = 0;
686 686
687 // Returns true if running in process. 687 // Returns true if running in process.
688 virtual bool IsRunningInProcess(PP_Instance instance) const = 0; 688 virtual bool IsRunningInProcess(PP_Instance instance) const = 0;
689 689
690 // Notifies the plugin of the document load. This should initiate the call to 690 // Notifies the plugin of the document load. This should initiate the call to
691 // PPP_Instance.HandleDocumentLoad. 691 // PPP_Instance.HandleDocumentLoad.
692 // 692 //
693 // The loader object should set itself on the PluginInstance as the document 693 // The loader object should set itself on the PluginInstance as the document
694 // loader using set_document_loader. 694 // loader using set_document_loader.
695 virtual void HandleDocumentLoad(PluginInstance* instance, 695 virtual void HandleDocumentLoad(PluginInstanceImpl* instance,
696 const WebKit::WebURLResponse& response) = 0; 696 const WebKit::WebURLResponse& response) = 0;
697 697
698 // Sets up the renderer host and out-of-process proxy for an external plugin 698 // Sets up the renderer host and out-of-process proxy for an external plugin
699 // module. Returns the renderer host, or NULL if it couldn't be created. 699 // module. Returns the renderer host, or NULL if it couldn't be created.
700 virtual content::RendererPpapiHost* CreateExternalPluginModule( 700 virtual content::RendererPpapiHost* CreateExternalPluginModule(
701 scoped_refptr<PluginModule> module, 701 scoped_refptr<PluginModule> module,
702 const base::FilePath& path, 702 const base::FilePath& path,
703 ::ppapi::PpapiPermissions permissions, 703 ::ppapi::PpapiPermissions permissions,
704 const IPC::ChannelHandle& channel_handle, 704 const IPC::ChannelHandle& channel_handle,
705 base::ProcessId plugin_pid, 705 base::ProcessId plugin_pid,
706 int plugin_child_id) = 0; 706 int plugin_child_id) = 0;
707 }; 707 };
708 708
709 } // namespace ppapi 709 } // namespace ppapi
710 } // namespace webkit 710 } // namespace webkit
711 711
712 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ 712 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698