2 * Copyright (C) 2010 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
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
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.
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.
32 #include "InspectorFrontendClientImpl.h"
36 #include "InspectorFrontendHost.h"
38 #include "PlatformString.h"
39 #include "V8InspectorFrontendHost.h"
41 #include "WebDevToolsFrontendClient.h"
42 #include "WebDevToolsFrontendImpl.h"
43 #include "WebFloatPoint.h"
44 #include "WebString.h"
46 using namespace WebCore;
50 InspectorFrontendClientImpl::InspectorFrontendClientImpl(Page* frontendPage, WebDevToolsFrontendClient* client, WebDevToolsFrontendImpl* frontend)
51 : m_frontendPage(frontendPage)
53 , m_frontend(frontend)
57 InspectorFrontendClientImpl::~InspectorFrontendClientImpl()
60 m_frontendHost->disconnectClient();
64 void InspectorFrontendClientImpl::windowObjectCleared()
66 v8::HandleScope handleScope;
67 v8::Handle<v8::Context> frameContext = V8Proxy::context(m_frontendPage->mainFrame());
68 v8::Context::Scope contextScope(frameContext);
70 ASSERT(!m_frontendHost);
71 m_frontendHost = InspectorFrontendHost::create(this, m_frontendPage);
72 v8::Handle<v8::Value> frontendHostObj = toV8(m_frontendHost.get());
73 v8::Handle<v8::Object> global = frameContext->Global();
75 global->Set(v8::String::New("InspectorFrontendHost"), frontendHostObj);
78 void InspectorFrontendClientImpl::frontendLoaded()
82 void InspectorFrontendClientImpl::moveWindowBy(float x, float y)
84 m_client->moveWindowBy(WebFloatPoint(x, y));
87 String InspectorFrontendClientImpl::localizedStringsURL()
92 String InspectorFrontendClientImpl::hiddenPanels()
97 void InspectorFrontendClientImpl::bringToFront()
99 m_client->activateWindow();
102 void InspectorFrontendClientImpl::closeWindow()
104 m_client->closeWindow();
107 void InspectorFrontendClientImpl::requestAttachWindow()
109 m_client->requestDockWindow();
112 void InspectorFrontendClientImpl::requestDetachWindow()
114 m_client->requestUndockWindow();
117 void InspectorFrontendClientImpl::changeAttachedWindowHeight(unsigned)
122 void InspectorFrontendClientImpl::saveAs(const String& fileName, const String& content)
124 m_client->saveAs(fileName, content);
127 void InspectorFrontendClientImpl::inspectedURLChanged(const String& url)
129 m_frontendPage->mainFrame()->document()->setTitle("Developer Tools - " + url);
132 void InspectorFrontendClientImpl::sendMessageToBackend(const String& message)
134 m_client->sendMessageToBackend(message);
137 } // namespace WebKit