summaryrefslogtreecommitdiffstats
path: root/webkit/glue/devtools/dom_agent.h
blob: a2d881891dc7f71e3c3d045c94359fd16fbc0af6 (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
// 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_DEVTOOLS_DOM_AGENT_H_
#define WEBKIT_GLUE_DEVTOOLS_DOM_AGENT_H_

#include "webkit/glue/devtools/devtools_rpc.h"

// DomAgent is a utility object that covers DOM-related functionality of the
// WebDevToolsAgent. It is capable of sending DOM tree to the client as well
// as providing DOM notifications for the nodes known to the client.
// DomAgent's environment is represented with the DomAgentDelegate interface.
#define DOM_AGENT_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3) \
  /* Requests that the document root element is sent to the delegate. */ \
  METHOD0(GetDocumentElement) \
  \
  /* Requests that the element's children are sent to the client. */ \
  METHOD1(GetChildNodes, int /* id */) \
  \
  /* Sets attribute value in the element with given id. */ \
  METHOD3(SetAttribute, int /* id */, String /* name */, String /* value */) \
  \
  /* Removes attribute from the element with given id. */ \
  METHOD2(RemoveAttribute, int /* id */, String /* name */) \
  \
  /* Sets text node value in the node with given id. */ \
  METHOD2(SetTextNodeValue, int /* id */, String /* text */) \
  \
  /* Tells dom agent that the client has lost all of the dom-related
   information and is no longer interested in the notifications related to the
   nodes issued earlier. */ \
  METHOD0(DiscardBindings)

DEFINE_RPC_CLASS(DomAgent, DOM_AGENT_STRUCT)

#define DOM_AGENT_DELEGATE_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3) \
  /* Notifies the delegate that document element is available. */ \
  METHOD1(DocumentElementUpdated, Value /* node */) \
  \
  /* Notifies the delegate that element's attributes are updated. */ \
  METHOD2(AttributesUpdated, int /* id */, Value /* attributes */) \
  \
  /* Notifies the delegate that element's child nodes have been updated. */ \
  METHOD2(ChildNodesUpdated, int /* id */, Value /* node */) \
  \
  /* Notifies the delegate that element's 'has children' state has been
     updated */ \
  METHOD2(HasChildrenUpdated, int /* id */, bool /* new_value */) \
  \
  /* Notifies the delegate that child node has been inserted. */ \
  METHOD3(ChildNodeInserted, int /* parent_id */ , int /* prev_id */, \
      Value /* node */) \
  \
  /* Notifies the delegate that child node has been deleted. */ \
  METHOD2(ChildNodeRemoved, int /* parent_id */, int /* id */)

DEFINE_RPC_CLASS(DomAgentDelegate, DOM_AGENT_DELEGATE_STRUCT)

#endif  // WEBKIT_GLUE_DEVTOOLS_DOM_AGENT_H_