fix devtools filesystem api and allow delegate to request stored filesystem paths

This commit is contained in:
Robo 2016-03-15 07:53:40 +05:30
parent 17ff8f2e7e
commit c25264113f
4 changed files with 9 additions and 6 deletions

View file

@ -49,7 +49,7 @@ class DevToolsEmbedderMessageDispatcher {
virtual void AppendToFile(const std::string& url, virtual void AppendToFile(const std::string& url,
const std::string& content) = 0; const std::string& content) = 0;
virtual void RequestFileSystems() = 0; virtual void RequestFileSystems() = 0;
virtual void AddFileSystem() = 0; virtual void AddFileSystem(const std::string& file_system_path) = 0;
virtual void RemoveFileSystem(const std::string& file_system_path) = 0; virtual void RemoveFileSystem(const std::string& file_system_path) = 0;
virtual void UpgradeDraggedFileSystemPermissions( virtual void UpgradeDraggedFileSystemPermissions(
const std::string& file_system_url) = 0; const std::string& file_system_url) = 0;

View file

@ -14,6 +14,7 @@ class InspectableWebContentsDelegate {
const std::string& url, const std::string& content, bool save_as) {} const std::string& url, const std::string& content, bool save_as) {}
virtual void DevToolsAppendToFile( virtual void DevToolsAppendToFile(
const std::string& url, const std::string& content) {} const std::string& url, const std::string& content) {}
virtual void DevToolsRequestFileSystems() {}
virtual void DevToolsAddFileSystem( virtual void DevToolsAddFileSystem(
const base::FilePath& file_system_path) {} const base::FilePath& file_system_path) {}
virtual void DevToolsRemoveFileSystem( virtual void DevToolsRemoveFileSystem(

View file

@ -420,13 +420,15 @@ void InspectableWebContentsImpl::AppendToFile(
} }
void InspectableWebContentsImpl::RequestFileSystems() { void InspectableWebContentsImpl::RequestFileSystems() {
GetDevToolsWebContents()->GetMainFrame()->ExecuteJavaScript( if (delegate_)
base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([])")); delegate_->DevToolsRequestFileSystems();
} }
void InspectableWebContentsImpl::AddFileSystem() { void InspectableWebContentsImpl::AddFileSystem(
const std::string& file_system_path) {
if (delegate_) if (delegate_)
delegate_->DevToolsAddFileSystem(base::FilePath()); delegate_->DevToolsAddFileSystem(
base::FilePath::FromUTF8Unsafe(file_system_path));
} }
void InspectableWebContentsImpl::RemoveFileSystem( void InspectableWebContentsImpl::RemoveFileSystem(

View file

@ -89,7 +89,7 @@ class InspectableWebContentsImpl :
void AppendToFile(const std::string& url, void AppendToFile(const std::string& url,
const std::string& content) override; const std::string& content) override;
void RequestFileSystems() override; void RequestFileSystems() override;
void AddFileSystem() override; void AddFileSystem(const std::string& file_system_path) override;
void RemoveFileSystem(const std::string& file_system_path) override; void RemoveFileSystem(const std::string& file_system_path) override;
void UpgradeDraggedFileSystemPermissions( void UpgradeDraggedFileSystemPermissions(
const std::string& file_system_url) override; const std::string& file_system_url) override;