diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-31 22:35:13 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-31 22:35:13 +0000 |
commit | 208d3b7d52b46f9a641d432433dc59894878880d (patch) | |
tree | db72721b64e095787c06631ba468f71b158e1649 /content | |
parent | 32d2669f5b705998451d1106f6072aaf7b38d30e (diff) | |
download | chromium_src-208d3b7d52b46f9a641d432433dc59894878880d.zip chromium_src-208d3b7d52b46f9a641d432433dc59894878880d.tar.gz chromium_src-208d3b7d52b46f9a641d432433dc59894878880d.tar.bz2 |
Moved the following IPC messages used by the chrome NPAPI plugin installer out of content
into Chrome.
1. PluginProcessHostMsg_GetPluginFinderUrl
2. PluginProcessHostMsg_MissingPluginStatus
3. PluginProcessHostMsg_DownloadUrl
These messages are prefixed with Chrome. Removed the InstallMissingPlugin and OnInstallMissingPlugin
handlers from the NPAPI plugin sources and from our webkit plugin implementation. The plugin infobar
no longer sends over an IPC message to initiate installation of the third party plugin. It sends over
a windows message which is handled in the plugin installer for Windows. This functionality is not
implemented for the mac and linux as before.
To display the plugin installation infobar the PluginProcessHostMsg_MissingPluginStatus message
sent by the plugin needs the routing id and the renderer process id. This information is now
passed along with the plugin instantiation parameters in NPP_New. These parameters are only read
by the default plugin.
This is a continuation of the fixes to ensure that IPC's don't span across content and chrome.
BUG=87335
Review URL: http://codereview.chromium.org/7812020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99062 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/common/content_constants.cc | 3 | ||||
-rw-r--r-- | content/common/content_constants.h | 5 | ||||
-rw-r--r-- | content/common/plugin_messages.h | 12 | ||||
-rw-r--r-- | content/common/view_messages.h | 7 | ||||
-rw-r--r-- | content/plugin/webplugin_delegate_stub.cc | 24 | ||||
-rw-r--r-- | content/plugin/webplugin_delegate_stub.h | 1 | ||||
-rw-r--r-- | content/plugin/webplugin_proxy.cc | 4 | ||||
-rw-r--r-- | content/plugin/webplugin_proxy.h | 1 | ||||
-rw-r--r-- | content/renderer/render_view.cc | 36 | ||||
-rw-r--r-- | content/renderer/render_view.h | 10 | ||||
-rw-r--r-- | content/renderer/webplugin_delegate_proxy.cc | 11 | ||||
-rw-r--r-- | content/renderer/webplugin_delegate_proxy.h | 2 |
12 files changed, 25 insertions, 91 deletions
diff --git a/content/common/content_constants.cc b/content/common/content_constants.cc index 3118867..6835362 100644 --- a/content/common/content_constants.cc +++ b/content/common/content_constants.cc @@ -13,6 +13,9 @@ const size_t kMaxTitleChars = 4 * 1024; const size_t kMaxURLChars = 2 * 1024 * 1024; const size_t kMaxURLDisplayChars = 32 * 1024; +const char kDefaultPluginRenderViewId[] = "PluginRenderViewId"; +const char kDefaultPluginRenderProcessId[] = "PluginRenderProcessId"; + } // namespace content #undef FPL diff --git a/content/common/content_constants.h b/content/common/content_constants.h index b34f4bf..1c8b680 100644 --- a/content/common/content_constants.h +++ b/content/common/content_constants.h @@ -30,6 +30,11 @@ extern const size_t kMaxTitleChars; extern const size_t kMaxURLChars; extern const size_t kMaxURLDisplayChars; +// The render view and render process id associated with the default plugin +// instance. +extern const char kDefaultPluginRenderViewId[]; +extern const char kDefaultPluginRenderProcessId[]; + } // namespace content #endif // CONTENT_COMMON_CHROME_CONSTANTS_H_ diff --git a/content/common/plugin_messages.h b/content/common/plugin_messages.h index dd65ce9..c3c7ed1 100644 --- a/content/common/plugin_messages.h +++ b/content/common/plugin_messages.h @@ -83,19 +83,12 @@ IPC_MESSAGE_CONTROL0(PluginProcessMsg_NotifyRenderersOfPendingShutdown) IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_ChannelCreated, IPC::ChannelHandle /* channel_handle */) -IPC_SYNC_MESSAGE_CONTROL0_1(PluginProcessHostMsg_GetPluginFinderUrl, - std::string /* plugin finder URL */) - #if defined(OS_WIN) // Destroys the given window's parent on the UI thread. IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginWindowDestroyed, HWND /* window */, HWND /* parent */) -IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_DownloadUrl, - std::string /* URL */, - HWND /* caller window */) - IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_ReparentPluginWindow, HWND /* window */, HWND /* parent */) @@ -261,8 +254,6 @@ IPC_MESSAGE_ROUTED0(PluginMsg_DidFinishManualLoading) IPC_MESSAGE_ROUTED0(PluginMsg_DidManualLoadFail) -IPC_MESSAGE_ROUTED0(PluginMsg_InstallMissingPlugin) - IPC_MESSAGE_ROUTED3(PluginMsg_HandleURLRequestReply, unsigned long /* resource_id */, GURL /* url */, @@ -344,9 +335,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_GetCookies, GURL /* first_party_for_cookies */, std::string /* cookies */) -IPC_MESSAGE_ROUTED1(PluginHostMsg_MissingPluginStatus, - int /* status */) - IPC_MESSAGE_ROUTED0(PluginHostMsg_CancelDocumentLoad) IPC_MESSAGE_ROUTED3(PluginHostMsg_InitiateHTTPRangeRequest, diff --git a/content/common/view_messages.h b/content/common/view_messages.h index a91a857..47ecf7d 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -1226,9 +1226,6 @@ IPC_MESSAGE_ROUTED3(ViewMsg_PpapiBrokerChannelCreated, IPC_MESSAGE_CONTROL1(ViewMsg_PurgePluginListCache, bool /* reload_pages */) -// Install the first missing pluign. -IPC_MESSAGE_ROUTED0(ViewMsg_InstallMissingPlugin) - // Sent to the renderer when a popup window should no longer count against // the current popup count (either because it's not a popup or because it was // a generated by a user action or because a constrained popup got turned @@ -2032,10 +2029,6 @@ IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateContentRestrictions, IPC_MESSAGE_ROUTED1(ViewHostMsg_SaveURLAs, GURL /* url */) -// Notifies when default plugin updates status of the missing plugin. -IPC_MESSAGE_ROUTED1(ViewHostMsg_MissingPluginStatus, - int /* status */) - // Displays a JavaScript out-of-memory message in the infobar. IPC_MESSAGE_ROUTED0(ViewHostMsg_JSOutOfMemory) diff --git a/content/plugin/webplugin_delegate_stub.cc b/content/plugin/webplugin_delegate_stub.cc index 87e8fda..824cd47 100644 --- a/content/plugin/webplugin_delegate_stub.cc +++ b/content/plugin/webplugin_delegate_stub.cc @@ -7,7 +7,9 @@ #include "build/build_config.h" #include "base/command_line.h" +#include "base/string_number_conversions.h" #include "content/common/content_client.h" +#include "content/common/content_constants.h" #include "content/common/content_switches.h" #include "content/common/plugin_messages.h" #include "content/plugin/npobject_stub.h" @@ -122,7 +124,6 @@ bool WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(PluginMsg_DidFinishManualLoading, OnDidFinishManualLoading) IPC_MESSAGE_HANDLER(PluginMsg_DidManualLoadFail, OnDidManualLoadFail) - IPC_MESSAGE_HANDLER(PluginMsg_InstallMissingPlugin, OnInstallMissingPlugin) IPC_MESSAGE_HANDLER(PluginMsg_HandleURLRequestReply, OnHandleURLRequestReply) IPC_MESSAGE_HANDLER(PluginMsg_HTTPRangeRequestReply, @@ -179,9 +180,22 @@ void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params, path, mime_type_, parent); if (delegate_) { webplugin_->set_delegate(delegate_); + std::vector<std::string> arg_names = params.arg_names; + std::vector<std::string> arg_values = params.arg_values; + + if (path.value() == webkit::npapi::kDefaultPluginLibraryName) { + // Add the renderer process id and Render view routing id to the list of + // parameters passed to the plugin. + arg_names.push_back(content::kDefaultPluginRenderViewId); + arg_values.push_back(base::IntToString( + params.host_render_view_routing_id)); + + arg_names.push_back(content::kDefaultPluginRenderProcessId); + arg_values.push_back(base::IntToString(channel_->renderer_id())); + } *result = delegate_->Initialize(params.url, - params.arg_names, - params.arg_values, + arg_names, + arg_values, webplugin_, params.load_manually); } @@ -363,10 +377,6 @@ void WebPluginDelegateStub::OnDidManualLoadFail() { delegate_->DidManualLoadFail(); } -void WebPluginDelegateStub::OnInstallMissingPlugin() { - delegate_->InstallMissingPlugin(); -} - void WebPluginDelegateStub::OnHandleURLRequestReply( unsigned long resource_id, const GURL& url, int notify_id) { WebPluginResourceClient* resource_client = diff --git a/content/plugin/webplugin_delegate_stub.h b/content/plugin/webplugin_delegate_stub.h index 3c4610a..4a12b9a 100644 --- a/content/plugin/webplugin_delegate_stub.h +++ b/content/plugin/webplugin_delegate_stub.h @@ -97,7 +97,6 @@ class WebPluginDelegateStub : public IPC::Channel::Listener, void OnDidReceiveManualData(const std::vector<char>& buffer); void OnDidFinishManualLoading(); void OnDidManualLoadFail(); - void OnInstallMissingPlugin(); void OnHandleURLRequestReply(unsigned long resource_id, const GURL& url, int notify_id); diff --git a/content/plugin/webplugin_proxy.cc b/content/plugin/webplugin_proxy.cc index df76e8e..c01bc55 100644 --- a/content/plugin/webplugin_proxy.cc +++ b/content/plugin/webplugin_proxy.cc @@ -260,10 +260,6 @@ std::string WebPluginProxy::GetCookies(const GURL& url, return cookies; } -void WebPluginProxy::OnMissingPluginStatus(int status) { - Send(new PluginHostMsg_MissingPluginStatus(route_id_, status)); -} - WebPluginResourceClient* WebPluginProxy::GetResourceClient(int id) { ResourceClientMap::iterator iterator = resource_clients_.find(id); // The IPC messages which deal with streams are now asynchronous. It is diff --git a/content/plugin/webplugin_proxy.h b/content/plugin/webplugin_proxy.h index df1b880..b6e3175 100644 --- a/content/plugin/webplugin_proxy.h +++ b/content/plugin/webplugin_proxy.h @@ -80,7 +80,6 @@ class WebPluginProxy : public webkit::npapi::WebPlugin { virtual std::string GetCookies(const GURL& url, const GURL& first_party_for_cookies); - virtual void OnMissingPluginStatus(int status); // class-specific methods // Returns a WebPluginResourceClient object given its id, or NULL if no diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc index 1b63862..70d8b5f 100644 --- a/content/renderer/render_view.cc +++ b/content/renderer/render_view.cc @@ -651,7 +651,6 @@ bool RenderView::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL) - IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin) IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse, OnEnumerateDirectoryResponse) IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) @@ -1326,32 +1325,6 @@ bool RenderView::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { return Send(message); } -void RenderView::OnMissingPluginStatus( - WebPluginDelegateProxy* delegate, - int status) { -#if defined(OS_WIN) - if (!first_default_plugin_) { - // Show the InfoBar for the first available plugin. - if (status == webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE) { - first_default_plugin_ = delegate->AsWeakPtr(); - Send(new ViewHostMsg_MissingPluginStatus(routing_id_, status)); - } - } else { - // Closes the InfoBar if user clicks on the plugin (instead of the InfoBar) - // to start the download/install. - if (status == - webkit::npapi::default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD) { - Send(new ViewHostMsg_MissingPluginStatus(routing_id_, status)); - } - } -#else - // TODO(port): Implement the infobar that accompanies the default plugin. - // Linux: http://crbug.com/10952 - // Mac: http://crbug.com/17392 - NOTIMPLEMENTED(); -#endif -} - // WebKit::WebViewClient ------------------------------------------------------ WebView* RenderView::createView( @@ -1511,9 +1484,6 @@ void RenderView::didStartLoading() { } is_loading_ = true; - // Clear the pointer so that we can assign it only when there is an unknown - // plugin on a page. - first_default_plugin_.reset(); Send(new ViewHostMsg_DidStartLoading(routing_id_)); @@ -3627,12 +3597,6 @@ void RenderView::OnCustomContextMenuAction( webview()->performCustomContextMenuAction(action); } -void RenderView::OnInstallMissingPlugin() { - // This could happen when the first default plugin is deleted. - if (first_default_plugin_) - first_default_plugin_->InstallMissingPlugin(); -} - void RenderView::OnEnumerateDirectoryResponse( int id, const std::vector<FilePath>& paths) { diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h index ac81413..352ed0b 100644 --- a/content/renderer/render_view.h +++ b/content/renderer/render_view.h @@ -285,11 +285,6 @@ class RenderView : public RenderWidget, // Notification that the given plugin has crashed. void PluginCrashed(const FilePath& plugin_path); - // Notification that the default plugin has done something about a missing - // plugin. See default_plugin_shared.h for possible values of |status|. - void OnMissingPluginStatus(WebPluginDelegateProxy* delegate, - int status); - // Create a new NPAPI plugin. WebKit::WebPlugin* CreateNPAPIPlugin(WebKit::WebFrame* frame, const WebKit::WebPluginParams& params, @@ -815,7 +810,6 @@ class RenderView : public RenderWidget, const std::vector<GURL>& links, const std::vector<FilePath>& local_paths, const FilePath& local_directory_name); - void OnInstallMissingPlugin(); void OnMediaPlayerActionAt(const gfx::Point& location, const WebKit::WebMediaPlayerAction& action); void OnMoveOrResizeStarted(); @@ -1124,10 +1118,6 @@ class RenderView : public RenderWidget, // Plugins ------------------------------------------------------------------- - // Remember the first uninstalled plugin, so that we can ask the plugin - // to install itself when user clicks on the info bar. - base::WeakPtr<webkit::npapi::WebPluginDelegate> first_default_plugin_; - PepperPluginDelegateImpl pepper_delegate_; // All the currently active plugin delegates for this RenderView; kept so that diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc index 9e49726..c9640b3 100644 --- a/content/renderer/webplugin_delegate_proxy.cc +++ b/content/renderer/webplugin_delegate_proxy.cc @@ -413,10 +413,6 @@ void WebPluginDelegateProxy::DidManualLoadFail() { Send(new PluginMsg_DidManualLoadFail(instance_id_)); } -void WebPluginDelegateProxy::InstallMissingPlugin() { - Send(new PluginMsg_InstallMissingPlugin(instance_id_)); -} - bool WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) { content::GetContentClient()->SetActiveURL(page_url_); @@ -436,8 +432,6 @@ bool WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(PluginHostMsg_ResolveProxy, OnResolveProxy) IPC_MESSAGE_HANDLER(PluginHostMsg_SetCookie, OnSetCookie) IPC_MESSAGE_HANDLER(PluginHostMsg_GetCookies, OnGetCookies) - IPC_MESSAGE_HANDLER(PluginHostMsg_MissingPluginStatus, - OnMissingPluginStatus) IPC_MESSAGE_HANDLER(PluginHostMsg_URLRequest, OnHandleURLRequest) IPC_MESSAGE_HANDLER(PluginHostMsg_CancelDocumentLoad, OnCancelDocumentLoad) IPC_MESSAGE_HANDLER(PluginHostMsg_InitiateHTTPRangeRequest, @@ -1138,11 +1132,6 @@ void WebPluginDelegateProxy::OnGetCookies(const GURL& url, *cookies = plugin_->GetCookies(url, first_party_for_cookies); } -void WebPluginDelegateProxy::OnMissingPluginStatus(int status) { - if (render_view_) - render_view_->OnMissingPluginStatus(this, status); -} - void WebPluginDelegateProxy::PaintSadPlugin(WebKit::WebCanvas* native_context, const gfx::Rect& rect) { // Lazily load the sad plugin image. diff --git a/content/renderer/webplugin_delegate_proxy.h b/content/renderer/webplugin_delegate_proxy.h index 5482335..5b66a3c 100644 --- a/content/renderer/webplugin_delegate_proxy.h +++ b/content/renderer/webplugin_delegate_proxy.h @@ -114,7 +114,6 @@ class WebPluginDelegateProxy virtual void DidReceiveManualData(const char* buffer, int length); virtual void DidFinishManualLoading(); virtual void DidManualLoadFail(); - virtual void InstallMissingPlugin(); virtual webkit::npapi::WebPluginResourceClient* CreateResourceClient( unsigned long resource_id, const GURL& url, int notify_id); virtual webkit::npapi::WebPluginResourceClient* CreateSeekableResourceClient( @@ -154,7 +153,6 @@ class WebPluginDelegateProxy const std::string& cookie); void OnGetCookies(const GURL& url, const GURL& first_party_for_cookies, std::string* cookies); - void OnMissingPluginStatus(int status); void OnCancelDocumentLoad(); void OnInitiateHTTPRangeRequest(const std::string& url, const std::string& range_info, |