1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
/*
* Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
* Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "InspectorClientBlackBerry.h"
#include "BackingStore.h"
#include "Frame.h"
#include "GraphicsContext.h"
#include "InspectorController.h"
#include "NotImplemented.h"
#include "Page.h"
#include "RenderObject.h"
#include "WebPageClient.h"
#include "WebPage_p.h"
namespace WebCore {
InspectorClientBlackBerry::InspectorClientBlackBerry(BlackBerry::WebKit::WebPagePrivate* webPagePrivate)
: m_webPagePrivate(webPagePrivate)
{
m_inspectorSettingsMap = adoptPtr(new SettingsMap);
}
void InspectorClientBlackBerry::inspectorDestroyed()
{
delete this;
}
void InspectorClientBlackBerry::highlight()
{
m_webPagePrivate->setInspectorOverlayClient(this);
}
void InspectorClientBlackBerry::hideHighlight()
{
m_webPagePrivate->setInspectorOverlayClient(0);
}
InspectorFrontendChannel* InspectorClientBlackBerry::openInspectorFrontend(InspectorController*)
{
notImplemented();
return 0;
}
void InspectorClientBlackBerry::closeInspectorFrontend()
{
notImplemented();
}
void InspectorClientBlackBerry::bringFrontendToFront()
{
notImplemented();
}
bool InspectorClientBlackBerry::sendMessageToFrontend(const String& message)
{
CString utf8Message = message.utf8();
m_webPagePrivate->m_client->handleWebInspectorMessageToFrontend(0, utf8Message.data(), utf8Message.length());
return true;
}
void InspectorClientBlackBerry::clearBrowserCache()
{
m_webPagePrivate->m_client->clearCache();
}
void InspectorClientBlackBerry::clearBrowserCookies()
{
m_webPagePrivate->m_client->clearCookies();
}
bool InspectorClientBlackBerry::canOverrideDeviceMetrics()
{
return true;
}
void InspectorClientBlackBerry::overrideDeviceMetrics(int width, int height, float fontScaleFactor, bool)
{
// Note: when width and height = 0, and fontScaleFactor = 1, this is the signal for restoring to default size.
m_webPagePrivate->applySizeOverride(width, height);
m_webPagePrivate->setTextZoomFactor(fontScaleFactor);
}
bool InspectorClientBlackBerry::supportsFrameInstrumentation()
{
return true;
}
void InspectorClientBlackBerry::updateInspectorStateCookie(const String&)
{
// If this is implemented, we should override and return true in InspectorStateClient::supportsInspectorStateUpdates().
notImplemented();
};
void InspectorClientBlackBerry::paintInspectorOverlay(GraphicsContext& gc)
{
InspectorController* inspectorController = m_webPagePrivate->m_page->inspectorController();
if (inspectorController)
inspectorController->drawHighlight(gc);
}
} // namespace WebCore
|