From caba44ab6c58c703cd716bcb85b40c898b7bf7fe Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Fri, 22 Jul 2016 19:19:42 +0530 Subject: [PATCH] allow delegate to handle file and color chooser --- .../browser/inspectable_web_contents_impl.cc | 27 +++++++++++++++++++ .../browser/inspectable_web_contents_impl.h | 9 +++++++ 2 files changed, 36 insertions(+) diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index dc3110be4ec..210a69392e2 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -670,6 +670,33 @@ void InspectableWebContentsImpl::CloseContents(content::WebContents* source) { CloseDevTools(); } +content::ColorChooser* InspectableWebContentsImpl::OpenColorChooser( + content::WebContents* source, + SkColor color, + const std::vector& 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()) diff --git a/brightray/browser/inspectable_web_contents_impl.h b/brightray/browser/inspectable_web_contents_impl.h index f9496a75398..249829aed83 100644 --- a/brightray/browser/inspectable_web_contents_impl.h +++ b/brightray/browser/inspectable_web_contents_impl.h @@ -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& 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;