implement devtools showItemInFolder message
This commit is contained in:
parent
5aa136a23d
commit
29ff9873f4
4 changed files with 12 additions and 0 deletions
|
@ -168,6 +168,7 @@ DevToolsEmbedderMessageDispatcher::CreateForDevToolsFrontend(
|
||||||
d->RegisterHandlerWithCallback("setIsDocked", &Delegate::SetIsDocked,
|
d->RegisterHandlerWithCallback("setIsDocked", &Delegate::SetIsDocked,
|
||||||
delegate);
|
delegate);
|
||||||
d->RegisterHandler("openInNewTab", &Delegate::OpenInNewTab, delegate);
|
d->RegisterHandler("openInNewTab", &Delegate::OpenInNewTab, delegate);
|
||||||
|
d->RegisterHandler("showItemInFolder", &Delegate::ShowItemInFolder, delegate);
|
||||||
d->RegisterHandler("save", &Delegate::SaveToFile, delegate);
|
d->RegisterHandler("save", &Delegate::SaveToFile, delegate);
|
||||||
d->RegisterHandler("append", &Delegate::AppendToFile, delegate);
|
d->RegisterHandler("append", &Delegate::AppendToFile, delegate);
|
||||||
d->RegisterHandler("requestFileSystems", &Delegate::RequestFileSystems,
|
d->RegisterHandler("requestFileSystems", &Delegate::RequestFileSystems,
|
||||||
|
|
|
@ -43,6 +43,7 @@ class DevToolsEmbedderMessageDispatcher {
|
||||||
virtual void SetIsDocked(const DispatchCallback& callback,
|
virtual void SetIsDocked(const DispatchCallback& callback,
|
||||||
bool is_docked) = 0;
|
bool is_docked) = 0;
|
||||||
virtual void OpenInNewTab(const std::string& url) = 0;
|
virtual void OpenInNewTab(const std::string& url) = 0;
|
||||||
|
virtual void ShowItemInFolder(const std::string& file_system_path) = 0;
|
||||||
virtual void SaveToFile(const std::string& url,
|
virtual void SaveToFile(const std::string& url,
|
||||||
const std::string& content,
|
const std::string& content,
|
||||||
bool save_as) = 0;
|
bool save_as) = 0;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "brightray/browser/inspectable_web_contents_impl.h"
|
#include "brightray/browser/inspectable_web_contents_impl.h"
|
||||||
|
|
||||||
|
#include "atom/common/platform_util.h"
|
||||||
#include "base/guid.h"
|
#include "base/guid.h"
|
||||||
#include "base/json/json_reader.h"
|
#include "base/json/json_reader.h"
|
||||||
#include "base/json/json_writer.h"
|
#include "base/json/json_writer.h"
|
||||||
|
@ -485,6 +486,14 @@ void InspectableWebContentsImpl::SetIsDocked(const DispatchCallback& callback,
|
||||||
|
|
||||||
void InspectableWebContentsImpl::OpenInNewTab(const std::string& url) {}
|
void InspectableWebContentsImpl::OpenInNewTab(const std::string& url) {}
|
||||||
|
|
||||||
|
void InspectableWebContentsImpl::ShowItemInFolder(
|
||||||
|
const std::string& file_system_path) {
|
||||||
|
if (file_system_path.empty())
|
||||||
|
return;
|
||||||
|
base::FilePath path = base::FilePath::FromUTF8Unsafe(file_system_path);
|
||||||
|
platform_util::ShowItemInFolder(path);
|
||||||
|
}
|
||||||
|
|
||||||
void InspectableWebContentsImpl::SaveToFile(const std::string& url,
|
void InspectableWebContentsImpl::SaveToFile(const std::string& url,
|
||||||
const std::string& content,
|
const std::string& content,
|
||||||
bool save_as) {
|
bool save_as) {
|
||||||
|
|
|
@ -83,6 +83,7 @@ class InspectableWebContentsImpl
|
||||||
int stream_id) override;
|
int stream_id) override;
|
||||||
void SetIsDocked(const DispatchCallback& callback, bool is_docked) override;
|
void SetIsDocked(const DispatchCallback& callback, bool is_docked) override;
|
||||||
void OpenInNewTab(const std::string& url) override;
|
void OpenInNewTab(const std::string& url) override;
|
||||||
|
void ShowItemInFolder(const std::string& file_system_path) override;
|
||||||
void SaveToFile(const std::string& url,
|
void SaveToFile(const std::string& url,
|
||||||
const std::string& content,
|
const std::string& content,
|
||||||
bool save_as) override;
|
bool save_as) override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue