Commit 95edbdf1 authored by ericzeng's avatar ericzeng Committed by Commit bot

Add support for file inputs for all guest views

Implement WebContentsDelegate::RunFileChooser in GuestViewBase
so that <input type=file> tags will work correctly within  guest views.

BUG=409339

Review URL: https://codereview.chromium.org/531963002

Cr-Commit-Position: refs/heads/master@{#293044}
parent 3d20816f
...@@ -383,6 +383,14 @@ void GuestViewBase::WebContentsDestroyed() { ...@@ -383,6 +383,14 @@ void GuestViewBase::WebContentsDestroyed() {
delete this; delete this;
} }
void GuestViewBase::RunFileChooser(WebContents* web_contents,
const content::FileChooserParams& params) {
if (!attached() || !embedder_web_contents()->GetDelegate())
return;
embedder_web_contents()->GetDelegate()->RunFileChooser(web_contents, params);
}
bool GuestViewBase::ShouldFocusPageAfterCrash() { bool GuestViewBase::ShouldFocusPageAfterCrash() {
// Focus is managed elsewhere. // Focus is managed elsewhere.
return false; return false;
......
...@@ -278,6 +278,9 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate, ...@@ -278,6 +278,9 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate,
virtual void WebContentsDestroyed() OVERRIDE FINAL; virtual void WebContentsDestroyed() OVERRIDE FINAL;
// WebContentsDelegate implementation. // WebContentsDelegate implementation.
virtual void RunFileChooser(
content::WebContents* web_contents,
const content::FileChooserParams& params) OVERRIDE;
virtual bool ShouldFocusPageAfterCrash() OVERRIDE FINAL; virtual bool ShouldFocusPageAfterCrash() OVERRIDE FINAL;
virtual bool PreHandleGestureEvent( virtual bool PreHandleGestureEvent(
content::WebContents* source, content::WebContents* source,
......
...@@ -837,14 +837,6 @@ content::ColorChooser* WebViewGuest::OpenColorChooser( ...@@ -837,14 +837,6 @@ content::ColorChooser* WebViewGuest::OpenColorChooser(
web_contents, color, suggestions); web_contents, color, suggestions);
} }
void WebViewGuest::RunFileChooser(WebContents* web_contents,
const content::FileChooserParams& params) {
if (!attached() || !embedder_web_contents()->GetDelegate())
return;
embedder_web_contents()->GetDelegate()->RunFileChooser(web_contents, params);
}
void WebViewGuest::NavigateGuest(const std::string& src) { void WebViewGuest::NavigateGuest(const std::string& src) {
GURL url = ResolveURL(src); GURL url = ResolveURL(src);
......
...@@ -131,9 +131,6 @@ class WebViewGuest : public GuestView<WebViewGuest>, ...@@ -131,9 +131,6 @@ class WebViewGuest : public GuestView<WebViewGuest>,
content::WebContents* web_contents, content::WebContents* web_contents,
SkColor color, SkColor color,
const std::vector<content::ColorSuggestion>& suggestions) OVERRIDE; const std::vector<content::ColorSuggestion>& suggestions) OVERRIDE;
virtual void RunFileChooser(
content::WebContents* web_contents,
const content::FileChooserParams& params) OVERRIDE;
virtual void AddNewContents(content::WebContents* source, virtual void AddNewContents(content::WebContents* source,
content::WebContents* new_contents, content::WebContents* new_contents,
WindowOpenDisposition disposition, WindowOpenDisposition disposition,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment