chore: enable debugger api specs (#14475)

This commit is contained in:
Robo 2018-09-06 20:14:22 +05:30 committed by Samuel Attard
parent 9bf1fb323b
commit 35a1849e31
3 changed files with 51 additions and 27 deletions

View file

@ -12,6 +12,7 @@
#include "base/callback.h"
#include "base/values.h"
#include "content/public/browser/devtools_agent_host_client.h"
#include "content/public/browser/web_contents_observer.h"
#include "native_mate/handle.h"
namespace content {
@ -28,11 +29,11 @@ namespace atom {
namespace api {
class Debugger : public mate::TrackableObject<Debugger>,
public content::DevToolsAgentHostClient {
public content::DevToolsAgentHostClient,
public content::WebContentsObserver {
public:
using SendCommandCallback =
base::Callback<void(const base::DictionaryValue&,
const base::DictionaryValue&)>;
base::Callback<void(const base::Value&, const base::Value&)>;
static mate::Handle<Debugger> Create(v8::Isolate* isolate,
content::WebContents* web_contents);
@ -50,6 +51,10 @@ class Debugger : public mate::TrackableObject<Debugger>,
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
const std::string& message) override;
// content::WebContentsObserver:
void RenderFrameHostChanged(content::RenderFrameHost* old_rfh,
content::RenderFrameHost* new_rfh) override;
private:
using PendingRequestMap = std::map<int, SendCommandCallback>;
@ -57,6 +62,7 @@ class Debugger : public mate::TrackableObject<Debugger>,
bool IsAttached();
void Detach();
void SendCommand(mate::Arguments* args);
void ClearPendingRequests();
content::WebContents* web_contents_; // Weak Reference.
scoped_refptr<content::DevToolsAgentHost> agent_host_;