• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1.  Redistributions of source code must retain the above copyright
9  *     notice, this list of conditions and the following disclaimer.
10  * 2.  Redistributions in binary form must reproduce the above copyright
11  *     notice, this list of conditions and the following disclaimer in the
12  *     documentation and/or other materials provided with the distribution.
13  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14  *     its contributors may be used to endorse or promote products derived
15  *     from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef InspectorBackend_h
30 #define InspectorBackend_h
31 
32 #include "Console.h"
33 #include "InspectorController.h"
34 #include "PlatformString.h"
35 
36 #include <wtf/RefCounted.h>
37 
38 namespace WebCore {
39 
40 class CachedResource;
41 class InspectorClient;
42 class InspectorDOMAgent;
43 class JavaScriptCallFrame;
44 class Node;
45 
46 class InspectorBackend : public RefCounted<InspectorBackend>
47 {
48 public:
create(InspectorController * inspectorController,InspectorClient * client)49     static PassRefPtr<InspectorBackend> create(InspectorController* inspectorController, InspectorClient* client)
50     {
51         return adoptRef(new InspectorBackend(inspectorController, client));
52     }
53 
54     ~InspectorBackend();
55 
inspectorController()56     InspectorController* inspectorController() { return m_inspectorController; }
57 
disconnectController()58     void disconnectController() { m_inspectorController = 0; }
59 
60     void hideDOMNodeHighlight();
61 
62     String localizedStringsURL();
63     String hiddenPanels();
64 
65     void windowUnloading();
66 
67     bool isWindowVisible();
68 
69     void addResourceSourceToFrame(long identifier, Node* frame);
70     bool addSourceToFrame(const String& mimeType, const String& source, Node* frame);
71 
72     void clearMessages();
73 
74     void toggleNodeSearch();
75 
76     void attach();
77     void detach();
78 
79     void setAttachedWindowHeight(unsigned height);
80 
81     void storeLastActivePanel(const String& panelName);
82 
83     bool searchingForNode();
84 
85     void loaded(bool enableDOMAgent);
86 
87     void enableResourceTracking(bool always);
88     void disableResourceTracking(bool always);
89     bool resourceTrackingEnabled() const;
90 
91     void moveWindowBy(float x, float y) const;
92     void closeWindow();
93 
94     const String& platform() const;
95 
96 #if ENABLE(JAVASCRIPT_DEBUGGER)
97     const ProfilesArray& profiles() const;
98 
99     void startProfiling();
100     void stopProfiling();
101 
102     void enableProfiler(bool always);
103     void disableProfiler(bool always);
104     bool profilerEnabled();
105 
106     void enableDebugger(bool always);
107     void disableDebugger(bool always);
108     bool debuggerEnabled() const;
109 
110     JavaScriptCallFrame* currentCallFrame() const;
111 
112     void addBreakpoint(const String& sourceID, unsigned lineNumber);
113     void removeBreakpoint(const String& sourceID, unsigned lineNumber);
114 
115     bool pauseOnExceptions();
116     void setPauseOnExceptions(bool pause);
117 
118     void pauseInDebugger();
119     void resumeDebugger();
120 
121     void stepOverStatementInDebugger();
122     void stepIntoStatementInDebugger();
123     void stepOutOfFunctionInDebugger();
124 #endif
125 
126     void getChildNodes(long callId, long elementId);
127     void setAttribute(long callId, long elementId, const String& name, const String& value);
128     void removeAttribute(long callId, long elementId, const String& name);
129     void setTextNodeValue(long callId, long elementId, const String& value);
130 
131     // Generic code called from custom implementations.
132     void highlight(Node* node);
133 
134 private:
135     InspectorBackend(InspectorController* inspectorController, InspectorClient* client);
136 
137     InspectorController* m_inspectorController;
138     InspectorClient* m_client;
139 #if ENABLE(JAVASCRIPT_DEBUGGER)
140     ProfilesArray m_emptyProfiles;
141 #endif
142 };
143 
144 } // namespace WebCore
145 
146 #endif // !defined(InspectorBackend_h)
147