OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2010 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 #include "config.h" | |
32 #include "DRTDevToolsClient.h" | |
33 | |
34 #include "DRTDevToolsAgent.h" | |
35 #include "Task.h" | |
36 #include "WebDevToolsAgent.h" | |
37 #include "WebDevToolsFrontend.h" | |
38 #include "WebFrame.h" | |
39 #include "WebScriptSource.h" | |
40 #include "WebView.h" | |
41 #include "webkit/support/webkit_support.h" | |
42 #include <wtf/PassOwnPtr.h> | |
43 | |
44 using namespace WebKit; | |
45 using namespace WebTestRunner; | |
46 | |
47 DRTDevToolsClient::DRTDevToolsClient(DRTDevToolsAgent* agent, WebView* webView) | |
48 : m_webView(webView) | |
49 , m_drtDevToolsAgent(agent) | |
50 { | |
51 m_webDevToolsFrontend = adoptPtr(WebDevToolsFrontend::create(m_webView, this
, WebString::fromUTF8("en-US"))); | |
52 m_drtDevToolsAgent->attach(this); | |
53 } | |
54 | |
55 DRTDevToolsClient::~DRTDevToolsClient() | |
56 { | |
57 // There is a chance that the page will be destroyed at detach step of | |
58 // m_drtDevToolsAgent and we should clean pending requests a bit earlier. | |
59 m_taskList.revokeAll(); | |
60 if (m_drtDevToolsAgent) | |
61 m_drtDevToolsAgent->detach(); | |
62 } | |
63 | |
64 void DRTDevToolsClient::reset() | |
65 { | |
66 m_taskList.revokeAll(); | |
67 } | |
68 | |
69 void DRTDevToolsClient::sendMessageToBackend(const WebString& data) | |
70 { | |
71 if (m_drtDevToolsAgent) | |
72 m_drtDevToolsAgent->asyncCall(data); | |
73 } | |
74 | |
75 void DRTDevToolsClient::activateWindow() | |
76 { | |
77 // Not implemented. | |
78 } | |
79 | |
80 void DRTDevToolsClient::closeWindow() | |
81 { | |
82 // Not implemented. | |
83 } | |
84 | |
85 void DRTDevToolsClient::dockWindow() | |
86 { | |
87 // Not implemented. | |
88 } | |
89 | |
90 void DRTDevToolsClient::undockWindow() | |
91 { | |
92 // Not implemented. | |
93 } | |
94 | |
95 bool DRTDevToolsClient::isUnderTest() | |
96 { | |
97 return true; | |
98 } | |
99 | |
100 void DRTDevToolsClient::asyncCall(const WebString& args) | |
101 { | |
102 postTask(new AsyncCallTask(this, args)); | |
103 } | |
104 | |
105 void DRTDevToolsClient::call(const WebString& args) | |
106 { | |
107 m_webDevToolsFrontend->dispatchOnInspectorFrontend(args); | |
108 } | |
OLD | NEW |