summaryrefslogtreecommitdiff
path: root/Source/WebKit/blackberry/WebCoreSupport
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/blackberry/WebCoreSupport')
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in1
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp843
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h162
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/ClientExtension.cpp110
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/ClientExtension.h34
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.cpp85
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.h62
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp77
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.h62
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/FrameNetworkingContextBlackBerry.cpp34
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/FrameNetworkingContextBlackBerry.h37
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.cpp109
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.h61
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.cpp88
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.h54
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp144
-rw-r--r--Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h66
17 files changed, 2028 insertions, 1 deletions
diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in
index de86ca2ee..44565db22 100644
--- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in
+++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in
@@ -44,7 +44,6 @@ GC_LOGGING
GC_VALIDATION
GEOLOCATION
GESTURE_EVENTS
-GESTURE_RECOGNIZER
GGC
GLIB_SUPPORT
GLOBAL_FASTMALLOC_NEW
diff --git a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp
new file mode 100644
index 000000000..0e9acffd8
--- /dev/null
+++ b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp
@@ -0,0 +1,843 @@
+/*
+ * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
+ * Copyright (C) 2010, 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 "ChromeClientBlackBerry.h"
+
+#include "BackingStore.h"
+#include "BackingStoreClient.h"
+#include "BackingStore_p.h"
+#include "CString.h"
+#include "DatabaseTracker.h"
+#include "Document.h"
+#include "DumpRenderTreeClient.h"
+#include "DumpRenderTreeSupport.h"
+#include "FileChooser.h"
+#include "FileIconLoader.h"
+#include "Frame.h"
+#include "FrameLoadRequest.h"
+#include "FrameLoader.h"
+#include "Geolocation.h"
+#include "GeolocationControllerClientBlackBerry.h"
+#include "HTMLInputElement.h"
+#include "HTMLNames.h"
+#include "HitTestResult.h"
+#include "Icon.h"
+#include "InputHandler.h"
+#include "KURL.h"
+#include "Node.h"
+#include "NotImplemented.h"
+#include "NotificationPresenterImpl.h"
+#include "Page.h"
+#include "PageGroup.h"
+#include "PageGroupLoadDeferrer.h"
+#include "PlatformString.h"
+#include "PopupMenuBlackBerry.h"
+#include "RenderView.h"
+#include "SVGZoomAndPan.h"
+#include "SearchPopupMenuBlackBerry.h"
+#include "SecurityOrigin.h"
+#include "SharedPointer.h"
+#include "ViewportArguments.h"
+#include "WebPage.h"
+#include "WebPageClient.h"
+#include "WebPage_p.h"
+#include "WebSettings.h"
+#include "WebString.h"
+#include "WindowFeatures.h"
+#include <BlackBerryPlatformLog.h>
+#include <BlackBerryPlatformSettings.h>
+
+#define DEBUG_OVERFLOW_DETECTION 0
+
+using namespace BlackBerry::WebKit;
+
+namespace WebCore {
+
+static CString frameOrigin(Frame* frame)
+{
+ DOMWindow* window = frame->domWindow();
+ SecurityOrigin* origin = window->securityOrigin();
+ CString latinOrigin = origin->toString().latin1();
+ return latinOrigin;
+}
+
+ChromeClientBlackBerry::ChromeClientBlackBerry(WebPagePrivate* pagePrivate)
+ : m_webPagePrivate(pagePrivate)
+{
+}
+
+void ChromeClientBlackBerry::addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned int lineNumber, const String& sourceID)
+{
+#if ENABLE_DRT
+ if (m_webPagePrivate->m_dumpRenderTree)
+ m_webPagePrivate->m_dumpRenderTree->addMessageToConsole(message, lineNumber, sourceID);
+#endif
+
+ m_webPagePrivate->m_client->addMessageToConsole(message.characters(), message.length(), sourceID.characters(), sourceID.length(), lineNumber);
+}
+
+void ChromeClientBlackBerry::runJavaScriptAlert(Frame* frame, const String& message)
+{
+#if ENABLE_DRT
+ if (m_webPagePrivate->m_dumpRenderTree) {
+ m_webPagePrivate->m_dumpRenderTree->runJavaScriptAlert(message);
+ return;
+ }
+#endif
+
+ TimerBase::fireTimersInNestedEventLoop();
+ CString latinOrigin = frameOrigin(frame);
+ m_webPagePrivate->m_client->runJavaScriptAlert(message.characters(), message.length(), latinOrigin.data(), latinOrigin.length());
+}
+
+bool ChromeClientBlackBerry::runJavaScriptConfirm(Frame* frame, const String& message)
+{
+#if ENABLE_DRT
+ if (m_webPagePrivate->m_dumpRenderTree)
+ return m_webPagePrivate->m_dumpRenderTree->runJavaScriptConfirm(message);
+#endif
+
+ TimerBase::fireTimersInNestedEventLoop();
+ CString latinOrigin = frameOrigin(frame);
+ return m_webPagePrivate->m_client->runJavaScriptConfirm(message.characters(), message.length(), latinOrigin.data(), latinOrigin.length());
+}
+
+bool ChromeClientBlackBerry::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result)
+{
+#if ENABLE_DRT
+ if (m_webPagePrivate->m_dumpRenderTree) {
+ result = m_webPagePrivate->m_dumpRenderTree->runJavaScriptPrompt(message, defaultValue);
+ return true;
+ }
+#endif
+
+ TimerBase::fireTimersInNestedEventLoop();
+ CString latinOrigin = frameOrigin(frame);
+ WebString clientResult;
+ if (m_webPagePrivate->m_client->runJavaScriptPrompt(message.characters(), message.length(), defaultValue.characters(), defaultValue.length(), latinOrigin.data(), latinOrigin.length(), clientResult)) {
+ result = clientResult;
+ return true;
+ }
+ return false;
+}
+
+void ChromeClientBlackBerry::chromeDestroyed()
+{
+ delete this;
+}
+
+void ChromeClientBlackBerry::setWindowRect(const FloatRect&)
+{
+ // The window dimensions are fixed in the RIM port.
+}
+
+FloatRect ChromeClientBlackBerry::windowRect()
+{
+ const IntSize windowSize = m_webPagePrivate->m_client->window()->windowSize();
+ return FloatRect(0, 0, windowSize.width(), windowSize.height());
+}
+
+FloatRect ChromeClientBlackBerry::pageRect()
+{
+ notImplemented();
+ return FloatRect();
+}
+
+float ChromeClientBlackBerry::scaleFactor()
+{
+ return 1;
+}
+
+void ChromeClientBlackBerry::focus()
+{
+ notImplemented();
+}
+
+void ChromeClientBlackBerry::unfocus()
+{
+ notImplemented();
+}
+
+bool ChromeClientBlackBerry::canTakeFocus(FocusDirection)
+{
+ notImplemented();
+ return false;
+}
+
+void ChromeClientBlackBerry::takeFocus(FocusDirection)
+{
+ notImplemented();
+}
+
+void ChromeClientBlackBerry::focusedNodeChanged(Node* node)
+{
+ WebPageClient::FocusType type = WebPageClient::FocusUnknown;
+
+ if (!node)
+ type = WebPageClient::FocusNone;
+ else if (node->isSVGElement())
+ type = WebPageClient::FocusSVGElement;
+ else if (node->isHTMLElement()) {
+ if (node->hasTagName(HTMLNames::aTag)) {
+ type = WebPageClient::FocusLink;
+ } else if (node->hasTagName(HTMLNames::inputTag)) {
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(node);
+ if (inputElement->hasTagName(HTMLNames::isindexTag) || inputElement->isInputTypeHidden())
+ type = WebPageClient::FocusInputUnknown;
+ else if (inputElement->isTextButton())
+ type = WebPageClient::FocusInputButton;
+ else if (inputElement->isCheckbox())
+ type = WebPageClient::FocusInputCheckBox;
+#if ENABLE(INPUT_COLOR)
+ else if (inputElement->isColorControl())
+ type = WebPageClient::FocusInputColor;
+#endif
+ else if (inputElement->isDateControl())
+ type = WebPageClient::FocusInputDate;
+ else if (inputElement->isDateTimeControl())
+ type = WebPageClient::FocusInputDateTime;
+ else if (inputElement->isDateTimeLocalControl())
+ type = WebPageClient::FocusInputDateTimeLocal;
+ else if (inputElement->isEmailField())
+ type = WebPageClient::FocusInputEmail;
+ else if (inputElement->isFileUpload())
+ type = WebPageClient::FocusInputFile;
+ else if (inputElement->isImageButton())
+ type = WebPageClient::FocusInputImage;
+ else if (inputElement->isMonthControl())
+ type = WebPageClient::FocusInputMonth;
+ else if (inputElement->isNumberField())
+ type = WebPageClient::FocusInputNumber;
+ else if (inputElement->isPasswordField())
+ type = WebPageClient::FocusInputPassword;
+ else if (inputElement->isRadioButton())
+ type = WebPageClient::FocusInputRadio;
+ else if (inputElement->isRangeControl())
+ type = WebPageClient::FocusInputRange;
+ else if (inputElement->isResetButton())
+ type = WebPageClient::FocusInputReset;
+ else if (inputElement->isSearchField())
+ type = WebPageClient::FocusInputSearch;
+ else if (inputElement->isSubmitButton())
+ type = WebPageClient::FocusInputSubmit;
+ else if (inputElement->isTelephoneField())
+ type = WebPageClient::FocusInputTelephone;
+ else if (inputElement->isURLField())
+ type = WebPageClient::FocusInputURL;
+ else if (inputElement->isTextField())
+ type = WebPageClient::FocusInputText;
+ else if (inputElement->isTimeControl())
+ type = WebPageClient::FocusInputTime;
+ // FIXME: missing WEEK popup selector
+ else
+ type = WebPageClient::FocusInputUnknown;
+ } else if (node->hasTagName(HTMLNames::imgTag))
+ type = WebPageClient::FocusImage;
+ else if (node->hasTagName(HTMLNames::objectTag))
+ type = WebPageClient::FocusObject;
+ else if (node->hasTagName(HTMLNames::videoTag))
+ type = WebPageClient::FocusVideo;
+ else if (node->hasTagName(HTMLNames::selectTag))
+ type = WebPageClient::FocusSelect;
+ else if (node->hasTagName(HTMLNames::textareaTag))
+ type = WebPageClient::FocusTextArea;
+ else if (node->hasTagName(HTMLNames::canvasTag))
+ type = WebPageClient::FocusCanvas;
+ }
+
+ m_webPagePrivate->m_inputHandler->nodeFocused(node);
+
+ m_webPagePrivate->m_client->focusChanged(type, reinterpret_cast<int>(node));
+}
+
+void ChromeClientBlackBerry::focusedFrameChanged(Frame*)
+{
+ // To be used by In-region backing store context switching.
+}
+
+bool ChromeClientBlackBerry::shouldForceDocumentStyleSelectorUpdate()
+{
+ return !m_webPagePrivate->m_webSettings->isJavaScriptEnabled() && !m_webPagePrivate->m_inputHandler->processingChange();
+}
+
+Page* ChromeClientBlackBerry::createWindow(Frame*, const FrameLoadRequest& request, const WindowFeatures& features, const NavigationAction&)
+{
+#if ENABLE_DRT
+ if (m_webPagePrivate->m_dumpRenderTree && !m_webPagePrivate->m_dumpRenderTree->allowsOpeningWindow())
+ return 0;
+#endif
+
+ PageGroupLoadDeferrer deferrer(m_webPagePrivate->m_page, true);
+ TimerBase::fireTimersInNestedEventLoop();
+
+ int x = features.xSet ? features.x : 0;
+ int y = features.ySet ? features.y : 0;
+ int width = features.widthSet? features.width : -1;
+ int height = features.heightSet ? features.height : -1;
+ unsigned flags = 0;
+
+ if (features.menuBarVisible)
+ flags |= WebPageClient::FlagWindowHasMenuBar;
+ if (features.statusBarVisible)
+ flags |= WebPageClient::FlagWindowHasStatusBar;
+ if (features.toolBarVisible)
+ flags |= WebPageClient::FlagWindowHasToolBar;
+ if (features.locationBarVisible)
+ flags |= WebPageClient::FlagWindowHasLocationBar;
+ if (features.scrollbarsVisible)
+ flags |= WebPageClient::FlagWindowHasScrollBar;
+ if (features.resizable)
+ flags |= WebPageClient::FlagWindowIsResizable;
+ if (features.fullscreen)
+ flags |= WebPageClient::FlagWindowIsFullScreen;
+ if (features.dialog)
+ flags |= WebPageClient::FlagWindowIsDialog;
+
+ WebPage* webPage = m_webPagePrivate->m_client->createWindow(x, y, width, height, flags, WebString(request.resourceRequest().url().string()), WebString(request.frameName()));
+ if (!webPage)
+ return 0;
+
+#if ENABLE_DRT
+ if (m_webPagePrivate->m_dumpRenderTree)
+ m_webPagePrivate->m_dumpRenderTree->windowCreated(webPage);
+#endif
+
+ return webPage->d->m_page;
+}
+
+void ChromeClientBlackBerry::show()
+{
+ notImplemented();
+}
+
+bool ChromeClientBlackBerry::canRunModal()
+{
+ notImplemented();
+ return false;
+}
+
+void ChromeClientBlackBerry::runModal()
+{
+ notImplemented();
+}
+
+bool ChromeClientBlackBerry::selectItemWritingDirectionIsNatural()
+{
+ return false;
+}
+
+bool ChromeClientBlackBerry::selectItemAlignmentFollowsMenuWritingDirection()
+{
+ return true;
+}
+
+PassRefPtr<PopupMenu> ChromeClientBlackBerry::createPopupMenu(PopupMenuClient* client) const
+{
+ return adoptRef(new PopupMenuBlackBerry(client));
+}
+
+PassRefPtr<SearchPopupMenu> ChromeClientBlackBerry::createSearchPopupMenu(PopupMenuClient* client) const
+{
+ return adoptRef(new SearchPopupMenuBlackBerry(client));
+}
+
+
+void ChromeClientBlackBerry::setToolbarsVisible(bool)
+{
+ notImplemented();
+}
+
+bool ChromeClientBlackBerry::toolbarsVisible()
+{
+ notImplemented();
+ return false;
+}
+
+void ChromeClientBlackBerry::setStatusbarVisible(bool)
+{
+ notImplemented();
+}
+
+bool ChromeClientBlackBerry::statusbarVisible()
+{
+ notImplemented();
+ return false;
+}
+
+void ChromeClientBlackBerry::setScrollbarsVisible(bool)
+{
+ notImplemented();
+}
+
+bool ChromeClientBlackBerry::scrollbarsVisible()
+{
+ notImplemented();
+ return false;
+}
+
+void ChromeClientBlackBerry::setMenubarVisible(bool)
+{
+ notImplemented();
+}
+
+bool ChromeClientBlackBerry::menubarVisible()
+{
+ notImplemented();
+ return false;
+}
+
+void ChromeClientBlackBerry::setResizable(bool)
+{
+ notImplemented();
+}
+
+bool ChromeClientBlackBerry::canRunBeforeUnloadConfirmPanel()
+{
+ notImplemented();
+ return false;
+}
+
+bool ChromeClientBlackBerry::runBeforeUnloadConfirmPanel(const String& message, Frame*)
+{
+#if ENABLE_DRT
+ if (m_webPagePrivate->m_dumpRenderTree)
+ return m_webPagePrivate->m_dumpRenderTree->runBeforeUnloadConfirmPanel(message);
+#endif
+
+ notImplemented();
+ return false;
+}
+
+void ChromeClientBlackBerry::closeWindowSoon()
+{
+ m_webPagePrivate->m_client->scheduleCloseWindow();
+}
+
+void ChromeClientBlackBerry::setStatusbarText(const String& status)
+{
+ m_webPagePrivate->m_client->setStatus(status);
+
+#if ENABLE_DRT
+ if (m_webPagePrivate->m_dumpRenderTree)
+ m_webPagePrivate->m_dumpRenderTree->setStatusText(status);
+#endif
+}
+
+IntRect ChromeClientBlackBerry::windowResizerRect() const
+{
+ notImplemented();
+ return IntRect();
+}
+
+IntPoint ChromeClientBlackBerry::screenToWindow(const IntPoint& screenPos) const
+{
+ IntPoint windowPoint = m_webPagePrivate->m_client->window()->windowLocation();
+ windowPoint.move(-screenPos.x(), -screenPos.y());
+ return windowPoint;
+}
+
+IntRect ChromeClientBlackBerry::windowToScreen(const IntRect& windowRect) const
+{
+ IntRect windowPoint(windowRect);
+ IntPoint location(m_webPagePrivate->m_client->window()->windowLocation());
+ windowPoint.move(location.x(), location.y());
+ return windowPoint;
+}
+
+void ChromeClientBlackBerry::mouseDidMoveOverElement(const HitTestResult& result, unsigned int modifierFlags)
+{
+ notImplemented();
+}
+
+void ChromeClientBlackBerry::setToolTip(const String& tooltip, TextDirection)
+{
+ m_webPagePrivate->m_client->setToolTip(tooltip);
+}
+
+#if ENABLE(EVENT_MODE_METATAGS)
+void ChromeClientBlackBerry::didReceiveCursorEventMode(Frame* frame, CursorEventMode mode) const
+{
+ if (m_webPagePrivate->m_mainFrame != frame)
+ return;
+
+ m_webPagePrivate->didReceiveCursorEventMode(mode);
+}
+
+void ChromeClientBlackBerry::didReceiveTouchEventMode(Frame* frame, TouchEventMode mode) const
+{
+ if (m_webPagePrivate->m_mainFrame != frame)
+ return;
+
+ m_webPagePrivate->didReceiveTouchEventMode(mode);
+}
+#endif
+
+void ChromeClientBlackBerry::dispatchViewportPropertiesDidChange(const ViewportArguments& arguments) const
+{
+ m_webPagePrivate->dispatchViewportPropertiesDidChange(arguments);
+}
+
+void ChromeClientBlackBerry::print(Frame*)
+{
+ notImplemented();
+}
+
+void ChromeClientBlackBerry::exceededDatabaseQuota(Frame* frame, const String& name)
+{
+#if ENABLE(SQL_DATABASE)
+ Document* document = frame->document();
+ if (!document)
+ return;
+
+ SecurityOrigin* origin = document->securityOrigin();
+
+#if ENABLE_DRT
+ if (m_webPagePrivate->m_dumpRenderTree) {
+ m_webPagePrivate->m_dumpRenderTree->exceededDatabaseQuota(origin, name);
+ return;
+ }
+#endif
+
+ DatabaseTracker& tracker = DatabaseTracker::tracker();
+
+ unsigned long long totalUsage = tracker.totalDatabaseUsage();
+ unsigned long long originUsage = tracker.usageForOrigin(origin);
+
+ DatabaseDetails details = tracker.detailsForNameAndOrigin(name, origin);
+ unsigned long long estimatedSize = details.expectedUsage();
+ const String& nameStr = details.displayName();
+
+ String originStr = origin->databaseIdentifier();
+
+ unsigned long long quota = m_webPagePrivate->m_client->databaseQuota(originStr.characters(), originStr.length(),
+ nameStr.characters(), nameStr.length(), totalUsage, originUsage, estimatedSize);
+
+ tracker.setQuota(origin, quota);
+#endif
+}
+
+void ChromeClientBlackBerry::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation)
+{
+ if (!m_webPagePrivate->m_webSettings->isGeolocationEnabled()) {
+ geolocation->setIsAllowed(false);
+ return;
+ }
+ DOMWindow* window = frame->domWindow();
+ if (!window)
+ return;
+
+ CString latinOrigin = frameOrigin(frame);
+
+ m_webPagePrivate->m_client->requestGeolocationPermission(m_webPagePrivate->m_geolocationClient, geolocation, latinOrigin.data(), latinOrigin.length());
+}
+
+void ChromeClientBlackBerry::cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation* geolocation)
+{
+ m_webPagePrivate->m_client->cancelGeolocationPermission(m_webPagePrivate->m_geolocationClient, geolocation);
+}
+
+void ChromeClientBlackBerry::runOpenPanel(Frame*, PassRefPtr<FileChooser> chooser)
+{
+ SharedArray<WebString> initialFiles;
+ unsigned int initialFileSize = chooser->settings().selectedFiles.size();
+ if (initialFileSize > 0)
+ initialFiles.reset(new WebString[initialFileSize]);
+ for (unsigned i = 0; i < initialFileSize; ++i)
+ initialFiles[i] = chooser->settings().selectedFiles[i];
+
+ SharedArray<WebString> chosenFiles;
+ unsigned int chosenFileSize;
+
+ {
+ PageGroupLoadDeferrer deferrer(m_webPagePrivate->m_page, true);
+ TimerBase::fireTimersInNestedEventLoop();
+
+ // FIXME: Use chooser->settings().acceptMIMETypes instead of WebString() for the second parameter.
+ if (!m_webPagePrivate->m_client->chooseFilenames(chooser->settings().allowsMultipleFiles, WebString(), initialFiles, initialFileSize, chosenFiles, chosenFileSize))
+ return;
+ }
+
+ Vector<String> files(chosenFileSize);
+ for (unsigned i = 0; i < chosenFileSize; ++i)
+ files[i] = chosenFiles[i];
+ chooser->chooseFiles(files);
+}
+
+void ChromeClientBlackBerry::loadIconForFiles(const Vector<String>& filenames, FileIconLoader* loader)
+{
+ loader->notifyFinished(Icon::createIconForFiles(filenames));
+}
+
+void ChromeClientBlackBerry::setCursor(const Cursor&)
+{
+ notImplemented();
+}
+
+void ChromeClientBlackBerry::formStateDidChange(const Node* node)
+{
+ m_webPagePrivate->m_inputHandler->nodeTextChanged(node);
+}
+
+void ChromeClientBlackBerry::scrollbarsModeDidChange() const
+{
+ notImplemented();
+}
+
+void ChromeClientBlackBerry::contentsSizeChanged(Frame* frame, const IntSize& size) const
+{
+ if (frame != m_webPagePrivate->m_mainFrame)
+ return;
+
+ m_webPagePrivate->contentsSizeChanged(size);
+}
+
+void ChromeClientBlackBerry::invalidateWindow(const IntRect& updateRect, bool immediate)
+{
+ m_webPagePrivate->m_backingStore->d->repaint(updateRect, false /*contentChanged*/, immediate);
+}
+
+void ChromeClientBlackBerry::invalidateContentsAndWindow(const IntRect& updateRect, bool immediate)
+{
+ m_webPagePrivate->m_backingStore->d->repaint(updateRect, true /*contentChanged*/, immediate);
+}
+
+void ChromeClientBlackBerry::invalidateContentsForSlowScroll(const IntSize& delta, const IntRect& updateRect, bool immediate, const ScrollView* scrollView)
+{
+ if (scrollView != m_webPagePrivate->m_mainFrame->view())
+ invalidateContentsAndWindow(updateRect, true /*immediate*/);
+ else {
+ BackingStoreClient* backingStoreClientForFrame = m_webPagePrivate->backingStoreClientForFrame(m_webPagePrivate->m_mainFrame);
+ ASSERT(backingStoreClientForFrame);
+ backingStoreClientForFrame->checkOriginOfCurrentScrollOperation();
+
+ m_webPagePrivate->m_backingStore->d->slowScroll(delta, updateRect, immediate);
+ }
+}
+
+void ChromeClientBlackBerry::scroll(const IntSize& delta, const IntRect& scrollViewRect, const IntRect& clipRect)
+{
+ // FIXME: There's a chance the function is called indirectly by FrameView's dtor
+ // when the Frame's view() is null. We probably want to fix it in another way, but
+ // at this moment let's do a quick fix.
+ if (!m_webPagePrivate->m_mainFrame->view())
+ return;
+
+ BackingStoreClient* backingStoreClientForFrame = m_webPagePrivate->backingStoreClientForFrame(m_webPagePrivate->m_mainFrame);
+ ASSERT(backingStoreClientForFrame);
+ backingStoreClientForFrame->checkOriginOfCurrentScrollOperation();
+
+ m_webPagePrivate->m_backingStore->d->scroll(delta, scrollViewRect, clipRect);
+}
+
+void ChromeClientBlackBerry::scrollableAreasDidChange()
+{
+ typedef HashSet<ScrollableArea*> ScrollableAreaSet;
+ const ScrollableAreaSet* scrollableAreas = m_webPagePrivate->m_page->scrollableAreaSet();
+
+ bool hasAtLeastOneInRegionScrollableArea = false;
+ ScrollableAreaSet::iterator end = scrollableAreas->end();
+ for (ScrollableAreaSet::iterator it = scrollableAreas->begin(); it != end; ++it) {
+ if ((*it) != m_webPagePrivate->m_page->mainFrame()->view()) {
+ hasAtLeastOneInRegionScrollableArea = true;
+ break;
+ }
+ }
+
+ m_webPagePrivate->setHasInRegionScrollableAreas(hasAtLeastOneInRegionScrollableArea);
+}
+
+void ChromeClientBlackBerry::scrollRectIntoView(const IntRect&, const ScrollView*) const
+{
+ m_webPagePrivate->notifyTransformedScrollChanged();
+}
+
+bool ChromeClientBlackBerry::shouldInterruptJavaScript()
+{
+ TimerBase::fireTimersInNestedEventLoop();
+ return m_webPagePrivate->m_client->shouldInterruptJavaScript();
+}
+
+KeyboardUIMode ChromeClientBlackBerry::keyboardUIMode()
+{
+ bool tabsToLinks = true;
+
+#if ENABLE_DRT
+ if (m_webPagePrivate->m_dumpRenderTree)
+ tabsToLinks = DumpRenderTreeSupport::linksIncludedInFocusChain();
+#endif
+
+ return tabsToLinks ? KeyboardAccessTabsToLinks : KeyboardAccessDefault;
+}
+
+PlatformPageClient ChromeClientBlackBerry::platformPageClient() const
+{
+ return m_webPagePrivate;
+}
+
+#if ENABLE(TOUCH_EVENTS)
+void ChromeClientBlackBerry::needTouchEvents(bool value)
+{
+ m_webPagePrivate->setNeedTouchEvents(value);
+}
+#endif
+
+void ChromeClientBlackBerry::reachedMaxAppCacheSize(int64_t spaceNeeded)
+{
+ notImplemented();
+}
+
+void ChromeClientBlackBerry::layoutUpdated(Frame* frame) const
+{
+ if (frame != m_webPagePrivate->m_mainFrame)
+ return;
+
+ m_webPagePrivate->layoutFinished();
+}
+
+void ChromeClientBlackBerry::overflowExceedsContentsSize(Frame* frame) const
+{
+ if (frame != m_webPagePrivate->m_mainFrame)
+ return;
+
+#if DEBUG_OVERFLOW_DETECTION
+ BlackBerry::Platform::log(BlackBerry::Platform::LogLevelInfo, "ChromeClientBlackBerry::overflowExceedsContentsSize contents=%dx%d overflow=%dx%d",
+ frame->contentRenderer()->rightLayoutOverflow(),
+ frame->contentRenderer()->bottomLayoutOverflow(),
+ frame->contentRenderer()->rightAbsoluteVisibleOverflow(),
+ frame->contentRenderer()->bottomAbsoluteVisibleOverflow());
+#endif
+ m_webPagePrivate->overflowExceedsContentsSize();
+}
+
+void ChromeClientBlackBerry::didDiscoverFrameSet(Frame* frame) const
+{
+ if (frame != m_webPagePrivate->m_mainFrame)
+ return;
+
+ BlackBerry::Platform::log(BlackBerry::Platform::LogLevelInfo, "ChromeClientBlackBerry::didDiscoverFrameSet");
+ if (m_webPagePrivate->loadState() == WebPagePrivate::Committed) {
+ m_webPagePrivate->setShouldUseFixedDesktopMode(true);
+ m_webPagePrivate->zoomToInitialScaleOnLoad();
+ }
+}
+
+int ChromeClientBlackBerry::reflowWidth() const
+{
+ return m_webPagePrivate->reflowWidth();
+}
+
+void ChromeClientBlackBerry::chooseIconForFiles(const Vector<String>&, FileChooser*)
+{
+ notImplemented();
+}
+
+bool ChromeClientBlackBerry::supportsFullscreenForNode(const Node* node)
+{
+ return node->hasTagName(HTMLNames::videoTag);
+}
+
+void ChromeClientBlackBerry::enterFullscreenForNode(Node* node)
+{
+ if (!supportsFullscreenForNode(node))
+ return;
+
+ m_webPagePrivate->enterFullscreenForNode(node);
+}
+
+void ChromeClientBlackBerry::exitFullscreenForNode(Node* node)
+{
+ m_webPagePrivate->exitFullscreenForNode(node);
+}
+
+#if ENABLE(WEBGL)
+void ChromeClientBlackBerry::requestWebGLPermission(Frame* frame)
+{
+ if (frame) {
+ CString latinOrigin = frameOrigin(frame);
+ m_webPagePrivate->m_client->requestWebGLPermission(latinOrigin.data());
+ }
+}
+#endif
+
+#if ENABLE(SVG)
+void ChromeClientBlackBerry::didSetSVGZoomAndPan(Frame* frame, unsigned short zoomAndPan)
+{
+ // For top-level SVG document, there is no viewport tag, we use viewport's user-scalable
+ // to enable/disable zoom when top-level SVG document's zoomAndPan changed. Because there is no viewport
+ // tag, other fields with default value in ViewportArguments are ok.
+ if (frame == m_webPagePrivate->m_page->mainFrame()) {
+ ViewportArguments arguments;
+ switch (zoomAndPan) {
+ case SVGZoomAndPan::SVG_ZOOMANDPAN_DISABLE:
+ arguments.userScalable = 0;
+ break;
+ case SVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY:
+ arguments.userScalable = 1;
+ break;
+ default:
+ return;
+ }
+ didReceiveViewportArguments(frame, arguments);
+ }
+}
+#endif
+
+#if ENABLE(NOTIFICATIONS)
+NotificationPresenter* ChromeClientBlackBerry::notificationPresenter() const
+{
+ return WebKit::NotificationPresenterImpl::instance();
+}
+#endif
+
+#if USE(ACCELERATED_COMPOSITING)
+void ChromeClientBlackBerry::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer)
+{
+ // If the graphicsLayer parameter is 0, WebCore is actually
+ // trying to remove a previously attached layer.
+ m_webPagePrivate->setRootLayerWebKitThread(frame, graphicsLayer ? graphicsLayer->platformLayer() : 0);
+}
+
+void ChromeClientBlackBerry::setNeedsOneShotDrawingSynchronization()
+{
+ m_webPagePrivate->setNeedsOneShotDrawingSynchronization();
+}
+
+void ChromeClientBlackBerry::scheduleCompositingLayerSync()
+{
+ m_webPagePrivate->scheduleRootLayerCommit();
+}
+
+bool ChromeClientBlackBerry::allowsAcceleratedCompositing() const
+{
+ return true;
+}
+#endif
+
+void* ChromeClientBlackBerry::platformWindow() const
+{
+ return m_webPagePrivate->m_client->window();
+}
+
+void* ChromeClientBlackBerry::platformCompositingWindow() const
+{
+ return m_webPagePrivate->m_client->compositingWindow();
+}
+
+} // namespace WebCore
diff --git a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h
new file mode 100644
index 000000000..76a715abe
--- /dev/null
+++ b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2009, 2010, 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 ChromeClientBlackBerry_h
+#define ChromeClientBlackBerry_h
+
+#include "ChromeClient.h"
+
+namespace BlackBerry {
+namespace WebKit {
+class WebPagePrivate;
+}
+}
+
+namespace WebCore {
+
+class ChromeClientBlackBerry : public ChromeClient {
+public:
+ ChromeClientBlackBerry(BlackBerry::WebKit::WebPagePrivate*);
+
+ virtual void chromeDestroyed();
+ virtual void* webView() const { return 0; };
+ virtual void setWindowRect(const FloatRect&);
+ virtual FloatRect windowRect();
+ virtual FloatRect pageRect();
+ virtual float scaleFactor();
+ virtual void focus();
+ virtual void unfocus();
+ virtual bool canTakeFocus(FocusDirection);
+ virtual void takeFocus(FocusDirection);
+ virtual void focusedNodeChanged(Node*);
+ virtual void focusedFrameChanged(Frame*);
+ virtual bool shouldForceDocumentStyleSelectorUpdate();
+ virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&);
+ virtual void show();
+ virtual bool canRunModal();
+ virtual void runModal();
+ virtual void setToolbarsVisible(bool);
+ virtual bool toolbarsVisible();
+ virtual void setStatusbarVisible(bool);
+ virtual bool statusbarVisible();
+ virtual void setScrollbarsVisible(bool);
+ virtual bool scrollbarsVisible();
+ virtual void setMenubarVisible(bool);
+ virtual bool menubarVisible();
+ virtual void setResizable(bool);
+ virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned int lineNumber, const String& sourceID);
+ virtual bool canRunBeforeUnloadConfirmPanel();
+ virtual bool runBeforeUnloadConfirmPanel(const String&, Frame*);
+ virtual void closeWindowSoon();
+ virtual void runJavaScriptAlert(Frame*, const String&);
+ virtual bool runJavaScriptConfirm(Frame*, const String&);
+ virtual bool runJavaScriptPrompt(Frame*, const String&, const String&, String&);
+ virtual void setStatusbarText(const String&);
+ virtual bool shouldInterruptJavaScript();
+ virtual KeyboardUIMode keyboardUIMode();
+ virtual IntRect windowResizerRect() const;
+ virtual void invalidateWindow(const IntRect&, bool);
+ virtual void invalidateContentsAndWindow(const IntRect&, bool);
+ virtual void invalidateContentsForSlowScroll(const IntSize&, const IntRect&, bool, const ScrollView*);
+ virtual void scroll(const IntSize&, const IntRect&, const IntRect&);
+ virtual void scrollableAreasDidChange();
+ virtual IntPoint screenToWindow(const IntPoint&) const;
+ virtual IntRect windowToScreen(const IntRect&) const;
+ virtual void contentsSizeChanged(Frame*, const IntSize&) const;
+ virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const;
+ virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned int);
+ virtual void setToolTip(const String&, TextDirection);
+#if ENABLE(EVENT_MODE_METATAGS)
+ virtual void didReceiveCursorEventMode(Frame*, CursorEventMode) const;
+ virtual void didReceiveTouchEventMode(Frame*, TouchEventMode) const;
+#endif
+ virtual void dispatchViewportPropertiesDidChange(const ViewportArguments&) const;
+ virtual bool shouldRubberBandInDirection(ScrollDirection) const { return true; }
+ virtual void numWheelEventHandlersChanged(unsigned) { }
+ virtual void print(Frame*);
+ virtual void exceededDatabaseQuota(Frame*, const String&);
+ virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*);
+ virtual void cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*);
+ virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
+ virtual void loadIconForFiles(const Vector<String>&, FileIconLoader*);
+ virtual void setCursor(const Cursor&);
+ virtual void setCursorHiddenUntilMouseMoves(bool) { }
+ virtual void formStateDidChange(const Node*);
+ virtual void scrollbarsModeDidChange() const;
+ virtual PlatformPageClient platformPageClient() const;
+
+#if ENABLE(TOUCH_EVENTS)
+ virtual void needTouchEvents(bool);
+#endif
+
+#if ENABLE(INPUT_COLOR)
+ void openColorChooser(ColorChooser*, const Color&) { }
+ void cleanupColorChooser(ColorChooser*) { }
+ void setSelectedColorInColorChooser(ColorChooser*, const Color&) { }
+#endif
+
+ virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
+ virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t) { }
+
+ virtual void layoutUpdated(Frame*) const;
+ virtual void overflowExceedsContentsSize(Frame*) const;
+ virtual void didDiscoverFrameSet(Frame*) const;
+
+ virtual int reflowWidth() const;
+
+ virtual void chooseIconForFiles(const Vector<String>&, FileChooser*);
+
+ virtual bool supportsFullscreenForNode(const Node*);
+ virtual void enterFullscreenForNode(Node*);
+ virtual void exitFullscreenForNode(Node*);
+#if ENABLE(WEBGL)
+ virtual void requestWebGLPermission(Frame*);
+#endif
+
+#if ENABLE(NOTIFICATIONS)
+ virtual NotificationPresenter* notificationPresenter() const;
+#endif
+
+#if ENABLE(SVG)
+ virtual void didSetSVGZoomAndPan(Frame*, unsigned short zoomAndPan);
+#endif
+ virtual bool selectItemWritingDirectionIsNatural();
+ virtual bool selectItemAlignmentFollowsMenuWritingDirection();
+ virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const;
+ virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const;
+ virtual void showContextMenu() { }
+
+#if USE(ACCELERATED_COMPOSITING)
+ virtual void attachRootGraphicsLayer(Frame*, GraphicsLayer*);
+ virtual void setNeedsOneShotDrawingSynchronization();
+ virtual void scheduleCompositingLayerSync();
+ virtual bool allowsAcceleratedCompositing() const;
+#endif
+
+ virtual void* platformWindow() const;
+ virtual void* platformCompositingWindow() const;
+
+ BlackBerry::WebKit::WebPagePrivate* webPagePrivate() const { return m_webPagePrivate; }
+
+private:
+ BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate;
+};
+
+} // WebCore
+
+#endif // ChromeClientBlackBerry_h
diff --git a/Source/WebKit/blackberry/WebCoreSupport/ClientExtension.cpp b/Source/WebKit/blackberry/WebCoreSupport/ClientExtension.cpp
new file mode 100644
index 000000000..d3d7b62b9
--- /dev/null
+++ b/Source/WebKit/blackberry/WebCoreSupport/ClientExtension.cpp
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2010, 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 "ClientExtension.h"
+
+#include "Frame.h"
+#include "WebPageClient.h"
+#include <JavaScriptCore/API/JSCallbackObject.h>
+#include <JavaScriptCore/JSObjectRef.h>
+#include <JavaScriptCore/JSStringRef.h>
+#include <JavaScriptCore/JSValueRef.h>
+#include <JavaScriptCore/JavaScript.h>
+#include <string>
+
+using namespace WebCore;
+using namespace BlackBerry::WebKit;
+using namespace std;
+
+static JSValueRef clientExtensionMethod(
+ JSContextRef ctx, JSObjectRef functionObject, JSObjectRef thisObject,
+ size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ JSValueRef jsRetVal = JSValueMakeUndefined(ctx);
+ if (argumentCount <= 0)
+ return jsRetVal;
+
+ char** strArgs = new char*[argumentCount];
+ for (unsigned i = 0; i < argumentCount; ++i) {
+ JSStringRef string = JSValueToStringCopy(ctx, arguments[i], 0);
+ size_t sizeUTF8 = JSStringGetMaximumUTF8CStringSize(string);
+ strArgs[i] = new char[sizeUTF8];
+ JSStringGetUTF8CString(string, strArgs[i], sizeUTF8);
+ JSStringRelease(string);
+ }
+
+ WebPageClient* client = reinterpret_cast<WebPageClient*>(JSObjectGetPrivate(thisObject));
+ string retVal = client->invokeClientJavaScriptCallback(strArgs, argumentCount).utf8();
+ if (!retVal.empty())
+ jsRetVal = JSValueMakeString(ctx, JSStringCreateWithUTF8CString(retVal.c_str()));
+
+ for (unsigned i = 0; i < argumentCount; ++i)
+ delete[] strArgs[i];
+ delete[] strArgs;
+
+ return jsRetVal;
+}
+
+static void clientExtensionInitialize(JSContextRef context, JSObjectRef object)
+{
+ UNUSED_PARAM(context);
+ UNUSED_PARAM(object);
+}
+
+static void clientExtensionFinalize(JSObjectRef object)
+{
+ UNUSED_PARAM(object);
+}
+
+static JSStaticFunction clientExtensionStaticFunctions[] = {
+ { "callExtensionMethod", clientExtensionMethod, kJSPropertyAttributeNone },
+ { 0, 0, 0 }
+};
+
+static JSStaticValue clientExtensionStaticValues[] = {
+ { 0, 0, 0, 0 }
+};
+
+// FIXME: Revisit the creation of this class and make sure this is the best way to approach it.
+void attachExtensionObjectToFrame(Frame* frame, WebPageClient* client)
+{
+ JSC::JSLock lock(JSC::SilenceAssertionsOnly);
+
+ JSDOMWindow* window = frame->script()->windowShell(mainThreadNormalWorld())->window();
+
+ JSC::ExecState* exec = window->globalExec();
+ JSContextRef scriptCtx = toRef(exec);
+
+ JSClassDefinition definition = kJSClassDefinitionEmpty;
+ definition.staticValues = clientExtensionStaticValues;
+ definition.staticFunctions = clientExtensionStaticFunctions;
+ definition.initialize = clientExtensionInitialize;
+ definition.finalize = clientExtensionFinalize;
+ JSClassRef clientClass = JSClassCreate(&definition);
+
+ JSObjectRef clientClassObject = JSObjectMake(scriptCtx, clientClass, 0);
+ JSObjectSetPrivate(clientClassObject, reinterpret_cast<void*>(client));
+
+ JSC::UString name("qnx");
+
+ JSC::PutPropertySlot slot;
+ window->put(window, exec, JSC::Identifier(exec, name), toJS(clientClassObject), slot);
+
+ JSClassRelease(clientClass);
+}
diff --git a/Source/WebKit/blackberry/WebCoreSupport/ClientExtension.h b/Source/WebKit/blackberry/WebCoreSupport/ClientExtension.h
new file mode 100644
index 000000000..3a75616a8
--- /dev/null
+++ b/Source/WebKit/blackberry/WebCoreSupport/ClientExtension.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2010, 2011 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 ClientExtension_h
+#define ClientExtension_h
+
+namespace WebCore {
+class Frame;
+}
+
+namespace BlackBerry {
+namespace WebKit {
+class WebPageClient;
+}
+}
+
+void attachExtensionObjectToFrame(WebCore::Frame*, BlackBerry::WebKit::WebPageClient*);
+
+#endif // ClientExtension_h
diff --git a/Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.cpp
new file mode 100644
index 000000000..93f24ff11
--- /dev/null
+++ b/Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.cpp
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2010, 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 "DeviceMotionClientBlackBerry.h"
+
+#include "DeviceMotionController.h"
+#include "DeviceMotionData.h"
+#include "WebPage_p.h"
+#include <BlackBerryPlatformDeviceMotionTracker.h>
+
+using namespace WebCore;
+
+DeviceMotionClientBlackBerry::DeviceMotionClientBlackBerry(BlackBerry::WebKit::WebPagePrivate* webPagePrivate)
+ : m_webPagePrivate(webPagePrivate)
+ , m_tracker(0)
+ , m_controller(0)
+ , m_lastEventTime(0)
+{
+}
+
+DeviceMotionClientBlackBerry::~DeviceMotionClientBlackBerry()
+{
+ if (m_tracker)
+ m_tracker->destroy();
+}
+
+void DeviceMotionClientBlackBerry::setController(DeviceMotionController* controller)
+{
+ m_controller = controller;
+}
+
+void DeviceMotionClientBlackBerry::deviceMotionControllerDestroyed()
+{
+ delete this;
+}
+
+void DeviceMotionClientBlackBerry::startUpdating()
+{
+ if (m_tracker)
+ m_tracker->resume();
+ else
+ m_tracker = BlackBerry::Platform::DeviceMotionTracker::create(this);
+}
+
+void DeviceMotionClientBlackBerry::stopUpdating()
+{
+ if (m_tracker)
+ m_tracker->suspend();
+}
+
+DeviceMotionData* DeviceMotionClientBlackBerry::currentDeviceMotion() const
+{
+ return m_currentMotion.get();
+}
+
+void DeviceMotionClientBlackBerry::onMotion(const BlackBerry::Platform::DeviceMotionEvent* event)
+{
+ RefPtr<DeviceMotionData::Acceleration> accel = DeviceMotionData::Acceleration::create(
+ true, event->x, true, event->y, true, event->z);
+
+ double now = WTF::currentTimeMS();
+ m_currentMotion = DeviceMotionData::create(0, accel, 0, m_lastEventTime, m_lastEventTime - now);
+ m_lastEventTime = now;
+
+ if (!m_controller)
+ return;
+
+ m_controller->didChangeDeviceMotion(currentDeviceMotion());
+}
diff --git a/Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.h
new file mode 100644
index 000000000..76ac42966
--- /dev/null
+++ b/Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2010, 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 DeviceMotionClientBlackBerry_h
+#define DeviceMotionClientBlackBerry_h
+
+#include "DeviceMotionClient.h"
+#include "DeviceMotionData.h"
+
+#include <BlackBerryPlatformDeviceMotionTrackerListener.h>
+
+namespace BlackBerry {
+namespace WebKit {
+class WebPagePrivate;
+}
+}
+
+namespace BlackBerry {
+namespace Platform {
+class DeviceMotionTracker;
+}
+}
+
+namespace WebCore {
+
+class DeviceMotionClientBlackBerry : public DeviceMotionClient, public BlackBerry::Platform::DeviceMotionTrackerListener {
+public:
+ DeviceMotionClientBlackBerry(BlackBerry::WebKit::WebPagePrivate*);
+ ~DeviceMotionClientBlackBerry();
+
+ virtual void setController(DeviceMotionController*);
+ virtual void startUpdating();
+ virtual void stopUpdating();
+ virtual DeviceMotionData* currentDeviceMotion() const;
+ virtual void deviceMotionControllerDestroyed();
+ virtual void onMotion(const BlackBerry::Platform::DeviceMotionEvent*);
+
+private:
+ BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate;
+ BlackBerry::Platform::DeviceMotionTracker* m_tracker;
+ DeviceMotionController* m_controller;
+ RefPtr<DeviceMotionData> m_currentMotion;
+ double m_lastEventTime;
+};
+}
+
+#endif // DeviceMotionClientBlackBerry_h
diff --git a/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp
new file mode 100644
index 000000000..2970a4f5b
--- /dev/null
+++ b/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2010, 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 "DeviceOrientationClientBlackBerry.h"
+
+#include "DeviceOrientationController.h"
+#include "WebPage_p.h"
+#include <BlackBerryPlatformDeviceOrientationTracker.h>
+
+using namespace WebCore;
+
+DeviceOrientationClientBlackBerry::DeviceOrientationClientBlackBerry(BlackBerry::WebKit::WebPagePrivate* webPagePrivate)
+ : m_webPagePrivate(webPagePrivate)
+ , m_tracker(0)
+ , m_controller(0)
+{
+}
+
+DeviceOrientationClientBlackBerry::~DeviceOrientationClientBlackBerry()
+{
+ if (m_tracker)
+ m_tracker->destroy();
+}
+
+void DeviceOrientationClientBlackBerry::setController(DeviceOrientationController* controller)
+{
+ m_controller = controller;
+}
+
+void DeviceOrientationClientBlackBerry::deviceOrientationControllerDestroyed()
+{
+ delete this;
+}
+
+void DeviceOrientationClientBlackBerry::startUpdating()
+{
+ if (m_tracker)
+ m_tracker->resume();
+ else
+ m_tracker = BlackBerry::Platform::DeviceOrientationTracker::create(this);
+}
+
+void DeviceOrientationClientBlackBerry::stopUpdating()
+{
+ if (m_tracker)
+ m_tracker->suspend();
+}
+
+DeviceOrientation* DeviceOrientationClientBlackBerry::lastOrientation() const
+{
+ return m_currentOrientation.get();
+}
+
+void DeviceOrientationClientBlackBerry::onOrientation(const BlackBerry::Platform::DeviceOrientationEvent* event)
+{
+ m_currentOrientation = DeviceOrientation::create(true, event->alpha, true, event->beta, true, event->gamma);
+ if (!m_controller)
+ return;
+
+ m_controller->didChangeDeviceOrientation(lastOrientation());
+}
diff --git a/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.h
new file mode 100644
index 000000000..7610fb1d4
--- /dev/null
+++ b/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2010, 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 DeviceOrientationClientBlackBerry_h
+#define DeviceOrientationClientBlackBerry_h
+
+#include "DeviceOrientation.h"
+#include "DeviceOrientationClient.h"
+
+#include <BlackBerryPlatformDeviceOrientationTrackerListener.h>
+#include <wtf/RefPtr.h>
+
+namespace BlackBerry {
+namespace WebKit {
+class WebPagePrivate;
+}
+}
+
+namespace BlackBerry {
+namespace Platform {
+class DeviceOrientationTracker;
+}
+}
+
+namespace WebCore {
+
+class DeviceOrientationClientBlackBerry : public DeviceOrientationClient, public BlackBerry::Platform::DeviceOrientationTrackerListener {
+public:
+ DeviceOrientationClientBlackBerry(BlackBerry::WebKit::WebPagePrivate*);
+ virtual ~DeviceOrientationClientBlackBerry();
+
+ virtual void setController(DeviceOrientationController*);
+ virtual void startUpdating();
+ virtual void stopUpdating();
+ virtual DeviceOrientation* lastOrientation() const;
+ virtual void deviceOrientationControllerDestroyed();
+ virtual void onOrientation(const BlackBerry::Platform::DeviceOrientationEvent*);
+
+private:
+ BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate;
+ BlackBerry::Platform::DeviceOrientationTracker* m_tracker;
+ DeviceOrientationController* m_controller;
+ RefPtr<DeviceOrientation> m_currentOrientation;
+};
+}
+
+#endif // DeviceOrientationClientBlackBerry_h
diff --git a/Source/WebKit/blackberry/WebCoreSupport/FrameNetworkingContextBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/FrameNetworkingContextBlackBerry.cpp
new file mode 100644
index 000000000..f6cdbceb7
--- /dev/null
+++ b/Source/WebKit/blackberry/WebCoreSupport/FrameNetworkingContextBlackBerry.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2010, 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 "FrameNetworkingContextBlackBerry.h"
+
+namespace WebCore {
+
+FrameNetworkingContextBlackBerry::FrameNetworkingContextBlackBerry(Frame* frame)
+ : FrameNetworkingContext(frame)
+{
+}
+
+PassRefPtr<FrameNetworkingContextBlackBerry> FrameNetworkingContextBlackBerry::create(Frame* frame)
+{
+ return adoptRef(new FrameNetworkingContextBlackBerry(frame));
+}
+
+}
diff --git a/Source/WebKit/blackberry/WebCoreSupport/FrameNetworkingContextBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/FrameNetworkingContextBlackBerry.h
new file mode 100644
index 000000000..408b1ee0d
--- /dev/null
+++ b/Source/WebKit/blackberry/WebCoreSupport/FrameNetworkingContextBlackBerry.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2010, 2011 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 FrameNetworkingContextBlackBerry_h
+#define FrameNetworkingContextBlackBerry_h
+
+#include "FrameNetworkingContext.h"
+
+namespace WebCore {
+
+class FrameNetworkingContextBlackBerry : public FrameNetworkingContext {
+public:
+ static PassRefPtr<FrameNetworkingContextBlackBerry> create(Frame*);
+ using FrameNetworkingContext::frame;
+
+private:
+ FrameNetworkingContextBlackBerry(Frame*);
+};
+
+}
+
+#endif // FrameNetworkingContextBlackBerry_h
diff --git a/Source/WebKit/blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.cpp
new file mode 100644
index 000000000..fd59f2e41
--- /dev/null
+++ b/Source/WebKit/blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.cpp
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2010, 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 "GeolocationControllerClientBlackBerry.h"
+
+#include "Chrome.h"
+#include "Geolocation.h"
+#include "GeolocationController.h"
+#include "GeolocationError.h"
+#include "Page.h"
+#include "WebPage_p.h"
+
+using namespace WebCore;
+
+GeolocationControllerClientBlackBerry::GeolocationControllerClientBlackBerry(BlackBerry::WebKit::WebPagePrivate* webPagePrivate)
+ : m_webPagePrivate(webPagePrivate)
+ , m_tracker(0)
+ , m_accuracy(false)
+{
+}
+
+void GeolocationControllerClientBlackBerry::geolocationDestroyed()
+{
+ if (m_tracker)
+ m_tracker->destroy();
+ delete this;
+}
+
+void GeolocationControllerClientBlackBerry::startUpdating()
+{
+ if (m_tracker)
+ m_tracker->resume();
+ else
+ m_tracker = BlackBerry::Platform::GeoTracker::create(this, 0, m_accuracy, -1, -1);
+}
+
+void GeolocationControllerClientBlackBerry::stopUpdating()
+{
+ if (m_tracker)
+ m_tracker->suspend();
+}
+
+GeolocationPosition* GeolocationControllerClientBlackBerry::lastPosition()
+{
+ return m_lastPosition.get();
+}
+
+void GeolocationControllerClientBlackBerry::requestPermission(Geolocation* location)
+{
+ Frame* frame = location->frame();
+ if (!frame)
+ return;
+ m_webPagePrivate->m_page->chrome()->requestGeolocationPermissionForFrame(frame, location);
+}
+
+void GeolocationControllerClientBlackBerry::cancelPermissionRequest(Geolocation* location)
+{
+ Frame* frame = location->frame();
+ if (!frame)
+ return;
+ m_webPagePrivate->m_page->chrome()->cancelGeolocationPermissionRequestForFrame(frame, location);
+}
+
+void GeolocationControllerClientBlackBerry::onLocationUpdate(double timestamp, double latitude, double longitude, double accuracy, double altitude, bool altitudeValid,
+ double altitudeAccuracy, bool altitudeAccuracyValid, double speed, bool speedValid, double heading, bool headingValid)
+{
+ m_lastPosition = GeolocationPosition::create(timestamp, latitude, longitude, accuracy, altitudeValid, altitude, altitudeAccuracyValid,
+ altitudeAccuracy, headingValid, heading, speedValid, speed);
+ m_webPagePrivate->m_page->geolocationController()->positionChanged(m_lastPosition.get());
+}
+
+void GeolocationControllerClientBlackBerry::onLocationError(const char* errorStr)
+{
+ RefPtr<GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, String::fromUTF8(errorStr));
+ m_webPagePrivate->m_page->geolocationController()->errorOccurred(error.get());
+}
+
+void GeolocationControllerClientBlackBerry::onPermission(void* context, bool isAllowed)
+{
+ Geolocation* position = static_cast<Geolocation*>(context);
+ position->setIsAllowed(isAllowed);
+}
+
+void GeolocationControllerClientBlackBerry::setEnableHighAccuracy(bool newAccuracy)
+{
+ if (m_accuracy == newAccuracy)
+ return;
+ if (m_tracker) {
+ m_tracker->destroy();
+ m_tracker = BlackBerry::Platform::GeoTracker::create(this, 0, newAccuracy, -1, -1);
+ }
+}
+
diff --git a/Source/WebKit/blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.h
new file mode 100644
index 000000000..ea634bb97
--- /dev/null
+++ b/Source/WebKit/blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2010, 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 GeolocationControllerClientBlackBerry_h
+#define GeolocationControllerClientBlackBerry_h
+
+#include <BlackBerryPlatformGeoTracker.h>
+#include <BlackBerryPlatformGeoTrackerListener.h>
+#include <GeolocationClient.h>
+#include <GeolocationPosition.h>
+
+namespace BlackBerry {
+namespace WebKit {
+class WebPagePrivate;
+}
+}
+
+namespace WebCore {
+
+class GeolocationControllerClientBlackBerry : public GeolocationClient, public BlackBerry::Platform::GeoTrackerListener {
+public:
+ GeolocationControllerClientBlackBerry(BlackBerry::WebKit::WebPagePrivate*);
+
+ virtual void geolocationDestroyed();
+ virtual void startUpdating();
+ virtual void stopUpdating();
+ virtual GeolocationPosition* lastPosition();
+ virtual void setEnableHighAccuracy(bool);
+ virtual void requestPermission(Geolocation*);
+ virtual void cancelPermissionRequest(Geolocation*);
+
+ virtual void onLocationUpdate(double timestamp, double latitude, double longitude, double accuracy, double altitude, bool altitudeValid, double altitudeAccuracy,
+ bool altitudeAccuracyValid, double speed, bool speedValid, double heading, bool headingValid);
+ virtual void onLocationError(const char* error);
+ virtual void onPermission(void* context, bool isAllowed);
+ BlackBerry::Platform::GeoTracker* tracker() const { return m_tracker; }
+
+private:
+ BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate;
+ BlackBerry::Platform::GeoTracker* m_tracker;
+ RefPtr<GeolocationPosition> m_lastPosition;
+ bool m_accuracy;
+};
+}
+
+#endif // GeolocationControllerClientBlackBerry_h
diff --git a/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.cpp
new file mode 100644
index 000000000..174de15b7
--- /dev/null
+++ b/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.cpp
@@ -0,0 +1,88 @@
+/*
+ * 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 "IconDatabaseClientBlackBerry.h"
+
+#include "IconDatabase.h"
+#include "WebSettings.h"
+#include "WebString.h"
+
+namespace WebCore {
+
+IconDatabaseClientBlackBerry* IconDatabaseClientBlackBerry::getInstance()
+{
+ static IconDatabaseClientBlackBerry* instance = 0;
+ if (!instance)
+ instance = new IconDatabaseClientBlackBerry();
+ return instance;
+}
+
+bool IconDatabaseClientBlackBerry::initIconDatabase(const BlackBerry::WebKit::WebSettings* settings)
+{
+ bool enable = !settings->isPrivateBrowsingEnabled() && settings->isDatabasesEnabled();
+ iconDatabase().setEnabled(enable);
+ if (!enable) {
+ m_initState = NotInitialized;
+ return false;
+ }
+
+ if (m_initState == InitializeFailed)
+ return false;
+
+ if (m_initState == InitializeSucceeded)
+ return true;
+
+ iconDatabase().setClient(this);
+
+ BlackBerry::WebKit::WebString path = settings->databasePath();
+
+ if (path.isEmpty())
+ path = settings->localStoragePath();
+
+ m_initState = iconDatabase().open(path, IconDatabase::defaultDatabaseFilename()) ? InitializeSucceeded : InitializeFailed;
+
+ return m_initState == InitializeSucceeded;
+}
+
+bool IconDatabaseClientBlackBerry::performImport()
+{
+ return true;
+}
+
+void IconDatabaseClientBlackBerry::didRemoveAllIcons()
+{
+}
+
+void IconDatabaseClientBlackBerry::didImportIconURLForPageURL(const String&)
+{
+}
+
+void IconDatabaseClientBlackBerry::didImportIconDataForPageURL(const String&)
+{
+}
+
+void IconDatabaseClientBlackBerry::didChangeIconForPageURL(const String&)
+{
+}
+
+void IconDatabaseClientBlackBerry::didFinishURLImport()
+{
+}
+
+} // namespace WebCore
diff --git a/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.h
new file mode 100644
index 000000000..c72a450bc
--- /dev/null
+++ b/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.h
@@ -0,0 +1,54 @@
+/*
+ * 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 IconDatabaseClientBlackBerry_h
+#define IconDatabaseClientBlackBerry_h
+
+#include "IconDatabaseClient.h"
+
+namespace BlackBerry {
+namespace WebKit {
+class WebSettings;
+}
+}
+
+namespace WebCore {
+
+class IconDatabaseClientBlackBerry : public IconDatabaseClient {
+public:
+ static IconDatabaseClientBlackBerry* getInstance();
+ bool initIconDatabase(const BlackBerry::WebKit::WebSettings*);
+
+ virtual bool performImport();
+ virtual void didRemoveAllIcons();
+ virtual void didImportIconURLForPageURL(const String&);
+ virtual void didImportIconDataForPageURL(const String&);
+ virtual void didChangeIconForPageURL(const String&);
+ virtual void didFinishURLImport();
+
+private:
+ IconDatabaseClientBlackBerry()
+ : m_initState(NotInitialized)
+ {
+ }
+ enum { NotInitialized, InitializeSucceeded, InitializeFailed } m_initState;
+};
+
+}
+
+#endif
diff --git a/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp
new file mode 100644
index 000000000..73f887f30
--- /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 000000000..f5cca1e87
--- /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 <wtf/HashMap.h>
+
+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<String, String> SettingsMap;
+ OwnPtr<SettingsMap> m_inspectorSettingsMap;
+};
+
+} // namespace WebCore
+
+#endif // InspectorClientBlackBerry_h