summaryrefslogtreecommitdiffstats
path: root/webkit/glue/plugins
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-11-25 19:40:10 +0000
committerBen Murdoch <benm@google.com>2010-12-03 13:52:53 +0000
commit4a5e2dc747d50c653511c68ccb2cfbfb740bd5a7 (patch)
tree938665d93a11fe7a6d0124e3c1e020d1f9d3f947 /webkit/glue/plugins
parent7c627d87728a355737862918d144f98f69406954 (diff)
downloadexternal_chromium-4a5e2dc747d50c653511c68ccb2cfbfb740bd5a7.zip
external_chromium-4a5e2dc747d50c653511c68ccb2cfbfb740bd5a7.tar.gz
external_chromium-4a5e2dc747d50c653511c68ccb2cfbfb740bd5a7.tar.bz2
Merge Chromium at r66597: Initial merge by git.
Change-Id: I9639f8a997f90ec219573aa22a49f5dbde78cc7b
Diffstat (limited to 'webkit/glue/plugins')
-rw-r--r--webkit/glue/plugins/pepper_file_chooser.cc4
-rw-r--r--webkit/glue/plugins/pepper_file_ref.cc14
-rw-r--r--webkit/glue/plugins/pepper_graphics_2d.cc5
-rw-r--r--webkit/glue/plugins/pepper_graphics_3d_gl.cc10
-rw-r--r--webkit/glue/plugins/pepper_plugin_instance.cc2
-rw-r--r--webkit/glue/plugins/pepper_plugin_module.cc82
-rw-r--r--webkit/glue/plugins/pepper_plugin_module.h28
-rw-r--r--webkit/glue/plugins/pepper_url_loader.cc38
-rw-r--r--webkit/glue/plugins/pepper_url_loader.h21
-rw-r--r--webkit/glue/plugins/pepper_url_request_info.cc10
-rw-r--r--webkit/glue/plugins/pepper_url_request_info.h8
-rw-r--r--webkit/glue/plugins/pepper_url_response_info.cc8
-rw-r--r--webkit/glue/plugins/pepper_url_response_info.h6
-rw-r--r--webkit/glue/plugins/plugin_host.cc17
-rw-r--r--webkit/glue/plugins/plugin_lib.cc27
-rw-r--r--webkit/glue/plugins/plugin_list.cc10
-rw-r--r--webkit/glue/plugins/plugin_list.h5
-rw-r--r--webkit/glue/plugins/plugin_list_posix.cc2
18 files changed, 216 insertions, 81 deletions
diff --git a/webkit/glue/plugins/pepper_file_chooser.cc b/webkit/glue/plugins/pepper_file_chooser.cc
index fd3ade1..2b54790 100644
--- a/webkit/glue/plugins/pepper_file_chooser.cc
+++ b/webkit/glue/plugins/pepper_file_chooser.cc
@@ -38,6 +38,10 @@ PP_Resource Create(PP_Instance instance_id,
if (!instance)
return 0;
+ if ((options->mode != PP_FILECHOOSERMODE_OPEN) &&
+ (options->mode != PP_FILECHOOSERMODE_OPENMULTIPLE))
+ return 0;
+
FileChooser* chooser = new FileChooser(instance, options);
return chooser->GetReference();
}
diff --git a/webkit/glue/plugins/pepper_file_ref.cc b/webkit/glue/plugins/pepper_file_ref.cc
index 67e39e3..6068a29 100644
--- a/webkit/glue/plugins/pepper_file_ref.cc
+++ b/webkit/glue/plugins/pepper_file_ref.cc
@@ -266,8 +266,18 @@ const PPB_FileRef_Dev* FileRef::GetInterface() {
}
std::string FileRef::GetName() const {
- if (GetFileSystemType() == PP_FILESYSTEMTYPE_EXTERNAL)
- return std::string();
+ if (GetFileSystemType() == PP_FILESYSTEMTYPE_EXTERNAL) {
+ FilePath::StringType path = system_path_.value();
+ size_t pos = path.rfind(FilePath::kSeparators[0]);
+ DCHECK(pos != FilePath::StringType::npos);
+#if defined(OS_WIN)
+ return WideToUTF8(path.substr(pos + 1));
+#elif defined(OS_POSIX)
+ return path.substr(pos + 1);
+#else
+#error "Unsupported platform."
+#endif
+ }
if (virtual_path_.size() == 1 && virtual_path_[0] == '/')
return virtual_path_;
diff --git a/webkit/glue/plugins/pepper_graphics_2d.cc b/webkit/glue/plugins/pepper_graphics_2d.cc
index a8d5091..7ccfae5 100644
--- a/webkit/glue/plugins/pepper_graphics_2d.cc
+++ b/webkit/glue/plugins/pepper_graphics_2d.cc
@@ -299,7 +299,7 @@ void Graphics2D::Scroll(const PP_Rect* clip_rect, const PP_Point* amount) {
int32 dx = amount->x;
int32 dy = amount->y;
if (dx <= -image_data_->width() || dx >= image_data_->width() ||
- dx <= -image_data_->height() || dy >= image_data_->height())
+ dy <= -image_data_->height() || dy >= image_data_->height())
return;
operation.scroll_dx = dx;
@@ -420,6 +420,7 @@ bool Graphics2D::ReadImageData(PP_Resource image,
SkIntToScalar(image_resource->width()),
SkIntToScalar(image_resource->height()) };
+ ImageDataAutoMapper auto_mapper2(image_data_);
if (image_resource->format() != image_data_->format()) {
// Convert the image data if the format does not match.
ConvertImageData(image_data_, src_irect, image_resource.get(), dest_rect);
@@ -472,7 +473,7 @@ bool Graphics2D::BindToInstance(PluginInstance* new_instance) {
void Graphics2D::Paint(WebKit::WebCanvas* canvas,
const gfx::Rect& plugin_rect,
const gfx::Rect& paint_rect) {
- // We're guaranteed to have a mapped canvas since we mapped it in Init().
+ ImageDataAutoMapper auto_mapper(image_data_);
const SkBitmap& backing_bitmap = *image_data_->GetMappedBitmap();
#if defined(OS_MACOSX)
diff --git a/webkit/glue/plugins/pepper_graphics_3d_gl.cc b/webkit/glue/plugins/pepper_graphics_3d_gl.cc
index 2ce8de0..6c301e4 100644
--- a/webkit/glue/plugins/pepper_graphics_3d_gl.cc
+++ b/webkit/glue/plugins/pepper_graphics_3d_gl.cc
@@ -550,8 +550,13 @@ void* MapTexSubImage2D(
void UnmapTexSubImage2D(const void* mem) {
Graphics3D::GetCurrent()->impl()->UnmapTexSubImage2D(mem);
}
+void CopyTextureToParentTexture(
+ GLuint client_child_id, GLuint client_parent_id) {
+ Graphics3D::GetCurrent()->impl()->CopyTextureToParentTexture(
+ client_child_id, client_parent_id);
+}
-const PPB_OpenGLES_Dev ppb_opengles = {
+const struct PPB_OpenGLES_Dev ppb_opengles = {
&ActiveTexture,
&AttachShader,
&BindAttribLocation,
@@ -703,7 +708,8 @@ const PPB_OpenGLES_Dev ppb_opengles = {
&MapBufferSubData,
&UnmapBufferSubData,
&MapTexSubImage2D,
- &UnmapTexSubImage2D
+ &UnmapTexSubImage2D,
+ &CopyTextureToParentTexture
};
} // namespace
diff --git a/webkit/glue/plugins/pepper_plugin_instance.cc b/webkit/glue/plugins/pepper_plugin_instance.cc
index 47ea900..b4cd681 100644
--- a/webkit/glue/plugins/pepper_plugin_instance.cc
+++ b/webkit/glue/plugins/pepper_plugin_instance.cc
@@ -437,7 +437,6 @@ bool PluginInstance::BindGraphics(PP_Resource graphics_id) {
if (graphics_2d) {
if (!graphics_2d->BindToInstance(this))
return false; // Can't bind to more than one instance.
- bound_graphics_ = graphics_2d;
// See http://crbug.com/49403: this can be further optimized by keeping the
// old device around and painting from it.
@@ -458,6 +457,7 @@ bool PluginInstance::BindGraphics(PP_Resource graphics_id) {
canvas.drawARGB(255, 255, 255, 255);
}
+ bound_graphics_ = graphics_2d;
// BindToInstance will have invalidated the plugin if necessary.
} else if (graphics_3d) {
if (!graphics_3d->BindToInstance(this))
diff --git a/webkit/glue/plugins/pepper_plugin_module.cc b/webkit/glue/plugins/pepper_plugin_module.cc
index 662055a..b7bad9f 100644
--- a/webkit/glue/plugins/pepper_plugin_module.cc
+++ b/webkit/glue/plugins/pepper_plugin_module.cc
@@ -27,16 +27,11 @@
#include "ppapi/c/dev/ppb_scrollbar_dev.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
#include "ppapi/c/dev/ppb_transport_dev.h"
-#include "ppapi/c/dev/ppb_url_loader_dev.h"
-#include "ppapi/c/dev/ppb_url_loader_trusted_dev.h"
-#include "ppapi/c/dev/ppb_url_request_info_dev.h"
-#include "ppapi/c/dev/ppb_url_response_info_dev.h"
#include "ppapi/c/dev/ppb_url_util_dev.h"
#include "ppapi/c/dev/ppb_var_deprecated.h"
#include "ppapi/c/dev/ppb_video_decoder_dev.h"
#include "ppapi/c/dev/ppb_widget_dev.h"
#include "ppapi/c/dev/ppb_zoom_dev.h"
-#include "ppapi/c/trusted/ppb_image_data_trusted.h"
#include "ppapi/c/pp_module.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_var.h"
@@ -45,9 +40,16 @@
#include "ppapi/c/ppb_graphics_2d.h"
#include "ppapi/c/ppb_image_data.h"
#include "ppapi/c/ppb_instance.h"
+#include "ppapi/c/ppb_url_loader.h"
+#include "ppapi/c/ppb_url_request_info.h"
+#include "ppapi/c/ppb_url_response_info.h"
#include "ppapi/c/ppb_var.h"
#include "ppapi/c/ppp.h"
#include "ppapi/c/ppp_instance.h"
+#include "ppapi/c/trusted/ppb_image_data_trusted.h"
+#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
+#include "ppapi/proxy/host_dispatcher.h"
+#include "ppapi/proxy/ppapi_messages.h"
#include "webkit/glue/plugins/pepper_audio.h"
#include "webkit/glue/plugins/pepper_buffer.h"
#include "webkit/glue/plugins/pepper_common.h"
@@ -83,6 +85,10 @@
#include "webkit/glue/plugins/pepper_graphics_3d.h"
#endif // ENABLE_GPU
+#if defined(OS_POSIX)
+#include "ipc/ipc_channel_posix.h"
+#endif
+
namespace pepper {
namespace {
@@ -227,13 +233,13 @@ const void* GetInterface(const char* name) {
#endif // ENABLE_GPU
if (strcmp(name, PPB_TRANSPORT_DEV_INTERFACE) == 0)
return Transport::GetInterface();
- if (strcmp(name, PPB_URLLOADER_DEV_INTERFACE) == 0)
+ if (strcmp(name, PPB_URLLOADER_INTERFACE) == 0)
return URLLoader::GetInterface();
- if (strcmp(name, PPB_URLLOADERTRUSTED_DEV_INTERFACE) == 0)
+ if (strcmp(name, PPB_URLLOADERTRUSTED_INTERFACE) == 0)
return URLLoader::GetTrustedInterface();
- if (strcmp(name, PPB_URLREQUESTINFO_DEV_INTERFACE) == 0)
+ if (strcmp(name, PPB_URLREQUESTINFO_INTERFACE) == 0)
return URLRequestInfo::GetInterface();
- if (strcmp(name, PPB_URLRESPONSEINFO_DEV_INTERFACE) == 0)
+ if (strcmp(name, PPB_URLRESPONSEINFO_INTERFACE) == 0)
return URLResponseInfo::GetInterface();
if (strcmp(name, PPB_BUFFER_DEV_INTERFACE) == 0)
return Buffer::GetInterface();
@@ -335,6 +341,7 @@ scoped_refptr<PluginModule> PluginModule::CreateModule(
return lib;
}
+// static
scoped_refptr<PluginModule> PluginModule::CreateInternalModule(
EntryPoints entry_points) {
scoped_refptr<PluginModule> lib(new PluginModule());
@@ -345,6 +352,17 @@ scoped_refptr<PluginModule> PluginModule::CreateInternalModule(
}
// static
+scoped_refptr<PluginModule> PluginModule::CreateOutOfProcessModule(
+ MessageLoop* ipc_message_loop,
+ const IPC::ChannelHandle& handle,
+ base::WaitableEvent* shutdown_event) {
+ scoped_refptr<PluginModule> lib(new PluginModule);
+ if (!lib->InitForOutOfProcess(ipc_message_loop, handle, shutdown_event))
+ return NULL;
+ return lib;
+}
+
+// static
const PPB_Core* PluginModule::GetCore() {
return &core_interface;
}
@@ -386,10 +404,41 @@ bool PluginModule::InitFromFile(const FilePath& path) {
return true;
}
+bool PluginModule::InitForOutOfProcess(MessageLoop* ipc_message_loop,
+ const IPC::ChannelHandle& handle,
+ base::WaitableEvent* shutdown_event) {
+ const PPB_Var_Deprecated* var_interface =
+ reinterpret_cast<const PPB_Var_Deprecated*>(
+ GetInterface(PPB_VAR_DEPRECATED_INTERFACE));
+ dispatcher_.reset(new pp::proxy::HostDispatcher(var_interface,
+ pp_module(), &GetInterface));
+
+#if defined(OS_POSIX)
+ // If we received a ChannelHandle, register it now.
+ if (handle.socket.fd >= 0)
+ IPC::AddChannelSocket(handle.name, handle.socket.fd);
+#endif
+
+ if (!dispatcher_->InitWithChannel(ipc_message_loop, handle.name, true,
+ shutdown_event)) {
+ dispatcher_.reset();
+ return false;
+ }
+
+ bool init_result = false;
+ dispatcher_->Send(new PpapiMsg_InitializeModule(pp_module(), &init_result));
+
+ if (!init_result) {
+ // TODO(brettw) does the module get unloaded in this case?
+ dispatcher_.reset();
+ return false;
+ }
+ return true;
+}
+
// static
bool PluginModule::LoadEntryPoints(const base::NativeLibrary& library,
EntryPoints* entry_points) {
-
entry_points->get_interface =
reinterpret_cast<PPP_GetInterfaceFunc>(
base::GetFunctionPointerFromNativeLibrary(library,
@@ -426,7 +475,13 @@ PluginInstance* PluginModule::CreateInstance(PluginDelegate* delegate) {
LOG(WARNING) << "Plugin doesn't support instance interface, failing.";
return NULL;
}
- return new PluginInstance(delegate, this, plugin_instance_interface);
+ PluginInstance* instance = new PluginInstance(delegate, this,
+ plugin_instance_interface);
+ if (dispatcher_.get()) {
+ pp::proxy::HostDispatcher::SetForInstance(instance->pp_instance(),
+ dispatcher_.get());
+ }
+ return instance;
}
PluginInstance* PluginModule::GetSomeInstance() const {
@@ -437,6 +492,10 @@ PluginInstance* PluginModule::GetSomeInstance() const {
}
const void* PluginModule::GetPluginInterface(const char* name) const {
+ if (dispatcher_.get())
+ return dispatcher_->GetProxiedInterface(name);
+
+ // In-process plugins.
if (!entry_points_.get_interface)
return NULL;
return entry_points_.get_interface(name);
@@ -447,6 +506,7 @@ void PluginModule::InstanceCreated(PluginInstance* instance) {
}
void PluginModule::InstanceDeleted(PluginInstance* instance) {
+ pp::proxy::HostDispatcher::RemoveForInstance(instance->pp_instance());
instances_.erase(instance);
}
diff --git a/webkit/glue/plugins/pepper_plugin_module.h b/webkit/glue/plugins/pepper_plugin_module.h
index cf7defb..6ba3146 100644
--- a/webkit/glue/plugins/pepper_plugin_module.h
+++ b/webkit/glue/plugins/pepper_plugin_module.h
@@ -16,10 +16,25 @@
#include "ppapi/c/ppb.h"
class FilePath;
+class MessageLoop;
typedef struct NPObject NPObject;
struct PPB_Core;
typedef void* NPIdentifier;
+namespace base {
+class WaitableEvent;
+}
+
+namespace pp {
+namespace proxy {
+class HostDispatcher;
+} // proxy
+} // pp
+
+namespace IPC {
+struct ChannelHandle;
+}
+
namespace pepper {
class ObjectVar;
@@ -56,6 +71,10 @@ class PluginModule : public base::RefCounted<PluginModule>,
static scoped_refptr<PluginModule> CreateModule(const FilePath& path);
static scoped_refptr<PluginModule> CreateInternalModule(
EntryPoints entry_points);
+ static scoped_refptr<PluginModule> CreateOutOfProcessModule(
+ MessageLoop* ipc_message_loop,
+ const IPC::ChannelHandle& handle,
+ base::WaitableEvent* shutdown_event);
static const PPB_Core* GetCore();
@@ -101,9 +120,16 @@ class PluginModule : public base::RefCounted<PluginModule>,
bool InitFromEntryPoints(const EntryPoints& entry_points);
bool InitFromFile(const FilePath& path);
+ bool InitForOutOfProcess(MessageLoop* ipc_message_loop,
+ const IPC::ChannelHandle& handle,
+ base::WaitableEvent* shutdown_event);
static bool LoadEntryPoints(const base::NativeLibrary& library,
EntryPoints* entry_points);
+ // Dispatcher for out-of-process plugins. This will be null when the plugin
+ // is being run in-process.
+ scoped_ptr<pp::proxy::HostDispatcher> dispatcher_;
+
PP_Module pp_module_;
bool initialized_;
@@ -115,7 +141,7 @@ class PluginModule : public base::RefCounted<PluginModule>,
base::NativeLibrary library_;
// Contains pointers to the entry points of the actual plugin
- // implementation.
+ // implementation. These will be NULL for out-of-process plugins.
EntryPoints entry_points_;
// The name of the module.
diff --git a/webkit/glue/plugins/pepper_url_loader.cc b/webkit/glue/plugins/pepper_url_loader.cc
index c9a580a..2d94172 100644
--- a/webkit/glue/plugins/pepper_url_loader.cc
+++ b/webkit/glue/plugins/pepper_url_loader.cc
@@ -7,8 +7,8 @@
#include "base/logging.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/dev/ppb_url_loader_dev.h"
-#include "ppapi/c/dev/ppb_url_loader_trusted_dev.h"
+#include "ppapi/c/ppb_url_loader.h"
+#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/WebKit/chromium/public/WebElement.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
@@ -142,7 +142,7 @@ void Close(PP_Resource loader_id) {
loader->Close();
}
-const PPB_URLLoader_Dev ppb_urlloader = {
+const PPB_URLLoader ppb_urlloader = {
&Create,
&IsURLLoader,
&Open,
@@ -171,7 +171,7 @@ void SetStatusCallback(PP_Resource loader_id,
loader->SetStatusCallback(cb);
}
-const PPB_URLLoaderTrusted_Dev ppb_urlloadertrusted = {
+const PPB_URLLoaderTrusted ppb_urlloadertrusted = {
&GrantUniversalAccess,
&SetStatusCallback
};
@@ -194,8 +194,6 @@ URLLoader::URLLoader(PluginInstance* instance, bool main_document_loader)
user_buffer_(NULL),
user_buffer_size_(0),
done_status_(PP_ERROR_WOULDBLOCK),
- record_download_progress_(false),
- record_upload_progress_(false),
has_universal_access_(false),
status_callback_(NULL) {
instance->AddObserver(this);
@@ -207,12 +205,12 @@ URLLoader::~URLLoader() {
}
// static
-const PPB_URLLoader_Dev* URLLoader::GetInterface() {
+const PPB_URLLoader* URLLoader::GetInterface() {
return &ppb_urlloader;
}
// static
-const PPB_URLLoaderTrusted_Dev* URLLoader::GetTrustedInterface() {
+const PPB_URLLoaderTrusted* URLLoader::GetTrustedInterface() {
return &ppb_urlloadertrusted;
}
@@ -250,8 +248,6 @@ int32_t URLLoader::Open(URLRequestInfo* request,
request_info_ = scoped_refptr<URLRequestInfo>(request);
pending_callback_ = callback;
- record_download_progress_ = request->record_download_progress();
- record_upload_progress_ = request->record_upload_progress();
// Notify completion when we receive a redirect or response headers.
return PP_ERROR_WOULDBLOCK;
@@ -278,7 +274,7 @@ int32_t URLLoader::FollowRedirect(PP_CompletionCallback callback) {
bool URLLoader::GetUploadProgress(int64_t* bytes_sent,
int64_t* total_bytes_to_be_sent) {
- if (!record_upload_progress_) {
+ if (!RecordUploadProgress()) {
*bytes_sent = 0;
*total_bytes_to_be_sent = 0;
return false;
@@ -290,7 +286,7 @@ bool URLLoader::GetUploadProgress(int64_t* bytes_sent,
bool URLLoader::GetDownloadProgress(int64_t* bytes_received,
int64_t* total_bytes_to_be_received) {
- if (!record_download_progress_) {
+ if (!RecordDownloadProgress()) {
*bytes_received = 0;
*total_bytes_to_be_received = 0;
return false;
@@ -503,7 +499,7 @@ int32_t URLLoader::CanRequest(const WebKit::WebFrame* frame,
void URLLoader::UpdateStatus() {
if (status_callback_ &&
- (record_download_progress_ || record_upload_progress_)) {
+ (RecordDownloadProgress() || RecordUploadProgress())) {
PP_Resource pp_resource = GetReferenceNoAddRef();
if (pp_resource) {
// The PP_Resource on the plugin will be NULL if the plugin has no
@@ -517,12 +513,20 @@ void URLLoader::UpdateStatus() {
// flag.
status_callback_(
instance_->pp_instance(), pp_resource,
- record_upload_progress_ ? bytes_sent_ : -1,
- record_upload_progress_ ? total_bytes_to_be_sent_ : -1,
- record_download_progress_ ? bytes_received_ : -1,
- record_download_progress_ ? total_bytes_to_be_received_ : -1);
+ RecordUploadProgress() ? bytes_sent_ : -1,
+ RecordUploadProgress() ? total_bytes_to_be_sent_ : -1,
+ RecordDownloadProgress() ? bytes_received_ : -1,
+ RecordDownloadProgress() ? total_bytes_to_be_received_ : -1);
}
}
}
+bool URLLoader::RecordDownloadProgress() const {
+ return request_info_ && request_info_->record_download_progress();
+}
+
+bool URLLoader::RecordUploadProgress() const {
+ return request_info_ && request_info_->record_upload_progress();
+}
+
} // namespace pepper
diff --git a/webkit/glue/plugins/pepper_url_loader.h b/webkit/glue/plugins/pepper_url_loader.h
index dd91708..ee8ddd7 100644
--- a/webkit/glue/plugins/pepper_url_loader.h
+++ b/webkit/glue/plugins/pepper_url_loader.h
@@ -9,13 +9,13 @@
#include "base/scoped_ptr.h"
#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/dev/ppb_url_loader_trusted_dev.h"
+#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h"
#include "webkit/glue/plugins/pepper_plugin_instance.h"
#include "webkit/glue/plugins/pepper_resource.h"
-struct PPB_URLLoader_Dev;
-struct PPB_URLLoaderTrusted_Dev;
+struct PPB_URLLoader;
+struct PPB_URLLoaderTrusted;
namespace WebKit {
class WebFrame;
@@ -37,11 +37,11 @@ class URLLoader : public Resource,
// Returns a pointer to the interface implementing PPB_URLLoader that is
// exposed to the plugin.
- static const PPB_URLLoader_Dev* GetInterface();
+ static const PPB_URLLoader* GetInterface();
// Returns a pointer to the interface implementing PPB_URLLoaderTrusted that
// is exposed to the plugin.
- static const PPB_URLLoaderTrusted_Dev* GetTrustedInterface();
+ static const PPB_URLLoaderTrusted* GetTrustedInterface();
// Resource overrides.
URLLoader* AsURLLoader() { return this; }
@@ -100,6 +100,14 @@ class URLLoader : public Resource,
// synchronize an out-of-process plugin's state.
void UpdateStatus();
+ // Returns true if the plugin has requested we record download or upload
+ // progress. When false, we don't need to update the counters. We go out of
+ // our way not to allow access to this information unless it's requested,
+ // even when it would be easier just to return it and not check, so that
+ // plugins don't depend on access without setting the flag.
+ bool RecordDownloadProgress() const;
+ bool RecordUploadProgress() const;
+
// This will be NULL if the instance has been deleted but this URLLoader was
// somehow leaked. In general, you should not need to check this for NULL.
// However, if you see a NULL pointer crash, that means somebody is holding
@@ -122,9 +130,6 @@ class URLLoader : public Resource,
size_t user_buffer_size_;
int32_t done_status_;
- bool record_download_progress_;
- bool record_upload_progress_;
-
bool has_universal_access_;
PP_URLLoaderTrusted_StatusCallback status_callback_;
diff --git a/webkit/glue/plugins/pepper_url_request_info.cc b/webkit/glue/plugins/pepper_url_request_info.cc
index ae0c280..f606509 100644
--- a/webkit/glue/plugins/pepper_url_request_info.cc
+++ b/webkit/glue/plugins/pepper_url_request_info.cc
@@ -62,7 +62,7 @@ PP_Bool IsURLRequestInfo(PP_Resource resource) {
}
PP_Bool SetProperty(PP_Resource request_id,
- PP_URLRequestProperty_Dev property,
+ PP_URLRequestProperty property,
PP_Var var) {
scoped_refptr<URLRequestInfo> request(
Resource::GetAs<URLRequestInfo>(request_id));
@@ -117,7 +117,7 @@ PP_Bool AppendFileToBody(PP_Resource request_id,
expected_last_modified_time));
}
-const PPB_URLRequestInfo_Dev ppb_urlrequestinfo = {
+const PPB_URLRequestInfo ppb_urlrequestinfo = {
&Create,
&IsURLRequestInfo,
&SetProperty,
@@ -164,11 +164,11 @@ URLRequestInfo::~URLRequestInfo() {
}
// static
-const PPB_URLRequestInfo_Dev* URLRequestInfo::GetInterface() {
+const PPB_URLRequestInfo* URLRequestInfo::GetInterface() {
return &ppb_urlrequestinfo;
}
-bool URLRequestInfo::SetBooleanProperty(PP_URLRequestProperty_Dev property,
+bool URLRequestInfo::SetBooleanProperty(PP_URLRequestProperty property,
bool value) {
switch (property) {
case PP_URLREQUESTPROPERTY_STREAMTOFILE:
@@ -189,7 +189,7 @@ bool URLRequestInfo::SetBooleanProperty(PP_URLRequestProperty_Dev property,
}
}
-bool URLRequestInfo::SetStringProperty(PP_URLRequestProperty_Dev property,
+bool URLRequestInfo::SetStringProperty(PP_URLRequestProperty property,
const std::string& value) {
// TODO(darin): Validate input. Perhaps at a different layer?
switch (property) {
diff --git a/webkit/glue/plugins/pepper_url_request_info.h b/webkit/glue/plugins/pepper_url_request_info.h
index 4fd4e26..7aa9fc1 100644
--- a/webkit/glue/plugins/pepper_url_request_info.h
+++ b/webkit/glue/plugins/pepper_url_request_info.h
@@ -9,7 +9,7 @@
#include <vector>
#include "base/ref_counted.h"
-#include "ppapi/c/dev/ppb_url_request_info_dev.h"
+#include "ppapi/c/ppb_url_request_info.h"
#include "webkit/glue/plugins/pepper_file_ref.h"
#include "webkit/glue/plugins/pepper_resource.h"
@@ -27,14 +27,14 @@ class URLRequestInfo : public Resource {
// Returns a pointer to the interface implementing PPB_URLRequestInfo that is
// exposed to the plugin.
- static const PPB_URLRequestInfo_Dev* GetInterface();
+ static const PPB_URLRequestInfo* GetInterface();
// Resource overrides.
URLRequestInfo* AsURLRequestInfo() { return this; }
// PPB_URLRequestInfo implementation.
- bool SetBooleanProperty(PP_URLRequestProperty_Dev property, bool value);
- bool SetStringProperty(PP_URLRequestProperty_Dev property,
+ bool SetBooleanProperty(PP_URLRequestProperty property, bool value);
+ bool SetStringProperty(PP_URLRequestProperty property,
const std::string& value);
bool AppendDataToBody(const std::string& data);
bool AppendFileToBody(FileRef* file_ref,
diff --git a/webkit/glue/plugins/pepper_url_response_info.cc b/webkit/glue/plugins/pepper_url_response_info.cc
index 2e7202f..5ae484f 100644
--- a/webkit/glue/plugins/pepper_url_response_info.cc
+++ b/webkit/glue/plugins/pepper_url_response_info.cc
@@ -44,7 +44,7 @@ PP_Bool IsURLResponseInfo(PP_Resource resource) {
}
PP_Var GetProperty(PP_Resource response_id,
- PP_URLResponseProperty_Dev property) {
+ PP_URLResponseProperty property) {
scoped_refptr<URLResponseInfo> response(
Resource::GetAs<URLResponseInfo>(response_id));
if (!response)
@@ -67,7 +67,7 @@ PP_Resource GetBody(PP_Resource response_id) {
return body->GetReference();
}
-const PPB_URLResponseInfo_Dev ppb_urlresponseinfo = {
+const PPB_URLResponseInfo ppb_urlresponseinfo = {
&IsURLResponseInfo,
&GetProperty,
&GetBody
@@ -88,11 +88,11 @@ URLResponseInfo::~URLResponseInfo() {
}
// static
-const PPB_URLResponseInfo_Dev* URLResponseInfo::GetInterface() {
+const PPB_URLResponseInfo* URLResponseInfo::GetInterface() {
return &ppb_urlresponseinfo;
}
-PP_Var URLResponseInfo::GetProperty(PP_URLResponseProperty_Dev property) {
+PP_Var URLResponseInfo::GetProperty(PP_URLResponseProperty property) {
switch (property) {
case PP_URLRESPONSEPROPERTY_URL:
return StringVar::StringToPPVar(module(), url_);
diff --git a/webkit/glue/plugins/pepper_url_response_info.h b/webkit/glue/plugins/pepper_url_response_info.h
index ff3a832..adbf8ef 100644
--- a/webkit/glue/plugins/pepper_url_response_info.h
+++ b/webkit/glue/plugins/pepper_url_response_info.h
@@ -7,7 +7,7 @@
#include <string>
-#include "ppapi/c/dev/ppb_url_response_info_dev.h"
+#include "ppapi/c/ppb_url_response_info.h"
#include "webkit/glue/plugins/pepper_resource.h"
namespace WebKit {
@@ -23,13 +23,13 @@ class URLResponseInfo : public Resource {
// Returns a pointer to the interface implementing PPB_URLResponseInfo that
// is exposed to the plugin.
- static const PPB_URLResponseInfo_Dev* GetInterface();
+ static const PPB_URLResponseInfo* GetInterface();
// Resource overrides.
URLResponseInfo* AsURLResponseInfo() { return this; }
// PPB_URLResponseInfo implementation.
- PP_Var GetProperty(PP_URLResponseProperty_Dev property);
+ PP_Var GetProperty(PP_URLResponseProperty property);
bool Initialize(const WebKit::WebURLResponse& response);
diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc
index 7cf93ed..4cee55d 100644
--- a/webkit/glue/plugins/plugin_host.cc
+++ b/webkit/glue/plugins/plugin_host.cc
@@ -134,6 +134,10 @@ void PluginHost::InitializeHostFuncs() {
host_funcs_.unscheduletimer = NPN_UnscheduleTimer;
host_funcs_.popupcontextmenu = NPN_PopUpContextMenu;
host_funcs_.convertpoint = NPN_ConvertPoint;
+ host_funcs_.handleevent = NPN_HandleEvent;
+ host_funcs_.unfocusinstance = NPN_UnfocusInstance;
+ // TODO: Implement redirect handling: http://crbug.com/63030
+ host_funcs_.urlredirectresponse = NULL;
}
void PluginHost::PatchNPNetscapeFuncs(NPNetscapeFuncs* overrides) {
@@ -1086,4 +1090,17 @@ NPBool NPN_ConvertPoint(NPP id, double sourceX, double sourceY,
return false;
}
+NPBool NPN_HandleEvent(NPP id, void *event, NPBool handled) {
+ // TODO: Implement advanced key handling: http://crbug.com/46578
+ NOTIMPLEMENTED();
+ return false;
+}
+
+NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) {
+ // TODO: Implement advanced key handling: http://crbug.com/46578
+ NOTIMPLEMENTED();
+ return false;
+}
+
+
} // extern "C"
diff --git a/webkit/glue/plugins/plugin_lib.cc b/webkit/glue/plugins/plugin_lib.cc
index ee613c1..292cd63 100644
--- a/webkit/glue/plugins/plugin_lib.cc
+++ b/webkit/glue/plugins/plugin_lib.cc
@@ -235,25 +235,41 @@ bool PluginLib::Load() {
// This class implements delayed NP_Shutdown and FreeLibrary on the plugin dll.
class FreePluginLibraryTask : public Task {
public:
- FreePluginLibraryTask(base::NativeLibrary library,
+ FreePluginLibraryTask(const FilePath& path,
+ base::NativeLibrary library,
NP_ShutdownFunc shutdown_func)
- : library_(library),
+ : path_(path),
+ library_(library),
NP_Shutdown_(shutdown_func) {
}
~FreePluginLibraryTask() {}
void Run() {
- if (NP_Shutdown_)
- NP_Shutdown_();
+ if (NP_Shutdown_) {
+ // Don't call NP_Shutdown if the library has been reloaded since this task
+ // was posted.
+ bool reloaded = false;
+ if (g_loaded_libs) {
+ for (size_t i = 0; i < g_loaded_libs->size(); ++i) {
+ if ((*g_loaded_libs)[i]->plugin_info().path == path_)
+ reloaded = true;
+ }
+ }
+ if (!reloaded)
+ NP_Shutdown_();
+ }
if (library_) {
+ // Always call base::UnloadNativeLibrary so that the system reference
+ // count is decremented.
base::UnloadNativeLibrary(library_);
library_ = NULL;
}
}
private:
+ FilePath path_;
base::NativeLibrary library_;
NP_ShutdownFunc NP_Shutdown_;
DISALLOW_COPY_AND_ASSIGN(FreePluginLibraryTask);
@@ -277,7 +293,8 @@ void PluginLib::Unload() {
if (defer_unload) {
FreePluginLibraryTask* free_library_task =
- new FreePluginLibraryTask(skip_unload_ ? NULL : library_,
+ new FreePluginLibraryTask(web_plugin_info_.path,
+ skip_unload_ ? NULL : library_,
entry_points_.np_shutdown);
LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Scheduling delayed unload for plugin "
diff --git a/webkit/glue/plugins/plugin_list.cc b/webkit/glue/plugins/plugin_list.cc
index 4b3ce27..84736cb 100644
--- a/webkit/glue/plugins/plugin_list.cc
+++ b/webkit/glue/plugins/plugin_list.cc
@@ -24,19 +24,12 @@ namespace NPAPI {
base::LazyInstance<PluginList> g_singleton(base::LINKER_INITIALIZED);
-static LoadPluginsFromDiskHookFunc g_load_plugins_hook;
-
// static
PluginList* PluginList::Singleton() {
return g_singleton.Pointer();
}
// static
-void PluginList::SetPluginLoadHook(LoadPluginsFromDiskHookFunc hook) {
- g_load_plugins_hook = hook;
-}
-
-// static
bool PluginList::DebugPluginLoading() {
return CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDebugPluginLoading);
@@ -196,9 +189,6 @@ void PluginList::LoadPlugins(bool refresh) {
internal_plugins = internal_plugins_;
}
- if (g_load_plugins_hook)
- g_load_plugins_hook();
-
std::vector<WebPluginInfo> new_plugins;
std::set<FilePath> visited_plugins;
diff --git a/webkit/glue/plugins/plugin_list.h b/webkit/glue/plugins/plugin_list.h
index 25b903b..101e6b7 100644
--- a/webkit/glue/plugins/plugin_list.h
+++ b/webkit/glue/plugins/plugin_list.h
@@ -63,8 +63,6 @@ struct PluginVersionInfo {
PluginEntryPoints entry_points;
};
-typedef void (*LoadPluginsFromDiskHookFunc)();
-
// The PluginList is responsible for loading our NPAPI based plugins. It does
// so in whatever manner is appropriate for the platform. On Windows, it loads
// plugins from a known directory by looking for DLLs which start with "NP",
@@ -78,9 +76,6 @@ class PluginList {
// Gets the one instance of the PluginList.
static PluginList* Singleton();
- // Set a hook that is called whenever we load plugins from the disk.
- static void SetPluginLoadHook(LoadPluginsFromDiskHookFunc hook);
-
// Returns true if we're in debug-plugin-loading mode. This is controlled
// by a command line switch.
static bool DebugPluginLoading();
diff --git a/webkit/glue/plugins/plugin_list_posix.cc b/webkit/glue/plugins/plugin_list_posix.cc
index 682381c..654c0c5 100644
--- a/webkit/glue/plugins/plugin_list_posix.cc
+++ b/webkit/glue/plugins/plugin_list_posix.cc
@@ -55,7 +55,7 @@ bool IsBlacklistedBySha1sum(const FilePath& path) {
std::string sha1 = base::SHA1HashString(file_content);
std::string sha1_readable;
for (size_t j = 0; j < sha1.size(); j++)
- StringAppendF(&sha1_readable, "%02x", sha1[j] & 0xFF);
+ base::StringAppendF(&sha1_readable, "%02x", sha1[j] & 0xFF);
if (bad_entries[i].sha1 == sha1_readable)
return true;
}