OSDN Git Service

Merge WebKit at r78450: Initial merge by git.
[android-x86/external-webkit.git] / Source / WebCore / inspector / InspectorController.h
1 /*
2  * Copyright (C) 2011 Google 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 are
6  * met:
7  *
8  *     * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *     * Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer
12  * in the documentation and/or other materials provided with the
13  * distribution.
14  *     * Neither the name of Google Inc. nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30
31 #ifndef InspectorController_h
32 #define InspectorController_h
33
34 #include "PlatformString.h"
35 #include <wtf/Forward.h>
36 #include <wtf/Noncopyable.h>
37 #include <wtf/Vector.h>
38
39 namespace WebCore {
40
41 class DOMWrapperWorld;
42 class Frame;
43 class GraphicsContext;
44 class InspectorAgent;
45 class InspectorBackendDispatcher;
46 class InspectorClient;
47 class InspectorFrontend;
48 class InspectorFrontendClient;
49 class Page;
50 class PostWorkerNotificationToFrontendTask;
51 class Node;
52
53 class InspectorController {
54     WTF_MAKE_NONCOPYABLE(InspectorController);
55     WTF_MAKE_FAST_ALLOCATED;
56 public:
57     InspectorController(Page*, InspectorClient*);
58     ~InspectorController();
59
60     bool enabled() const;
61     Page* inspectedPage() const;
62
63     void show();
64     void close();
65
66     void setInspectorFrontendClient(PassOwnPtr<InspectorFrontendClient>);
67     bool hasInspectorFrontendClient() const;
68     void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
69     void setInspectorExtensionAPI(const String& source);
70
71     void dispatchMessageFromFrontend(const String& message);
72
73     bool hasFrontend() const { return m_inspectorFrontend; }
74     void connectFrontend();
75     void disconnectFrontend();
76     void restoreInspectorStateFromCookie(const String& inspectorCookie);
77
78     void showConsole();
79     void inspect(Node*);
80     void drawNodeHighlight(GraphicsContext&) const;
81     void hideHighlight();
82
83     void evaluateForTestInFrontend(long callId, const String& script);
84
85     void startTimelineProfiler();
86     void stopTimelineProfiler();
87     bool timelineProfilerEnabled();
88
89 #if ENABLE(JAVASCRIPT_DEBUGGER)
90     bool profilerEnabled();
91     void enableProfiler();
92     void startUserInitiatedProfiling();
93     bool isRecordingUserInitiatedProfile() const;
94     void stopUserInitiatedProfiling();
95     void disableProfiler();
96     void showAndEnableDebugger();
97     bool debuggerEnabled();
98     void disableDebugger();
99     void resume();
100 #endif
101
102 private:
103     friend class PostWorkerNotificationToFrontendTask;
104
105     OwnPtr<InspectorAgent> m_inspectorAgent;
106     OwnPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
107     OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient;
108     OwnPtr<InspectorFrontend> m_inspectorFrontend;
109     InspectorClient* m_inspectorClient;
110     bool m_openingFrontend;
111 };
112
113 }
114
115 #endif // !defined(InspectorController_h)