summaryrefslogtreecommitdiffstats
path: root/webkit/glue/devtools/dom_agent.h
blob: 205e4d9d6792c9af06cddeac0d7cae3f641f86a5 (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
// 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, METHOD4) \
  /* Requests that the document root element is sent to the delegate. */ \
  METHOD0(GetDocumentElement) \
  \
  /* Requests that the element's children are sent to the client. */ \
  METHOD2(GetChildNodes, int /* call_id */, int /* id */) \
  \
  /* Sets attribute value in the element with given id. */ \
  METHOD4(SetAttribute, int /* call_id */, int /* id */, String /* name */, \
      String /* value */) \
  \
  /* Removes attribute from the element with given id. */ \
  METHOD3(RemoveAttribute, int /* call_id */, int /* id */, \
      String /* name */) \
  \
  /* Sets text node value in the node with given id. */ \
  METHOD3(SetTextNodeValue, int /* call_id */, int /* id */, \
      String /* text */) \
  \
  /* Perform search. */ \
  METHOD2(PerformSearch, int /* call_id */, String /* query */) \
  \
  /* 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, \
    METHOD4) \
  /* Response to GetChildNodes. */ \
  METHOD1(DidGetChildNodes, int /* call_id */) \
  \
  /* Perform search. */ \
  METHOD2(DidPerformSearch, int /* call_id */, Value /* results */) \
  \
  /* Ack for the Set/RemoveAttribute, SetTextNodeValue. */ \
  METHOD2(DidApplyDomChange, int /* call_id */, bool /* success */) \
  \
  /* Notifies the delegate that element's attributes are updated. */ \
  METHOD2(AttributesUpdated, int /* id */, Value /* attributes */) \
  \
  /* Sends document element to the delegate. */ \
  METHOD1(SetDocumentElement, Value /* root */) \
  \
  /* Notifies the delegate that element's child nodes have been updated. */ \
  METHOD2(SetChildNodes, int /* parent_id */, Value /* nodes */) \
  \
  /* 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_