Enable writing files in devtools.

This commit is contained in:
Cheng Zhao 2014-04-05 00:10:57 +08:00
parent d4e7fe3eb8
commit 877277d837
3 changed files with 77 additions and 1 deletions

View file

@ -237,6 +237,11 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
virtual bool DevToolsSetDockSide(const std::string& dock_side,
bool* succeed) OVERRIDE;
virtual bool DevToolsShow(std::string* dock_side) OVERRIDE;
virtual void DevToolsSaveToFile(const std::string& url,
const std::string& content,
bool save_as) OVERRIDE;
virtual void DevToolsAppendToFile(const std::string& url,
const std::string& content) OVERRIDE;
// Whether window has standard frame.
bool has_frame_;
@ -251,6 +256,12 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
// Dispatch unresponsive event to observers.
void NotifyWindowUnresponsive();
// Call a function in devtools.
void CallDevToolsFunction(const std::string& function_name,
const base::Value* arg1 = NULL,
const base::Value* arg2 = NULL,
const base::Value* arg3 = NULL);
// Called when CapturePage has done.
void OnCapturePageDone(const CapturePageCallback& callback,
bool succeed,
@ -293,6 +304,10 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
scoped_ptr<AtomJavaScriptDialogManager> dialog_manager_;
scoped_ptr<brightray::InspectableWebContents> inspectable_web_contents_;
// Maps url to file path, used by the file requests sent from devtools.
typedef std::map<std::string, base::FilePath> PathsMap;
PathsMap saved_files_;
DISALLOW_COPY_AND_ASSIGN(NativeWindow);
};