diff --git a/brightray/browser/inspectable_web_contents_delegate.h b/brightray/browser/inspectable_web_contents_delegate.h index 0b2f3f6a2b2a..d86285789e3d 100644 --- a/brightray/browser/inspectable_web_contents_delegate.h +++ b/brightray/browser/inspectable_web_contents_delegate.h @@ -20,6 +20,12 @@ class InspectableWebContentsDelegate { // the default behavior. // Receiver is given the chance to change the |dock_side|. virtual bool DevToolsShow(std::string* dock_side) { return false; } + + // Requested by WebContents of devtools. + virtual void DevToolsSaveToFile( + const std::string& url, const std::string& content, bool save_as) {} + virtual void DevToolsAppendToFile( + const std::string& url, const std::string& content) {} }; } // namespace brightray diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index b22b4a287fbc..1ccb4e1054d4 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -153,10 +153,14 @@ void InspectableWebContentsImpl::OpenInNewTab(const std::string& url) { void InspectableWebContentsImpl::SaveToFile( const std::string& url, const std::string& content, bool save_as) { + if (delegate_) + delegate_->DevToolsSaveToFile(url, content, save_as); } void InspectableWebContentsImpl::AppendToFile( const std::string& url, const std::string& content) { + if (delegate_) + delegate_->DevToolsAppendToFile(url, content); } void InspectableWebContentsImpl::RequestFileSystems() {