From 45f73f6b6cef0bcd158009dd0da484e791c5ee55 Mon Sep 17 00:00:00 2001 From: "leo.yang@torchmobile.com.cn" Date: Thu, 9 Feb 2012 03:20:41 +0000 Subject: [PATCH] [BlackBerry] Upstream InspectorClientBlackBerry.{h, cpp} https://bugs.webkit.org/show_bug.cgi?id=78082 Reviewed by Rob Buis. Initial upstream, no new tests. * blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp: Added. * blackberry/WebCoreSupport/InspectorClientBlackBerry.h: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107169 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit/ChangeLog | 12 ++ .../WebCoreSupport/InspectorClientBlackBerry.cpp | 144 +++++++++++++++++++++ .../WebCoreSupport/InspectorClientBlackBerry.h | 66 ++++++++++ 3 files changed, 222 insertions(+) create mode 100644 Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp create mode 100644 Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index 06d563a..a696cab 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,5 +1,17 @@ 2012-02-08 Leo Yang + [BlackBerry] Upstream InspectorClientBlackBerry.{h, cpp} + https://bugs.webkit.org/show_bug.cgi?id=78082 + + Reviewed by Rob Buis. + + Initial upstream, no new tests. + + * blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp: Added. + * blackberry/WebCoreSupport/InspectorClientBlackBerry.h: Added. + +2012-02-08 Leo Yang + [BlackBerry] Remove EditCommandBlackBerry.cpp from build system https://bugs.webkit.org/show_bug.cgi?id=78078 diff --git a/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp new file mode 100644 index 0000000..73f887f --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp @@ -0,0 +1,144 @@ +/* + * 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 "NotImplemented.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; +} + +Page* InspectorClientBlackBerry::createPage() +{ + notImplemented(); + return 0; +} + +String InspectorClientBlackBerry::localizedStringsURL() +{ + notImplemented(); + return String(); +} + +String InspectorClientBlackBerry::hiddenPanels() +{ + notImplemented(); + return String(); +} + +void InspectorClientBlackBerry::showWindow() +{ + notImplemented(); +} + +void InspectorClientBlackBerry::closeWindow() +{ + notImplemented(); +} + +void InspectorClientBlackBerry::attachWindow() +{ + notImplemented(); +} + +void InspectorClientBlackBerry::detachWindow() +{ + notImplemented(); +} + +void InspectorClientBlackBerry::setAttachedWindowHeight(unsigned) +{ + notImplemented(); +} + +void InspectorClientBlackBerry::highlight() +{ + hideHighlight(); +} + +void InspectorClientBlackBerry::hideHighlight() +{ + if (!m_webPagePrivate->mainFrame() || !m_webPagePrivate->mainFrame()->document() || !m_webPagePrivate->mainFrame()->document()->documentElement() + || !m_webPagePrivate->mainFrame()->document()->documentElement()->renderer()) + return; + + // FIXME: Potentially slow hack, but invalidating everything should work since the actual highlight is drawn by BackingStorePrivate::renderContents(). + m_webPagePrivate->mainFrame()->document()->documentElement()->renderer()->repaint(true); +} + +void InspectorClientBlackBerry::inspectedURLChanged(const String&) +{ + notImplemented(); +} + +void InspectorClientBlackBerry::populateSetting(const String& key, String* value) +{ + if (m_inspectorSettingsMap->contains(key)) + *value = m_inspectorSettingsMap->get(key); +} + +void InspectorClientBlackBerry::storeSetting(const String& key, const String& value) +{ + m_inspectorSettingsMap->set(key, value); +} + +void InspectorClientBlackBerry::inspectorWindowObjectCleared() +{ + notImplemented(); +} + +void InspectorClientBlackBerry::openInspectorFrontend(InspectorController*) +{ + 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(); +} + +} // namespace WebCore diff --git a/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h new file mode 100644 index 0000000..f5cca1e --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h @@ -0,0 +1,66 @@ +/* + * 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 + */ + +#ifndef InspectorClientBlackBerry_h +#define InspectorClientBlackBerry_h + +#include "InspectorClient.h" +#include "PlatformString.h" +#include + +namespace BlackBerry { +namespace WebKit { +class WebPagePrivate; +} +} + +namespace WebCore { + +class InspectorClientBlackBerry : public InspectorClient { +public: + InspectorClientBlackBerry(BlackBerry::WebKit::WebPagePrivate*); + virtual void inspectorDestroyed(); + virtual Page* createPage(); + virtual String localizedStringsURL(); + virtual String hiddenPanels(); + virtual void showWindow(); + virtual void closeWindow(); + virtual void attachWindow(); + virtual void detachWindow(); + virtual void setAttachedWindowHeight(unsigned); + virtual void highlight(); + virtual void hideHighlight(); + virtual void inspectedURLChanged(const String&); + virtual void populateSetting(const String& key, String* value); + virtual void storeSetting(const String& key, const String& value); + virtual void inspectorWindowObjectCleared(); + virtual void openInspectorFrontend(InspectorController*); + virtual bool sendMessageToFrontend(const String&); + virtual void clearBrowserCache(); + virtual void clearBrowserCookies(); + +private: + BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate; + typedef HashMap SettingsMap; + OwnPtr m_inspectorSettingsMap; +}; + +} // namespace WebCore + +#endif // InspectorClientBlackBerry_h -- 2.7.4