Update to new devtools messages
This commit is contained in:
parent
3f2c2e3484
commit
d48a80bdfa
4 changed files with 300 additions and 260 deletions
|
@ -15,6 +15,7 @@
|
|||
|
||||
namespace base {
|
||||
class ListValue;
|
||||
class Value;
|
||||
}
|
||||
|
||||
namespace brightray {
|
||||
|
@ -29,14 +30,18 @@ class DevToolsEmbedderMessageDispatcher {
|
|||
public:
|
||||
class Delegate {
|
||||
public:
|
||||
using DispatchCallback = base::Callback<void(const base::Value*)>;
|
||||
|
||||
virtual ~Delegate() {}
|
||||
|
||||
virtual void ActivateWindow() = 0;
|
||||
virtual void CloseWindow() = 0;
|
||||
virtual void LoadCompleted() = 0;
|
||||
virtual void SetInspectedPageBounds(const gfx::Rect& rect) = 0;
|
||||
virtual void InspectElementCompleted() = 0;
|
||||
virtual void MoveWindow(int x, int y) = 0;
|
||||
virtual void SetIsDocked(bool docked) = 0;
|
||||
virtual void InspectedURLChanged(const std::string& url) = 0;
|
||||
virtual void SetIsDocked(const DispatchCallback& callback,
|
||||
bool is_docked) = 0;
|
||||
virtual void OpenInNewTab(const std::string& url) = 0;
|
||||
virtual void SaveToFile(const std::string& url,
|
||||
const std::string& content,
|
||||
|
@ -48,29 +53,37 @@ class DevToolsEmbedderMessageDispatcher {
|
|||
virtual void RemoveFileSystem(const std::string& file_system_path) = 0;
|
||||
virtual void UpgradeDraggedFileSystemPermissions(
|
||||
const std::string& file_system_url) = 0;
|
||||
virtual void IndexPath(int request_id,
|
||||
virtual void IndexPath(int index_request_id,
|
||||
const std::string& file_system_path) = 0;
|
||||
virtual void StopIndexing(int request_id) = 0;
|
||||
virtual void SearchInPath(int request_id,
|
||||
virtual void StopIndexing(int index_request_id) = 0;
|
||||
virtual void LoadNetworkResource(const DispatchCallback& callback,
|
||||
const std::string& url,
|
||||
const std::string& headers,
|
||||
int stream_id) = 0;
|
||||
virtual void SearchInPath(int search_request_id,
|
||||
const std::string& file_system_path,
|
||||
const std::string& query) = 0;
|
||||
virtual void SetWhitelistedShortcuts(const std::string& message) = 0;
|
||||
virtual void ZoomIn() = 0;
|
||||
virtual void ZoomOut() = 0;
|
||||
virtual void ResetZoom() = 0;
|
||||
virtual void SetDevicesUpdatesEnabled(bool enabled) = 0;
|
||||
virtual void SendMessageToBrowser(const std::string& message) = 0;
|
||||
virtual void RecordActionUMA(const std::string& name, int action) = 0;
|
||||
virtual void SendJsonRequest(const DispatchCallback& callback,
|
||||
const std::string& browser_id,
|
||||
const std::string& url) = 0;
|
||||
};
|
||||
|
||||
explicit DevToolsEmbedderMessageDispatcher(Delegate* delegate);
|
||||
using DispatchCallback = Delegate::DispatchCallback;
|
||||
|
||||
~DevToolsEmbedderMessageDispatcher();
|
||||
virtual ~DevToolsEmbedderMessageDispatcher() {}
|
||||
virtual bool Dispatch(const DispatchCallback& callback,
|
||||
const std::string& method,
|
||||
const base::ListValue* params) = 0;
|
||||
|
||||
std::string Dispatch(const std::string& method, base::ListValue* params);
|
||||
|
||||
private:
|
||||
typedef base::Callback<bool (const base::ListValue&)> Handler;
|
||||
void RegisterHandler(const std::string& method, const Handler& handler);
|
||||
|
||||
typedef std::map<std::string, Handler> HandlerMap;
|
||||
HandlerMap handlers_;
|
||||
static DevToolsEmbedderMessageDispatcher* CreateForDevToolsFrontend(
|
||||
Delegate* delegate);
|
||||
};
|
||||
|
||||
} // namespace brightray
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue