diff options
author | fsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-17 14:12:18 +0000 |
---|---|---|
committer | fsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-17 14:12:18 +0000 |
commit | 19c1c373edcc11cf28f66e25f02f890815336306 (patch) | |
tree | 79a4ec2b5dc59cad87c8385397d39d34295e2cc8 /content | |
parent | 7cf432680ad2f9bfd776374f134086966531420f (diff) | |
download | chromium_src-19c1c373edcc11cf28f66e25f02f890815336306.zip chromium_src-19c1c373edcc11cf28f66e25f02f890815336306.tar.gz chromium_src-19c1c373edcc11cf28f66e25f02f890815336306.tar.bz2 |
Browser Plugin: Enable File Chooser (<input type="file">)
Plumb RunFileChooser to the embedder's WebContentsDelegate so if the embedder is allowed to show
a file chooser, then so is the guest.
BUG=143801
TEST=<input type="file"> in guest
Review URL: https://chromiumcodereview.appspot.com/11098056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162392 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
3 files changed, 18 insertions, 19 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_embedder.cc b/content/browser/browser_plugin/browser_plugin_embedder.cc index 7aa5a2f..0a108a7 100644 --- a/content/browser/browser_plugin/browser_plugin_embedder.cc +++ b/content/browser/browser_plugin/browser_plugin_embedder.cc @@ -94,8 +94,7 @@ void BrowserPluginEmbedder::CreateGuest(RenderViewHost* render_view_host, instance_id); guest = guest_web_contents->GetBrowserPluginGuest(); - guest->set_embedder_render_process_host(render_view_host->GetProcess()); - guest->set_embedder_render_view_host(render_view_host); + guest->set_embedder_web_contents(web_contents()); RendererPreferences* guest_renderer_prefs = guest_web_contents->GetMutableRendererPrefs(); diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index fda0c62..0c51bac 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc @@ -42,8 +42,7 @@ BrowserPluginGuest::BrowserPluginGuest(int instance_id, WebContentsImpl* web_contents, RenderViewHost* render_view_host) : WebContentsObserver(web_contents), - embedder_render_process_host_(NULL), - embedder_render_view_host_(NULL), + embedder_web_contents_(NULL), instance_id_(instance_id), #if defined(OS_WIN) damage_buffer_size_(0), @@ -135,6 +134,11 @@ void BrowserPluginGuest::RendererUnresponsive(WebContents* source) { RecordAction(UserMetricsAction("BrowserPlugin.Guest.Hung")); } +void BrowserPluginGuest::RunFileChooser(WebContents* web_contents, + const FileChooserParams& params) { + embedder_web_contents_->GetDelegate()->RunFileChooser(web_contents, params); +} + void BrowserPluginGuest::SetIsAcceptingTouchEvents(bool accept) { SendMessageToEmbedder( new BrowserPluginMsg_ShouldAcceptTouchEvents(instance_id(), accept)); @@ -172,9 +176,12 @@ void BrowserPluginGuest::DragStatusUpdate(WebKit::WebDragStatus drag_status, } void BrowserPluginGuest::UpdateDragCursor(WebKit::WebDragOperation operation) { - CHECK(embedder_render_view_host_); + RenderViewHostImpl* embedder_render_view_host = + static_cast<RenderViewHostImpl*>( + embedder_web_contents_->GetRenderViewHost()); + CHECK(embedder_render_view_host); RenderViewHostDelegateView* view = - embedder_render_view_host_->GetDelegate()->GetDelegateView(); + embedder_render_view_host->GetDelegate()->GetDelegateView(); if (view) view->UpdateDragCursor(operation); } @@ -463,8 +470,7 @@ void BrowserPluginGuest::RenderViewGone(base::TerminationStatus status) { } void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { - DCHECK(embedder_render_process_host()); - embedder_render_process_host()->Send(msg); + embedder_web_contents_->GetRenderProcessHost()->Send(msg); } } // namespace content diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h index 9776b59..cd1ccec 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.h +++ b/content/browser/browser_plugin/browser_plugin_guest.h @@ -82,12 +82,8 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, guest_hang_timeout_ = timeout; } - void set_embedder_render_process_host( - RenderProcessHost* render_process_host) { - embedder_render_process_host_ = render_process_host; - } - void set_embedder_render_view_host(RenderViewHost* render_view_host) { - embedder_render_view_host_ = render_view_host; + void set_embedder_web_contents(WebContents* web_contents) { + embedder_web_contents_ = web_contents; } bool visible() const { return visible_; } @@ -126,6 +122,8 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, const std::string& request_method) OVERRIDE; virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; virtual void RendererUnresponsive(WebContents* source) OVERRIDE; + virtual void RunFileChooser(WebContents* web_contents, + const FileChooserParams& params) OVERRIDE; void UpdateRect(RenderViewHost* render_view_host, const ViewHostMsg_UpdateRect_Params& params); @@ -215,9 +213,6 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, WebContentsImpl* web_contents, RenderViewHost* render_view_host); - RenderProcessHost* embedder_render_process_host() { - return embedder_render_process_host_; - } // Returns the identifier that uniquely identifies a browser plugin guest // within an embedder. int instance_id() const { return instance_id_; } @@ -240,8 +235,7 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, static content::BrowserPluginHostFactory* factory_; NotificationRegistrar notification_registrar_; - RenderProcessHost* embedder_render_process_host_; - RenderViewHost* embedder_render_view_host_; + WebContents* embedder_web_contents_; // An identifier that uniquely identifies a browser plugin guest within an // embedder. int instance_id_; |