Enable delegate to override SaveToFile and AppendToFile.

This commit is contained in:
Cheng Zhao 2014-04-05 00:10:09 +08:00
parent d2ff5ad798
commit 54060ed53d
2 changed files with 10 additions and 0 deletions

View file

@ -20,6 +20,12 @@ class InspectableWebContentsDelegate {
// the default behavior. // the default behavior.
// Receiver is given the chance to change the |dock_side|. // Receiver is given the chance to change the |dock_side|.
virtual bool DevToolsShow(std::string* dock_side) { return false; } 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 } // namespace brightray

View file

@ -153,10 +153,14 @@ void InspectableWebContentsImpl::OpenInNewTab(const std::string& url) {
void InspectableWebContentsImpl::SaveToFile( void InspectableWebContentsImpl::SaveToFile(
const std::string& url, const std::string& content, bool save_as) { const std::string& url, const std::string& content, bool save_as) {
if (delegate_)
delegate_->DevToolsSaveToFile(url, content, save_as);
} }
void InspectableWebContentsImpl::AppendToFile( void InspectableWebContentsImpl::AppendToFile(
const std::string& url, const std::string& content) { const std::string& url, const std::string& content) {
if (delegate_)
delegate_->DevToolsAppendToFile(url, content);
} }
void InspectableWebContentsImpl::RequestFileSystems() { void InspectableWebContentsImpl::RequestFileSystems() {