Merge pull request #238 from deepak1556/devtools_file_input_patch

allow delegate to handle file and color chooser
This commit is contained in:
Cheng Zhao 2016-07-25 16:07:57 +09:00 committed by GitHub
commit f3b85e915d
2 changed files with 36 additions and 0 deletions

View file

@ -670,6 +670,33 @@ void InspectableWebContentsImpl::CloseContents(content::WebContents* source) {
CloseDevTools();
}
content::ColorChooser* InspectableWebContentsImpl::OpenColorChooser(
content::WebContents* source,
SkColor color,
const std::vector<content::ColorSuggestion>& suggestions) {
auto delegate = web_contents_->GetDelegate();
if (delegate)
return delegate->OpenColorChooser(source, color, suggestions);
return nullptr;
}
void InspectableWebContentsImpl::RunFileChooser(
content::WebContents* source,
const content::FileChooserParams& params) {
auto delegate = web_contents_->GetDelegate();
if (delegate)
delegate->RunFileChooser(source, params);
}
void InspectableWebContentsImpl::EnumerateDirectory(
content::WebContents* source,
int request_id,
const base::FilePath& path) {
auto delegate = web_contents_->GetDelegate();
if (delegate)
delegate->EnumerateDirectory(source, request_id, path);
}
void InspectableWebContentsImpl::OnWebContentsFocused() {
#if defined(TOOLKIT_VIEWS)
if (view_->GetDelegate())

View file

@ -153,6 +153,15 @@ class InspectableWebContentsImpl :
void HandleKeyboardEvent(
content::WebContents*, const content::NativeWebKeyboardEvent&) override;
void CloseContents(content::WebContents* source) override;
content::ColorChooser* OpenColorChooser(
content::WebContents* source,
SkColor color,
const std::vector<content::ColorSuggestion>& suggestions) override;
void RunFileChooser(content::WebContents* source,
const content::FileChooserParams& params) override;
void EnumerateDirectory(content::WebContents* source,
int request_id,
const base::FilePath& path) override;
// net::URLFetcherDelegate:
void OnURLFetchComplete(const net::URLFetcher* source) override;