OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "core/fetch/TextResourceDecoder.h" | 35 #include "core/fetch/TextResourceDecoder.h" |
36 #include "core/inspector/InspectorController.h" | 36 #include "core/inspector/InspectorController.h" |
37 #include "core/inspector/InspectorFrontendClient.h" | 37 #include "core/inspector/InspectorFrontendClient.h" |
38 #include "core/loader/FrameLoader.h" | 38 #include "core/loader/FrameLoader.h" |
39 #include "core/page/ContextMenuController.h" | 39 #include "core/page/ContextMenuController.h" |
40 #include "core/page/ContextMenuProvider.h" | 40 #include "core/page/ContextMenuProvider.h" |
41 #include "core/page/Frame.h" | 41 #include "core/page/Frame.h" |
42 #include "core/page/Page.h" | 42 #include "core/page/Page.h" |
43 #include "core/platform/ContextMenu.h" | 43 #include "core/platform/ContextMenu.h" |
44 #include "core/platform/ContextMenuItem.h" | 44 #include "core/platform/ContextMenuItem.h" |
| 45 #include "core/platform/JSONValues.h" |
45 #include "core/platform/Pasteboard.h" | 46 #include "core/platform/Pasteboard.h" |
46 #include "core/platform/network/ResourceError.h" | 47 #include "core/platform/network/ResourceError.h" |
47 #include "core/platform/network/ResourceRequest.h" | 48 #include "core/platform/network/ResourceRequest.h" |
48 #include "core/platform/network/ResourceResponse.h" | 49 #include "core/platform/network/ResourceResponse.h" |
49 #include "core/rendering/RenderTheme.h" | 50 #include "core/rendering/RenderTheme.h" |
50 #include "modules/filesystem/DOMFileSystem.h" | 51 #include "modules/filesystem/DOMFileSystem.h" |
51 | 52 |
52 namespace WebCore { | 53 namespace WebCore { |
53 | 54 |
54 class FrontendMenuProvider : public ContextMenuProvider { | 55 class FrontendMenuProvider : public ContextMenuProvider { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 m_client->requestSetDockSide(InspectorFrontendClient::Undocked); | 145 m_client->requestSetDockSide(InspectorFrontendClient::Undocked); |
145 else if (side == "right") | 146 else if (side == "right") |
146 m_client->requestSetDockSide(InspectorFrontendClient::DockedToRight); | 147 m_client->requestSetDockSide(InspectorFrontendClient::DockedToRight); |
147 else if (side == "bottom") | 148 else if (side == "bottom") |
148 m_client->requestSetDockSide(InspectorFrontendClient::DockedToBottom); | 149 m_client->requestSetDockSide(InspectorFrontendClient::DockedToBottom); |
149 } | 150 } |
150 | 151 |
151 void InspectorFrontendHost::closeWindow() | 152 void InspectorFrontendHost::closeWindow() |
152 { | 153 { |
153 if (m_client) { | 154 if (m_client) { |
| 155 RefPtr<JSONObject> message = JSONObject::create(); |
| 156 message->setString("method", "closeWindow"); |
| 157 sendMessageToEmbedder(message->toJSONString()); |
154 m_client->closeWindow(); | 158 m_client->closeWindow(); |
155 disconnectClient(); // Disconnect from client. | 159 disconnectClient(); // Disconnect from client. |
156 } | 160 } |
157 } | 161 } |
158 | 162 |
159 void InspectorFrontendHost::bringToFront() | 163 void InspectorFrontendHost::bringToFront() |
160 { | 164 { |
161 if (m_client) | 165 if (m_client) |
162 m_client->bringToFront(); | 166 m_client->bringToFront(); |
163 } | 167 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 void InspectorFrontendHost::close(const String&) | 230 void InspectorFrontendHost::close(const String&) |
227 { | 231 { |
228 } | 232 } |
229 | 233 |
230 void InspectorFrontendHost::sendMessageToBackend(const String& message) | 234 void InspectorFrontendHost::sendMessageToBackend(const String& message) |
231 { | 235 { |
232 if (m_client) | 236 if (m_client) |
233 m_client->sendMessageToBackend(message); | 237 m_client->sendMessageToBackend(message); |
234 } | 238 } |
235 | 239 |
| 240 void InspectorFrontendHost::sendMessageToEmbedder(const String& message) |
| 241 { |
| 242 if (m_client) |
| 243 m_client->sendMessageToEmbedder(message); |
| 244 } |
| 245 |
236 void InspectorFrontendHost::showContextMenu(Event* event, const Vector<ContextMe
nuItem>& items) | 246 void InspectorFrontendHost::showContextMenu(Event* event, const Vector<ContextMe
nuItem>& items) |
237 { | 247 { |
238 if (!event) | 248 if (!event) |
239 return; | 249 return; |
240 | 250 |
241 ASSERT(m_frontendPage); | 251 ASSERT(m_frontendPage); |
242 ScriptState* frontendScriptState = mainWorldScriptState(m_frontendPage->main
Frame()); | 252 ScriptState* frontendScriptState = mainWorldScriptState(m_frontendPage->main
Frame()); |
243 ScriptObject frontendApiObject; | 253 ScriptObject frontendApiObject; |
244 if (!ScriptGlobalObject::get(frontendScriptState, "InspectorFrontendAPI", fr
ontendApiObject)) { | 254 if (!ScriptGlobalObject::get(frontendScriptState, "InspectorFrontendAPI", fr
ontendApiObject)) { |
245 ASSERT_NOT_REACHED(); | 255 ASSERT_NOT_REACHED(); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 { | 352 { |
343 return false; | 353 return false; |
344 } | 354 } |
345 | 355 |
346 String InspectorFrontendHost::hiddenPanels() | 356 String InspectorFrontendHost::hiddenPanels() |
347 { | 357 { |
348 return ""; | 358 return ""; |
349 } | 359 } |
350 | 360 |
351 } // namespace WebCore | 361 } // namespace WebCore |
OLD | NEW |