summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webdevtoolsagent_impl.h
blob: 15df64c1a070fd36ffc34703976e99b3f5b32120 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef WEBKIT_GLUE_WEBDEVTOOLSAGENT_IMPL_H_
#define WEBKIT_GLUE_WEBDEVTOOLSAGENT_IMPL_H_

#include <string>

#include "base/scoped_ptr.h"
#include "webkit/glue/devtools/devtools_rpc.h"
#include "webkit/glue/devtools/dom_agent.h"
#include "webkit/glue/devtools/net_agent.h"
#include "webkit/glue/devtools/tools_agent.h"
#include "webkit/glue/webdevtoolsagent.h"

namespace WebCore {
class Document;
class Node;
class String;
}

class DebuggerAgentDelegateStub;
class DebuggerAgentImpl;
class DomAgentImpl;
class NetAgentImpl;
class Value;
class WebDevToolsAgentDelegate;
class WebFrame;
class WebFrame;
class WebViewImpl;

class WebDevToolsAgentImpl
    : public WebDevToolsAgent,
      public ToolsAgent,
      public DevToolsRpc::Delegate {
 public:
  WebDevToolsAgentImpl(WebViewImpl* web_view_impl,
      WebDevToolsAgentDelegate* delegate);
  virtual ~WebDevToolsAgentImpl();

  // ToolsAgent implementation.
  virtual void HighlightDOMNode(int node_id);
  virtual void HideDOMNodeHighlight();
  virtual void EvaluateJavaSctipt(int call_id, const String& js);

  // WebDevToolsAgent implementation.
  virtual void Attach();
  virtual void Detach();
  virtual void DispatchMessageFromClient(const std::string& raw_msg);
  virtual void InspectElement(int x, int y);

  // DevToolsRpc::Delegate implementation.
  void SendRpcMessage(const std::string& raw_msg);

  // Methods called by the glue.
  void SetMainFrameDocumentReady(bool ready);
  void DidCommitLoadForFrame(WebViewImpl* webview,
                             WebFrame* frame,
                             bool is_new_navigation);

  NetAgentImpl* net_agent_impl() { return net_agent_impl_.get(); }

 private:
  WebDevToolsAgentDelegate* delegate_;
  WebViewImpl* web_view_impl_;
  WebCore::Document* document_;
  scoped_ptr<DebuggerAgentDelegateStub> debugger_agent_delegate_stub_;
  scoped_ptr<DomAgentDelegateStub> dom_agent_delegate_stub_;
  scoped_ptr<NetAgentDelegateStub> net_agent_delegate_stub_;
  scoped_ptr<ToolsAgentDelegateStub> tools_agent_delegate_stub_;
  scoped_ptr<DebuggerAgentImpl> debugger_agent_impl_;
  scoped_ptr<DomAgentImpl> dom_agent_impl_;
  scoped_ptr<NetAgentImpl> net_agent_impl_;
  bool attached_;
  DISALLOW_COPY_AND_ASSIGN(WebDevToolsAgentImpl);
};

#endif  // WEBKIT_GLUE_WEBDEVTOOLSAGENT_IMPL_H_