Merge "Fixed paste issue after selecting word in inputbox" into tizen_2.1
[framework/web/webkit-efl.git] / Source / WebKit2 / WebProcess / WebPage / WebInspector.h
1 /*
2  * Copyright (C) 2010 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  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #ifndef WebInspector_h
27 #define WebInspector_h
28
29 #if ENABLE(INSPECTOR)
30
31 #include "APIObject.h"
32 #include "Connection.h"
33 #include <wtf/Noncopyable.h>
34 #include <wtf/text/WTFString.h>
35
36 namespace WebCore {
37 class InspectorFrontendChannel;
38 }
39
40 namespace WebKit {
41
42 class WebInspectorFrontendClient;
43 class WebPage;
44 struct WebPageCreationParameters;
45
46 class WebInspector : public APIObject {
47 public:
48     static const Type APIType = TypeBundleInspector;
49
50     static PassRefPtr<WebInspector> create(WebPage*, WebCore::InspectorFrontendChannel*);
51
52     WebPage* page() const { return m_page; }
53     WebPage* inspectorPage() const { return m_inspectorPage; }
54
55     // Implemented in generated WebInspectorMessageReceiver.cpp
56     void didReceiveWebInspectorMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
57
58     // Called by WebInspector messages
59     void show();
60     void close();
61
62     void evaluateScriptForTest(long callID, const String& script);
63
64     void setJavaScriptProfilingEnabled(bool);
65     void startPageProfiling();
66     void stopPageProfiling();
67
68 #if ENABLE(INSPECTOR_SERVER)
69     bool hasRemoteFrontendConnected() const { return m_remoteFrontendConnected; }
70     void sendMessageToRemoteFrontend(const String& message);
71     void dispatchMessageFromRemoteFrontend(const String& message);
72     void remoteFrontendConnected();
73     void remoteFrontendDisconnected();
74 #endif
75
76 #if PLATFORM(MAC)
77     void setInspectorUsesWebKitUserInterface(bool);
78 #endif
79
80 private:
81     friend class WebInspectorClient;
82     friend class WebInspectorFrontendClient;
83
84     explicit WebInspector(WebPage*, WebCore::InspectorFrontendChannel*);
85
86     virtual Type type() const { return APIType; }
87
88     // Called from WebInspectorClient
89     WebPage* createInspectorPage();
90     void destroyInspectorPage();
91
92     // Called from WebInspectorFrontendClient
93     void didLoadInspectorPage();
94     void didClose();
95     void bringToFront();
96     void inspectedURLChanged(const String&);
97
98     void attach();
99     void detach();
100
101     void setAttachedWindowHeight(unsigned);
102
103     // Implemented in platform WebInspector file
104     String localizedStringsURL() const;
105
106     void showConsole();
107
108     void showResources();
109
110     void showMainResourceForFrame(uint64_t frameID);
111
112     void startJavaScriptDebugging();
113     void stopJavaScriptDebugging();
114
115     void startJavaScriptProfiling();
116     void stopJavaScriptProfiling();
117
118     void updateDockingAvailability();
119
120     WebPage* m_page;
121     WebPage* m_inspectorPage;
122     WebInspectorFrontendClient* m_frontendClient;
123     WebCore::InspectorFrontendChannel* m_frontendChannel;
124 #if PLATFORM(MAC)
125     String m_localizedStringsURL;
126 #endif
127 #if ENABLE(INSPECTOR_SERVER)
128     bool m_remoteFrontendConnected;
129 #endif
130 };
131
132 } // namespace WebKit
133
134 #endif // ENABLE(INSPECTOR)
135
136 #endif // WebInspector_h