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

Unified 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: review comments and undo checkdeps change Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.cc ('k') | webkit/plugins/ppapi/ppapi_plugin_instance_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppapi_plugin_instance_impl.h
===================================================================
--- webkit/plugins/ppapi/ppapi_plugin_instance_impl.h (revision 213350)
+++ webkit/plugins/ppapi/ppapi_plugin_instance_impl.h (working copy)
@@ -2,14 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_
-#define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_
+#ifndef WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_IMPL_H_
+#define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_IMPL_H_
#include <set>
#include <string>
#include <vector>
-#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@@ -24,7 +23,6 @@
#include "ppapi/c/dev/ppp_zoom_dev.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_time.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/c/ppb_audio_config.h"
@@ -53,6 +51,7 @@
#include "ui/gfx/rect.h"
#include "url/gurl.h"
#include "webkit/plugins/ppapi/plugin_delegate.h"
+#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
#include "webkit/plugins/ppapi/ppp_pdf.h"
#include "webkit/plugins/webkit_plugins_export.h"
@@ -62,10 +61,6 @@
class SkBitmap;
class TransportDIB;
-namespace IPC {
-struct ChannelHandle;
-}
-
namespace WebKit {
class WebInputEvent;
class WebLayer;
@@ -83,21 +78,10 @@
class TextureLayer;
}
-namespace content {
-class RenderView;
-}
-
-namespace gfx {
-class ImageSkia;
-}
-
namespace ppapi {
-class PpapiPermissions;
class Resource;
-class VarTracker;
struct InputEventData;
struct PPP_Instance_Combined;
-struct URLRequestInfoData;
}
namespace ui {
@@ -125,32 +109,30 @@
//
// Note: to get from a PP_Instance to a PluginInstance*, use the
// ResourceTracker.
-class WEBKIT_PLUGINS_EXPORT PluginInstance :
- public base::RefCounted<PluginInstance>,
- public base::SupportsWeakPtr<PluginInstance>,
+class WEBKIT_PLUGINS_EXPORT PluginInstanceImpl :
+ public base::RefCounted<PluginInstanceImpl>,
+ public base::SupportsWeakPtr<PluginInstanceImpl>,
+ public NON_EXPORTED_BASE(PluginInstance),
public ::ppapi::PPB_Instance_Shared {
public:
- // Create and return a PluginInstance object which supports the most recent
- // version of PPP_Instance possible by querying the given get_plugin_interface
- // function. If the plugin does not support any valid PPP_Instance interface,
- // returns NULL.
- static PluginInstance* Create(PluginDelegate* delegate,
- content::RenderView* render_view,
- PluginModule* module,
- WebKit::WebPluginContainer* container,
- const GURL& plugin_url);
+ // Create and return a PluginInstanceImpl object which supports the most
+ // recent version of PPP_Instance possible by querying the given
+ // get_plugin_interface function. If the plugin does not support any valid
+ // PPP_Instance interface, returns NULL.
+ static PluginInstanceImpl* Create(PluginDelegate* delegate,
+ content::RenderView* render_view,
+ PluginModule* module,
+ WebKit::WebPluginContainer* container,
+ const GURL& plugin_url);
// Delete should be called by the WebPlugin before this destructor.
- virtual ~PluginInstance();
+ virtual ~PluginInstanceImpl();
PluginDelegate* delegate() const { return delegate_; }
- content::RenderView* render_view() const {return render_view_; }
PluginModule* module() const { return module_.get(); }
MessageChannel& message_channel() { return *message_channel_; }
WebKit::WebPluginContainer* container() const { return container_; }
- void set_always_on_top(bool on_top) { always_on_top_ = on_top; }
-
// Returns the PP_Instance uniquely identifying this instance. Guaranteed
// nonzero.
PP_Instance pp_instance() const { return pp_instance_; }
@@ -193,7 +175,6 @@
void InstanceCrashed();
// PPB_Instance and PPB_Instance_Private implementation.
- const GURL& plugin_url() const { return plugin_url_; }
bool full_frame() const { return full_frame_; }
const ::ppapi::ViewData& view_data() const { return view_data_; }
@@ -301,12 +282,6 @@
// state.
bool FlashIsFullscreenOrPending();
- // Switches between fullscreen and normal mode. If |delay_report| is set to
- // false, it may report the new state through DidChangeView immediately. If
- // true, it will delay it. When called from the plugin, delay_report should
- // be true to avoid re-entrancy.
- void FlashSetFullscreen(bool fullscreen, bool delay_report);
-
// Updates |flash_fullscreen_| and sends focus change notification if
// necessary.
void UpdateFlashFullscreenState(bool flash_fullscreen);
@@ -337,21 +312,11 @@
// already in fullscreen mode).
bool SetFullscreen(bool fullscreen);
- // Implementation of PPB_Flash.
- int32_t Navigate(const ::ppapi::URLRequestInfoData& request,
- const char* target,
- bool from_user_action);
- bool IsRectTopmost(const gfx::Rect& rect);
-
// Implementation of PPP_Messaging.
void HandleMessage(PP_Var message);
PluginDelegate::PlatformContext3D* CreateContext3D();
- // Returns true iff the plugin is a full-page plugin (i.e. not in an iframe
- // or embedded in a page).
- bool IsFullPagePlugin() const;
-
// Returns true if the plugin is processing a user gesture.
bool IsProcessingUserGesture();
@@ -389,6 +354,30 @@
ContentDecryptorDelegate* GetContentDecryptorDelegate();
+ // webkit::ppapi::PluginInstance implementation
+ content::RenderView* GetRenderView();
+ virtual WebKit::WebPluginContainer* GetContainer();
+ virtual ::ppapi::VarTracker* GetVarTracker();
+ virtual const GURL& GetPluginURL();
+ virtual base::FilePath GetModulePath();
+ virtual PP_Resource CreateExternalFileReference(
+ const base::FilePath& external_file_path);
+ virtual PP_Resource CreateImage(gfx::ImageSkia* source_image,
+ float scale);
+ virtual PP_ExternalPluginResult SwitchToOutOfProcessProxy(
+ const base::FilePath& file_path,
+ ::ppapi::PpapiPermissions permissions,
+ const IPC::ChannelHandle& channel_handle,
+ base::ProcessId plugin_pid,
+ int plugin_child_id);
+ virtual void SetAlwaysOnTop(bool on_top);
+ virtual bool IsFullPagePlugin();
+ virtual void FlashSetFullscreen(bool fullscreen, bool delay_report);
+ virtual bool IsRectTopmost(const gfx::Rect& rect);
+ virtual int32_t Navigate(const ::ppapi::URLRequestInfoData& request,
+ const char* target,
+ bool from_user_action);
+
// PPB_Instance_API implementation.
virtual PP_Bool BindGraphics(PP_Instance instance,
PP_Resource device) OVERRIDE;
@@ -520,29 +509,6 @@
// This is not inlined so as to avoid an unnecessary header include of v8.h.
v8::Isolate* GetIsolate() const;
- static PluginInstance* Get(PP_Instance instance_id);
-
- ::ppapi::VarTracker* GetVarTracker();
-
- // Returns a reference to a file with the given path.
- // The returned object will have a refcount of 0 (just like "new").
- PP_Resource CreateExternalFileReference(
- const base::FilePath& external_file_path);
-
- // Creates a PPB_ImageData given a Skia image.
- PP_Resource CreateImage(gfx::ImageSkia* source_image, float scale);
-
- // Returns the location of this module.
- base::FilePath GetModulePath();
-
- // Switches this instance with one that uses the out of process IPC proxy.
- PP_ExternalPluginResult SwitchToOutOfProcessProxy(
- const base::FilePath& file_path,
- ::ppapi::PpapiPermissions permissions,
- const IPC::ChannelHandle& channel_handle,
- base::ProcessId plugin_pid,
- int plugin_child_id);
-
private:
friend class PpapiUnittest;
@@ -572,7 +538,7 @@
};
// Implements PPB_Gamepad_API. This is just to avoid having an excessive
- // number of interfaces implemented by PluginInstance.
+ // number of interfaces implemented by PluginInstanceImpl.
class GamepadImpl : public ::ppapi::thunk::PPB_Gamepad_API,
public ::ppapi::Resource {
public:
@@ -585,16 +551,16 @@
PluginDelegate* delegate_;
};
- // See the static Create functions above for creating PluginInstance objects.
- // This constructor is private so that we can hide the PPP_Instance_Combined
- // details while still having 1 constructor to maintain for member
- // initialization.
- PluginInstance(PluginDelegate* delegate,
- content::RenderView* render_view,
- PluginModule* module,
- ::ppapi::PPP_Instance_Combined* instance_interface,
- WebKit::WebPluginContainer* container,
- const GURL& plugin_url);
+ // See the static Create functions above for creating PluginInstanceImpl
+ // objects. This constructor is private so that we can hide the
+ // PPP_Instance_Combined details while still having 1 constructor to maintain
+ // for member initialization.
+ PluginInstanceImpl(PluginDelegate* delegate,
+ content::RenderView* render_view,
+ PluginModule* module,
+ ::ppapi::PPP_Instance_Combined* instance_interface,
+ WebKit::WebPluginContainer* container,
+ const GURL& plugin_url);
bool LoadFindInterface();
bool LoadInputEventInterface();
@@ -720,7 +686,7 @@
// already a weak ptr pending (HasWeakPtrs is true), code should update the
// view_data_ but not send updates. This also allows us to cancel scheduled
// view change events.
- base::WeakPtrFactory<PluginInstance> view_change_weak_ptr_factory_;
+ base::WeakPtrFactory<PluginInstanceImpl> view_change_weak_ptr_factory_;
// The current device context for painting in 2D and 3D.
scoped_refptr<PPB_Graphics3D_Impl> bound_graphics_3d_;
@@ -886,10 +852,10 @@
v8::Isolate* isolate_;
friend class PpapiPluginInstanceTest;
- DISALLOW_COPY_AND_ASSIGN(PluginInstance);
+ DISALLOW_COPY_AND_ASSIGN(PluginInstanceImpl);
};
} // namespace ppapi
} // namespace webkit
-#endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_
+#endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_IMPL_H_
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.cc ('k') | webkit/plugins/ppapi/ppapi_plugin_instance_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698