|
1 /* |
|
2 * Copyright (C) 2009 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 "InspectorClientImpl.h" |
|
33 |
|
34 #include "DOMWindow.h" |
|
35 #include "FloatRect.h" |
|
36 #include "NotImplemented.h" |
|
37 #include "Page.h" |
|
38 #include "WebDevToolsAgentImpl.h" |
|
39 #include "WebDevToolsMessageData.h" |
|
40 #include "WebRect.h" |
|
41 #include "WebURL.h" |
|
42 #include "WebURLRequest.h" |
|
43 #include "WebViewClient.h" |
|
44 #include "WebViewImpl.h" |
|
45 #include <wtf/Vector.h> |
|
46 |
|
47 using namespace WebCore; |
|
48 |
|
49 namespace WebKit { |
|
50 |
|
51 InspectorClientImpl::InspectorClientImpl(WebViewImpl* webView) |
|
52 : m_inspectedWebView(webView) |
|
53 { |
|
54 ASSERT(m_inspectedWebView); |
|
55 } |
|
56 |
|
57 InspectorClientImpl::~InspectorClientImpl() |
|
58 { |
|
59 } |
|
60 |
|
61 void InspectorClientImpl::inspectorDestroyed() |
|
62 { |
|
63 if (WebDevToolsAgentImpl* agent = devToolsAgent()) |
|
64 agent->inspectorDestroyed(); |
|
65 } |
|
66 |
|
67 void InspectorClientImpl::openInspectorFrontend(InspectorController* controller) |
|
68 { |
|
69 if (WebDevToolsAgentImpl* agent = devToolsAgent()) |
|
70 agent->openInspectorFrontend(controller); |
|
71 } |
|
72 |
|
73 void InspectorClientImpl::highlight(Node* node) |
|
74 { |
|
75 if (WebDevToolsAgentImpl* agent = devToolsAgent()) |
|
76 agent->highlight(node); |
|
77 } |
|
78 |
|
79 void InspectorClientImpl::hideHighlight() |
|
80 { |
|
81 if (WebDevToolsAgentImpl* agent = devToolsAgent()) |
|
82 agent->hideHighlight(); |
|
83 } |
|
84 |
|
85 void InspectorClientImpl::populateSetting(const String& key, String* value) |
|
86 { |
|
87 if (WebDevToolsAgentImpl* agent = devToolsAgent()) |
|
88 agent->populateSetting(key, value); |
|
89 } |
|
90 |
|
91 void InspectorClientImpl::storeSetting(const String& key, const String& value) |
|
92 { |
|
93 if (WebDevToolsAgentImpl* agent = devToolsAgent()) |
|
94 agent->storeSetting(key, value); |
|
95 } |
|
96 |
|
97 bool InspectorClientImpl::sendMessageToFrontend(const WebCore::String& message) |
|
98 { |
|
99 if (WebDevToolsAgentImpl* agent = devToolsAgent()) |
|
100 return agent->sendMessageToFrontend(message); |
|
101 return false; |
|
102 } |
|
103 |
|
104 void InspectorClientImpl::resourceTrackingWasEnabled() |
|
105 { |
|
106 if (WebDevToolsAgentImpl* agent = devToolsAgent()) |
|
107 agent->resourceTrackingWasEnabled(); |
|
108 } |
|
109 |
|
110 void InspectorClientImpl::resourceTrackingWasDisabled() |
|
111 { |
|
112 if (WebDevToolsAgentImpl* agent = devToolsAgent()) |
|
113 agent->resourceTrackingWasDisabled(); |
|
114 } |
|
115 |
|
116 void InspectorClientImpl::timelineProfilerWasStarted() |
|
117 { |
|
118 if (WebDevToolsAgentImpl* agent = devToolsAgent()) |
|
119 agent->timelineProfilerWasStarted(); |
|
120 } |
|
121 |
|
122 void InspectorClientImpl::timelineProfilerWasStopped() |
|
123 { |
|
124 if (WebDevToolsAgentImpl* agent = devToolsAgent()) |
|
125 agent->timelineProfilerWasStopped(); |
|
126 } |
|
127 |
|
128 WebDevToolsAgentImpl* InspectorClientImpl::devToolsAgent() |
|
129 { |
|
130 return static_cast<WebDevToolsAgentImpl*>(m_inspectedWebView->devToolsAgent()); |
|
131 } |
|
132 |
|
133 } // namespace WebKit |