summaryrefslogtreecommitdiffstats
path: root/webkit/glue/plugins
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-01 01:48:52 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-01 01:48:52 +0000
commit829c2841a0e30b9f08453566ffc52d2c386a9045 (patch)
treeb916ff2699e97a13f027d3e2cb60be781c0e18c8 /webkit/glue/plugins
parent5c0b8e45fa1260f311d71073c8a9b89db199d992 (diff)
downloadchromium_src-829c2841a0e30b9f08453566ffc52d2c386a9045.zip
chromium_src-829c2841a0e30b9f08453566ffc52d2c386a9045.tar.gz
chromium_src-829c2841a0e30b9f08453566ffc52d2c386a9045.tar.bz2
Port plugin messages.
Review URL: http://codereview.chromium.org/49050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12928 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins')
-rw-r--r--webkit/glue/plugins/plugin_host.cc27
-rw-r--r--webkit/glue/plugins/plugin_instance.cc11
-rw-r--r--webkit/glue/plugins/plugin_instance.h7
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl.cc29
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl.h8
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl_gtk.cc16
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl_mac.cc16
7 files changed, 50 insertions, 64 deletions
diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc
index b0c199a..b87160a 100644
--- a/webkit/glue/plugins/plugin_host.cc
+++ b/webkit/glue/plugins/plugin_host.cc
@@ -340,16 +340,10 @@ static NPError GetURLNotify(NPP id,
scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id);
if (plugin.get()) {
- plugin->webplugin()->HandleURLRequest("GET",
- is_javascript_url,
- target,
- 0,
- 0,
- false,
- notify,
- url,
- notify_data,
- plugin->popups_allowed());
+ plugin->webplugin()->HandleURLRequest(
+ "GET", is_javascript_url, target, 0, 0, false,
+ notify, url, reinterpret_cast<intptr_t>(notify_data),
+ plugin->popups_allowed());
} else {
NOTREACHED();
return NPERR_GENERIC_ERROR;
@@ -485,16 +479,9 @@ static NPError PostURLNotify(NPP id,
// Unfortunately, our stream needs these broken apart,
// so we need to parse the data and set headers and data
// separately.
- plugin->webplugin()->HandleURLRequest("POST",
- is_javascript_url,
- target,
- len,
- buf,
- false,
- notify,
- url,
- notify_data,
- plugin->popups_allowed());
+ plugin->webplugin()->HandleURLRequest(
+ "POST", is_javascript_url, target, len, buf, false, notify, url,
+ reinterpret_cast<intptr_t>(notify_data), plugin->popups_allowed());
return NPERR_NO_ERROR;
}
diff --git a/webkit/glue/plugins/plugin_instance.cc b/webkit/glue/plugins/plugin_instance.cc
index 6738435..f8c1814 100644
--- a/webkit/glue/plugins/plugin_instance.cc
+++ b/webkit/glue/plugins/plugin_instance.cc
@@ -167,7 +167,7 @@ NPObject *PluginInstance::GetPluginScriptableObject() {
}
void PluginInstance::SetURLLoadData(const GURL& url,
- void* notify_data) {
+ intptr_t notify_data) {
get_url_ = url;
get_notify_data_ = notify_data;
}
@@ -175,7 +175,8 @@ void PluginInstance::SetURLLoadData(const GURL& url,
// WebPluginLoadDelegate methods
void PluginInstance::DidFinishLoadWithReason(NPReason reason) {
if (!get_url_.is_empty()) {
- NPP_URLNotify(get_url_.spec().c_str(), reason, get_notify_data_);
+ NPP_URLNotify(get_url_.spec().c_str(), reason,
+ reinterpret_cast<void*>(get_notify_data_));
}
get_url_ = GURL();
@@ -351,7 +352,7 @@ void PluginInstance::SendJavaScriptStream(const std::string& url,
const std::wstring& result,
bool success,
bool notify_needed,
- int notify_data) {
+ intptr_t notify_data) {
if (success) {
PluginStringStream *stream =
new PluginStringStream(this, url, notify_needed,
@@ -505,9 +506,9 @@ void PluginInstance::RequestRead(NPStream* stream, NPByteRange* range_list) {
webplugin_->InitiateHTTPRangeRequest(
stream->url, range_info.c_str(),
- plugin_stream,
+ reinterpret_cast<intptr_t>(plugin_stream),
plugin_stream->notify_needed(),
- plugin_stream->notify_data());
+ reinterpret_cast<intptr_t>(plugin_stream->notify_data()));
break;
}
}
diff --git a/webkit/glue/plugins/plugin_instance.h b/webkit/glue/plugins/plugin_instance.h
index e973717..2c3bb49 100644
--- a/webkit/glue/plugins/plugin_instance.h
+++ b/webkit/glue/plugins/plugin_instance.h
@@ -138,7 +138,7 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> {
// Helper method to set some persistent data for getURLNotify since
// resource fetches happen async.
- void SetURLLoadData(const GURL& url, void* notify_data);
+ void SetURLLoadData(const GURL& url, intptr_t notify_data);
// If true, send the Mozilla user agent instead of Chrome's to the plugin.
bool use_mozilla_user_agent() { return use_mozilla_user_agent_; }
@@ -166,7 +166,8 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> {
bool NPP_Print(NPPrint* platform_print);
void SendJavaScriptStream(const std::string& url, const std::wstring& result,
- bool success, bool notify_needed, int notify_data);
+ bool success, bool notify_needed,
+ intptr_t notify_data);
void DidReceiveManualResponse(const std::string& url,
const std::string& mime_type,
@@ -231,7 +232,7 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> {
WebPlugin* webplugin_;
std::string mime_type_;
GURL get_url_;
- void* get_notify_data_;
+ intptr_t get_notify_data_;
bool use_mozilla_user_agent_;
#if defined(OS_WIN)
scoped_refptr<MozillaExtensionApi> mozilla_extenstions_;
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc
index 3d18525..87d02cb 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl.cc
+++ b/webkit/glue/plugins/webplugin_delegate_impl.cc
@@ -253,6 +253,13 @@ bool WebPluginDelegateImpl::Initialize(const GURL& url,
return false;
windowless_ = instance_->windowless();
+ if (!windowless_) {
+ if (!WindowedCreatePlugin())
+ return false;
+ }
+
+ windowed_manage_position_ = plugin->SetWindow(windowed_handle_);
+#if defined(OS_WIN)
if (windowless_) {
// For windowless plugins we should set the containing window handle
// as the instance window handle. This is what Safari does. Not having
@@ -262,13 +269,9 @@ bool WebPluginDelegateImpl::Initialize(const GURL& url,
instance_->set_window_handle(parent_);
CreateDummyWindowForActivation();
handle_event_pump_messages_event_ = CreateEvent(NULL, TRUE, FALSE, NULL);
- } else {
- if (!WindowedCreatePlugin())
- return false;
+ plugin->SetWindowlessPumpEvent(handle_event_pump_messages_event_);
}
-
- windowed_manage_position_ =
- plugin->SetWindow(windowed_handle_, handle_event_pump_messages_event_);
+#endif
plugin_url_ = url.spec();
// The windowless version of the Silverlight plugin calls the
@@ -382,7 +385,7 @@ void WebPluginDelegateImpl::SendJavaScriptStream(const std::string& url,
const std::wstring& result,
bool success,
bool notify_needed,
- int notify_data) {
+ intptr_t notify_data) {
instance()->SendJavaScriptStream(url, result, success, notify_needed,
notify_data);
}
@@ -1090,7 +1093,7 @@ bool WebPluginDelegateImpl::HandleEvent(NPEvent* event,
WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient(
int resource_id, const std::string &url, bool notify_needed,
- void *notify_data, void* existing_stream) {
+ intptr_t notify_data, intptr_t existing_stream) {
// Stream already exists. This typically happens for range requests
// initiated via NPN_RequestRead.
if (existing_stream) {
@@ -1106,17 +1109,15 @@ WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient(
instance()->SetURLLoadData(GURL(url.c_str()), notify_data);
}
std::string mime_type;
- NPAPI::PluginStreamUrl *stream = instance()->CreateStream(resource_id,
- url,
- mime_type,
- notify_needed,
- notify_data);
+ NPAPI::PluginStreamUrl *stream = instance()->CreateStream(
+ resource_id, url, mime_type, notify_needed,
+ reinterpret_cast<void*>(notify_data));
return stream;
}
void WebPluginDelegateImpl::URLRequestRouted(const std::string&url,
bool notify_needed,
- void* notify_data) {
+ intptr_t notify_data) {
if (notify_needed) {
instance()->SetURLLoadData(GURL(url.c_str()), notify_data);
}
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h
index 74b0e13..a429e63 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl.h
+++ b/webkit/glue/plugins/webplugin_delegate_impl.h
@@ -65,7 +65,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate {
virtual void SendJavaScriptStream(const std::string& url,
const std::wstring& result,
bool success, bool notify_needed,
- int notify_data);
+ intptr_t notify_data);
virtual void DidReceiveManualResponse(const std::string& url,
const std::string& mime_type,
const std::string& headers,
@@ -79,11 +79,11 @@ class WebPluginDelegateImpl : public WebPluginDelegate {
virtual WebPluginResourceClient* CreateResourceClient(int resource_id,
const std::string &url,
bool notify_needed,
- void *notify_data,
- void* stream);
+ intptr_t notify_data,
+ intptr_t stream);
virtual void URLRequestRouted(const std::string&url, bool notify_needed,
- void* notify_data);
+ intptr_t notify_data);
virtual bool IsWindowless() const { return windowless_ ; }
virtual const gfx::Rect& GetRect() const { return window_rect_; }
virtual const gfx::Rect& GetClipRect() const { return clip_rect_; }
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
index c77b61b..8d20186 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
+++ b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
@@ -128,7 +128,7 @@ bool WebPluginDelegateImpl::Initialize(const GURL& url,
return false;
}
- plugin->SetWindow(windowed_handle_, /* unused event param */ NULL);
+ plugin->SetWindow(windowed_handle_);
plugin_url_ = url.spec();
return true;
@@ -197,7 +197,7 @@ void WebPluginDelegateImpl::SendJavaScriptStream(const std::string& url,
const std::wstring& result,
bool success,
bool notify_needed,
- int notify_data) {
+ intptr_t notify_data) {
instance()->SendJavaScriptStream(url, result, success, notify_needed,
notify_data);
}
@@ -653,7 +653,7 @@ bool WebPluginDelegateImpl::HandleEvent(NPEvent* event,
WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient(
int resource_id, const std::string &url, bool notify_needed,
- void *notify_data, void* existing_stream) {
+ intptr_t notify_data, intptr_t existing_stream) {
// Stream already exists. This typically happens for range requests
// initiated via NPN_RequestRead.
if (existing_stream) {
@@ -669,17 +669,15 @@ WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient(
instance()->SetURLLoadData(GURL(url.c_str()), notify_data);
}
std::string mime_type;
- NPAPI::PluginStreamUrl *stream = instance()->CreateStream(resource_id,
- url,
- mime_type,
- notify_needed,
- notify_data);
+ NPAPI::PluginStreamUrl *stream = instance()->CreateStream(
+ resource_id, url, mime_type, notify_needed,
+ reinterpret_cast<void*>(notify_data));
return stream;
}
void WebPluginDelegateImpl::URLRequestRouted(const std::string&url,
bool notify_needed,
- void* notify_data) {
+ intptr_t notify_data) {
if (notify_needed) {
instance()->SetURLLoadData(GURL(url.c_str()), notify_data);
}
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.cc b/webkit/glue/plugins/webplugin_delegate_impl_mac.cc
index 7c806dc..f758ce0 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl_mac.cc
+++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.cc
@@ -154,7 +154,7 @@ bool WebPluginDelegateImpl::Initialize(const GURL& url,
return false;
}
- // plugin->SetWindow(windowed_handle_, handle_event_pump_messages_event_);
+ // plugin->SetWindow(windowed_handle_);
plugin_url_ = url.spec();
return true;
@@ -223,7 +223,7 @@ void WebPluginDelegateImpl::SendJavaScriptStream(const std::string& url,
const std::wstring& result,
bool success,
bool notify_needed,
- int notify_data) {
+ intptr_t notify_data) {
instance()->SendJavaScriptStream(url, result, success, notify_needed,
notify_data);
}
@@ -423,7 +423,7 @@ bool WebPluginDelegateImpl::HandleEvent(NPEvent* event,
WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient(
int resource_id, const std::string &url, bool notify_needed,
- void *notify_data, void* existing_stream) {
+ intptr_t notify_data, intptr_t existing_stream) {
// Stream already exists. This typically happens for range requests
// initiated via NPN_RequestRead.
if (existing_stream) {
@@ -439,17 +439,15 @@ WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient(
instance()->SetURLLoadData(GURL(url.c_str()), notify_data);
}
std::string mime_type;
- NPAPI::PluginStreamUrl *stream = instance()->CreateStream(resource_id,
- url,
- mime_type,
- notify_needed,
- notify_data);
+ NPAPI::PluginStreamUrl *stream = instance()->CreateStream(
+ resource_id, url, mime_type, notify_needed,
+ reinterpret_cast<void*>(notify_data));
return stream;
}
void WebPluginDelegateImpl::URLRequestRouted(const std::string&url,
bool notify_needed,
- void* notify_data) {
+ intptr_t notify_data) {
if (notify_needed) {
instance()->SetURLLoadData(GURL(url.c_str()), notify_data);
}