[BlackBerry] Adapt to Platform API changes in string handling
authorstaikos@webkit.org <staikos@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Oct 2012 17:31:38 +0000 (17:31 +0000)
committerstaikos@webkit.org <staikos@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Oct 2012 17:31:38 +0000 (17:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=99248

Reviewed by Yong Li.

Convert usage of WebString, char* and std::string to BlackBerry::Platform::String.

Source/WebCore:

* html/track/TextTrack.cpp:
(WebCore::TextTrack::TextTrack): Fix the build for BlackBerry.
* page/blackberry/SettingsBlackBerry.cpp:
(WebCore):
(WebCore::Settings::initializeDefaultFontFamilies):
* platform/blackberry/LocalizedStringsBlackBerry.cpp:
* platform/blackberry/MIMETypeRegistryBlackBerry.cpp:
(WebCore::MIMETypeRegistry::getMIMETypeForExtension):
(WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
* platform/blackberry/PasteboardBlackBerry.cpp:
(WebCore::Pasteboard::writeSelection):
(WebCore::Pasteboard::writeURL):
(WebCore::Pasteboard::writePlainText):
(WebCore::Pasteboard::plainText):
(WebCore::Pasteboard::documentFragment):
* platform/blackberry/ReadOnlyLatin1String.h: Removed.
* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
(WebCore::MediaPlayerPrivate::getSupportedTypes):
(WebCore::MediaPlayerPrivate::supportsType):
(WebCore::MediaPlayerPrivate::setCertificatePath):
(WebCore::MediaPlayerPrivate::load):
(WebCore::generateProtectionSpaceFromMMRAuthChallenge):
(WebCore::MediaPlayerPrivate::onAuthenticationNeeded):
(WebCore::MediaPlayerPrivate::onAuthenticationAccepted):
(WebCore::MediaPlayerPrivate::lookupMediaStream):
* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h:
(MediaPlayerPrivate):
(WebCore::MediaPlayerPrivate::engineDescription):
* platform/network/blackberry/DNSBlackBerry.cpp:
(WebCore::prefetchDNS):
* platform/network/blackberry/NetworkJob.cpp:
(WebCore::NetworkJob::initialize):
(WebCore::NetworkJob::notifyStatusReceived):
(WebCore::NetworkJob::notifyHeadersReceived):
(WebCore::NetworkJob::handleNotifyClose):
(WebCore::NetworkJob::sendRequestWithCredentials):
* platform/network/blackberry/NetworkJob.h:
(NetworkJob):
* platform/network/blackberry/NetworkManager.cpp:
(WebCore::NetworkManager::startJob):
* platform/network/blackberry/ResourceRequestBlackBerry.cpp:
(WebCore::ResourceRequest::initializePlatformRequest):
* platform/network/blackberry/SocketStreamHandleBlackBerry.cpp:
(WebCore::SocketStreamHandle::SocketStreamHandle):
* platform/text/blackberry/StringBlackBerry.cpp:
(WTF::String::String):
(WTF::String::operator BlackBerry::Platform::String):
* platform/text/blackberry/TextBreakIteratorInternalICUBlackBerry.cpp:

Source/WebKit:

* PlatformBlackBerry.cmake:

Source/WebKit/blackberry:

* Api/BlackBerryGlobal.cpp:
(BlackBerry::WebKit::clearAppCache):
(BlackBerry::WebKit::clearDatabase):
* Api/BlackBerryGlobal.h:
(Platform):
(WebKit):
* Api/JavaScriptVariant.cpp:
(BlackBerry::WebKit::JSValueRefToBlackBerryJavaScriptVariant):
(BlackBerry::WebKit::BlackBerryJavaScriptVariantToJSValueRef):
(BlackBerry::WebKit::JavaScriptVariant::JavaScriptVariant):
(WebKit):
(BlackBerry::WebKit::JavaScriptVariant::~JavaScriptVariant):
(BlackBerry::WebKit::JavaScriptVariant::setType):
(BlackBerry::WebKit::JavaScriptVariant::setString):
(BlackBerry::WebKit::JavaScriptVariant::stringValue):
* Api/JavaScriptVariant.h:
* Api/WebAnimation.cpp:
(BlackBerry::WebKit::WebAnimation::fadeAnimation):
(BlackBerry::WebKit::WebAnimation::name):
* Api/WebAnimation.h:
* Api/WebCookieJar.cpp:
(BlackBerry::WebKit::WebCookieJar::cookies):
(BlackBerry::WebKit::WebCookieJar::setCookies):
* Api/WebCookieJar.h:
(Platform):
(BlackBerry):
(WebKit):
* Api/WebKitMIMETypeConverter.cpp:
(BlackBerry::WebKit::getExtensionForMimeType):
(BlackBerry::WebKit::getMimeTypeForExtension):
* Api/WebKitMIMETypeConverter.h:
(Platform):
(BlackBerry):
(WebKit):
* Api/WebKitTextCodec.cpp:
(BlackBerry::WebKit::base64Decode):
(BlackBerry::WebKit::base64Encode):
(BlackBerry::WebKit::unescapeURL):
(BlackBerry::WebKit::escapeURL):
* Api/WebKitTextCodec.h:
(Platform):
(BlackBerry):
* Api/WebOverlay.cpp:
(BlackBerry::WebKit::WebOverlay::removeAnimation):
* Api/WebOverlay.h:
(Platform):
(BlackBerry):
(WebKit):
* Api/WebOverlayOverride.cpp:
(BlackBerry::WebKit::WebOverlayOverride::removeAnimation):
* Api/WebOverlayOverride.h:
(Platform):
(BlackBerry):
(WebKit):
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPage::autofillTextField):
(BlackBerry::WebKit::WebPage::renderTreeAsText):
(BlackBerry::WebKit::WebPage::WebPage):
(BlackBerry::WebKit::WebPagePrivate::init):
(BlackBerry::WebKit::WebPagePrivate::load):
(BlackBerry::WebKit::WebPage::load):
(BlackBerry::WebKit::WebPage::loadFile):
(BlackBerry::WebKit::WebPage::download):
(BlackBerry::WebKit::WebPagePrivate::loadString):
(BlackBerry::WebKit::WebPage::loadString):
(BlackBerry::WebKit::WebPagePrivate::executeJavaScript):
(BlackBerry::WebKit::WebPage::executeJavaScript):
(BlackBerry::WebKit::WebPagePrivate::executeJavaScriptInIsolatedWorld):
(BlackBerry::WebKit::WebPage::executeJavaScriptInIsolatedWorld):
(BlackBerry::WebKit::WebPage::executeJavaScriptFunction):
(BlackBerry::WebKit::WebPagePrivate::addOriginAccessWhitelistEntry):
(BlackBerry::WebKit::WebPage::addOriginAccessWhitelistEntry):
(BlackBerry::WebKit::WebPagePrivate::removeOriginAccessWhitelistEntry):
(BlackBerry::WebKit::WebPage::removeOriginAccessWhitelistEntry):
(BlackBerry::WebKit::WebPagePrivate::authenticationChallenge):
(BlackBerry::WebKit::WebPagePrivate::syncProxyCredential):
(BlackBerry::WebKit::WebPagePrivate::notifyPopupAutofillDialog):
(BlackBerry::WebKit::WebPagePrivate::webContext):
(BlackBerry::WebKit::WebPage::setDateTimeInput):
(BlackBerry::WebKit::WebPage::setColorInput):
(BlackBerry::WebKit::WebPage::textEncoding):
(BlackBerry::WebKit::WebPage::forcedTextEncoding):
(BlackBerry::WebKit::WebPage::setForcedTextEncoding):
(BlackBerry::WebKit::WebPage::title):
(BlackBerry::WebKit::WebPage::selectedText):
(BlackBerry::WebKit::WebPage::cutSelectedText):
(BlackBerry::WebKit::WebPage::insertText):
(BlackBerry::WebKit::WebPage::getBackForwardList):
(BlackBerry::WebKit::WebPage::onCertificateStoreLocationSet):
(BlackBerry::WebKit::WebPage::dispatchInspectorMessage):
(BlackBerry::WebKit::WebPagePrivate::didChangeSettings):
(BlackBerry::WebKit::WebPage::textHasAttribute):
(BlackBerry::WebKit::WebPage::setAllowNotification):
(BlackBerry::WebKit::WebPagePrivate::defaultUserAgent):
* Api/WebPage.h:
* Api/WebPageClient.h:
* Api/WebPage_p.h:
(WebPagePrivate):
* Api/WebSettings.cpp:
(BlackBerry::WebKit::WebSettings::standardSettings):
(BlackBerry::WebKit::WebSettings::addSupportedObjectPluginMIMEType):
(BlackBerry::WebKit::WebSettings::isSupportedObjectMIMEType):
(BlackBerry::WebKit::WebSettings::serifFontFamily):
(BlackBerry::WebKit::WebSettings::setSerifFontFamily):
(BlackBerry::WebKit::WebSettings::fixedFontFamily):
(BlackBerry::WebKit::WebSettings::setFixedFontFamily):
(BlackBerry::WebKit::WebSettings::sansSerifFontFamily):
(BlackBerry::WebKit::WebSettings::setSansSerifFontFamily):
(BlackBerry::WebKit::WebSettings::standardFontFamily):
(BlackBerry::WebKit::WebSettings::setStandardFontFamily):
(BlackBerry::WebKit::WebSettings::userAgentString):
(BlackBerry::WebKit::WebSettings::setUserAgentString):
(BlackBerry::WebKit::WebSettings::defaultTextEncodingName):
(BlackBerry::WebKit::WebSettings::setDefaultTextEncodingName):
(BlackBerry::WebKit::WebSettings::userStyleSheetString):
(BlackBerry::WebKit::WebSettings::setUserStyleSheetString):
(BlackBerry::WebKit::WebSettings::userStyleSheetLocation):
(BlackBerry::WebKit::WebSettings::setUserStyleSheetLocation):
(BlackBerry::WebKit::WebSettings::localStoragePath):
(BlackBerry::WebKit::WebSettings::setLocalStoragePath):
(BlackBerry::WebKit::WebSettings::indexedDataBasePath):
(BlackBerry::WebKit::WebSettings::setIndexedDataBasePath):
(BlackBerry::WebKit::WebSettings::databasePath):
(BlackBerry::WebKit::WebSettings::setDatabasePath):
(BlackBerry::WebKit::WebSettings::appCachePath):
(BlackBerry::WebKit::WebSettings::setAppCachePath):
(BlackBerry::WebKit::WebSettings::pageGroupName):
(BlackBerry::WebKit::WebSettings::setPageGroupName):
* Api/WebSettings.h:
* Api/WebString.cpp: Removed.
* Api/WebString.h: Removed.
* WebCoreSupport/ChromeClientBlackBerry.cpp:
(WebCore::ChromeClientBlackBerry::runJavaScriptPrompt):
(WebCore::ChromeClientBlackBerry::createWindow):
(WebCore::ChromeClientBlackBerry::runOpenPanel):
(WebCore):
* WebCoreSupport/ChromeClientBlackBerry.h:
(ChromeClientBlackBerry):
* WebCoreSupport/ClientExtension.cpp:
(clientExtensionMethod):
* WebCoreSupport/ColorPickerClient.cpp:
(WebCore::ColorPickerClient::ColorPickerClient):
(WebCore::ColorPickerClient::generateHTML):
* WebCoreSupport/ColorPickerClient.h:
(Platform):
(BlackBerry):
(WebKit):
(ColorPickerClient):
* WebCoreSupport/CredentialManager.cpp:
(WebCore::CredentialManager::autofillAuthenticationChallenge):
* WebCoreSupport/CredentialManager.h:
(Platform):
(CredentialManager):
* WebCoreSupport/DatePickerClient.cpp:
(WebCore::DatePickerClient::DatePickerClient):
(WebCore::DatePickerClient::generateHTML):
* WebCoreSupport/DatePickerClient.h:
(Platform):
(BlackBerry):
(WebKit):
(DatePickerClient):
* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::dispatchDecidePolicyForResponse):
(WebCore::FrameLoaderClientBlackBerry::createDocumentLoader):
(WebCore::FrameLoaderClientBlackBerry::dispatchDidFinishLoad):
(WebCore::FrameLoaderClientBlackBerry::dispatchDidFailProvisionalLoad):
(WebCore::FrameLoaderClientBlackBerry::dispatchCreatePage):
(WebCore::FrameLoaderClientBlackBerry::dispatchWillSendRequest):
(WebCore::FrameLoaderClientBlackBerry::loadIconExternally):
(WebCore::FrameLoaderClientBlackBerry::startDownload):
(WebCore::FrameLoaderClientBlackBerry::dispatchDidReceiveIcon):
* WebCoreSupport/IconDatabaseClientBlackBerry.cpp:
* WebCoreSupport/NotificationPresenterImpl.cpp:
(WebCore::NotificationPresenterImpl::show):
(WebCore::NotificationPresenterImpl::cancel):
(WebCore::NotificationPresenterImpl::requestPermission):
(WebCore::NotificationPresenterImpl::onPermission):
(WebCore::NotificationPresenterImpl::notificationClicked):
* WebCoreSupport/NotificationPresenterImpl.h:
(Platform):
(NotificationPresenterImpl):
* WebCoreSupport/SelectPopupClient.cpp:
(WebCore::SelectPopupClient::SelectPopupClient):
(WebCore::SelectPopupClient::update):
(WebCore::SelectPopupClient::generateHTML):
* WebCoreSupport/SelectPopupClient.h:
(Platform):
(BlackBerry):
(SelectPopupClient):
* WebCoreSupport/UserMediaClientImpl.cpp:
(WebCore::toMediaStreamSource):
(WebCore::toMediaStreamDescriptor):
(WebCore::UserMediaClientImpl::requestUserMedia):
(WebCore::UserMediaClientImpl::cancelUserMediaRequest):
* WebKitSupport/AboutData.cpp:
(BlackBerry::WebKit::cachePage):
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::convertStringToWchar):
(BlackBerry::WebKit::convertStringToWcharVector):
(BlackBerry::WebKit::convertSpannableStringToString):
(BlackBerry::WebKit::InputHandler::learnText):
(BlackBerry::WebKit::InputHandler::spellCheckingRequestProcessed):
(BlackBerry::WebKit::InputHandler::openDatePopup):
(BlackBerry::WebKit::InputHandler::openSelectPopup):
(BlackBerry::WebKit::InputHandler::setText):
* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::selectedText):
* WebKitSupport/SelectionHandler.h:
(Platform):
(WebKit):
(SelectionHandler):
* WebKitSupport/SurfacePool.cpp:
(BlackBerry::WebKit::SurfacePool::sharedPixmapGroup):
* WebKitSupport/SurfacePool.h:
(SurfacePool):

Source/WTF:

* wtf/Assertions.cpp: Use proper log function.
* wtf/text/AtomicString.h: Add BlackBerry support
(AtomicString):
(WTF::AtomicString::AtomicString): Add BlackBerry Support
(WTF::AtomicString::operator BlackBerry::Platform::String):
* wtf/text/StringImpl.h: Conversion support.
* wtf/text/WTFString.h: Conversion support.
(Platform):
(String):

Tools:

* DumpRenderTree/blackberry/DumpRenderTree.cpp:
(BlackBerry::WebKit::DumpRenderTree::runTest):
* DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp:
(LoadHTMLStringItem::invoke):
(ScriptItem::invoke):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@131316 268f45cc-cd09-0410-ab3c-d52691b4dbfc

74 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/Assertions.cpp
Source/WTF/wtf/text/AtomicString.h
Source/WTF/wtf/text/StringImpl.h
Source/WTF/wtf/text/WTFString.h
Source/WebCore/ChangeLog
Source/WebCore/html/track/TextTrack.cpp
Source/WebCore/page/blackberry/SettingsBlackBerry.cpp
Source/WebCore/platform/blackberry/LocalizedStringsBlackBerry.cpp
Source/WebCore/platform/blackberry/MIMETypeRegistryBlackBerry.cpp
Source/WebCore/platform/blackberry/PasteboardBlackBerry.cpp
Source/WebCore/platform/blackberry/ReadOnlyLatin1String.h [deleted file]
Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp
Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h
Source/WebCore/platform/network/blackberry/DNSBlackBerry.cpp
Source/WebCore/platform/network/blackberry/NetworkJob.cpp
Source/WebCore/platform/network/blackberry/NetworkJob.h
Source/WebCore/platform/network/blackberry/NetworkManager.cpp
Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp
Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp
Source/WebCore/platform/text/blackberry/StringBlackBerry.cpp
Source/WebCore/platform/text/blackberry/TextBreakIteratorInternalICUBlackBerry.cpp
Source/WebKit/ChangeLog
Source/WebKit/PlatformBlackBerry.cmake
Source/WebKit/blackberry/Api/BlackBerryGlobal.cpp
Source/WebKit/blackberry/Api/BlackBerryGlobal.h
Source/WebKit/blackberry/Api/JavaScriptVariant.cpp
Source/WebKit/blackberry/Api/JavaScriptVariant.h
Source/WebKit/blackberry/Api/WebAnimation.cpp
Source/WebKit/blackberry/Api/WebAnimation.h
Source/WebKit/blackberry/Api/WebCookieJar.cpp
Source/WebKit/blackberry/Api/WebCookieJar.h
Source/WebKit/blackberry/Api/WebKitMIMETypeConverter.cpp
Source/WebKit/blackberry/Api/WebKitMIMETypeConverter.h
Source/WebKit/blackberry/Api/WebKitTextCodec.cpp
Source/WebKit/blackberry/Api/WebKitTextCodec.h
Source/WebKit/blackberry/Api/WebOverlay.cpp
Source/WebKit/blackberry/Api/WebOverlay.h
Source/WebKit/blackberry/Api/WebOverlayOverride.cpp
Source/WebKit/blackberry/Api/WebOverlayOverride.h
Source/WebKit/blackberry/Api/WebPage.cpp
Source/WebKit/blackberry/Api/WebPage.h
Source/WebKit/blackberry/Api/WebPageClient.h
Source/WebKit/blackberry/Api/WebPage_p.h
Source/WebKit/blackberry/Api/WebSettings.cpp
Source/WebKit/blackberry/Api/WebSettings.h
Source/WebKit/blackberry/Api/WebString.cpp [deleted file]
Source/WebKit/blackberry/Api/WebString.h [deleted file]
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp
Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h
Source/WebKit/blackberry/WebCoreSupport/ClientExtension.cpp
Source/WebKit/blackberry/WebCoreSupport/ColorPickerClient.cpp
Source/WebKit/blackberry/WebCoreSupport/ColorPickerClient.h
Source/WebKit/blackberry/WebCoreSupport/CredentialManager.cpp
Source/WebKit/blackberry/WebCoreSupport/CredentialManager.h
Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.cpp
Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.h
Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp
Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.cpp
Source/WebKit/blackberry/WebCoreSupport/NotificationPresenterImpl.cpp
Source/WebKit/blackberry/WebCoreSupport/NotificationPresenterImpl.h
Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp
Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.h
Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.cpp
Source/WebKit/blackberry/WebKitSupport/AboutData.cpp
Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp
Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp
Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h
Source/WebKit/blackberry/WebKitSupport/SurfacePool.cpp
Source/WebKit/blackberry/WebKitSupport/SurfacePool.h
Tools/ChangeLog
Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp
Tools/DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp

index a514774..e1e60eb 100644 (file)
@@ -1,3 +1,22 @@
+2012-10-15  George Staikos  <staikos@webkit.org>
+
+        [BlackBerry] Adapt to Platform API changes in string handling
+        https://bugs.webkit.org/show_bug.cgi?id=99248
+
+        Reviewed by Yong Li.
+
+        Convert usage of WebString, char* and std::string to BlackBerry::Platform::String.
+
+        * wtf/Assertions.cpp: Use proper log function.
+        * wtf/text/AtomicString.h: Add BlackBerry support
+        (AtomicString):
+        (WTF::AtomicString::AtomicString): Add BlackBerry Support
+        (WTF::AtomicString::operator BlackBerry::Platform::String):
+        * wtf/text/StringImpl.h: Conversion support.
+        * wtf/text/WTFString.h: Conversion support.
+        (Platform):
+        (String):
+
 2012-10-15  Michael Saboff  <msaboff@apple.com>
 
         Update RenderText to use String instead of UChar* for text
index aa7f364..0640bc5 100644 (file)
@@ -115,7 +115,7 @@ static void vprintf_stderr_common(const char* format, va_list args)
     // Fall through to write to stderr in the same manner as other platforms.
 
 #elif PLATFORM(BLACKBERRY)
-    BlackBerry::Platform::logStreamV(format, args);
+    BBLOGV(BlackBerry::Platform::LogLevelCritical, format, args);
 #elif OS(ANDROID)
     __android_log_vprint(ANDROID_LOG_WARN, "WebKit", format, args);
 #elif HAVE(ISDEBUGGERPRESENT)
@@ -215,26 +215,8 @@ static void printCallSite(const char* file, int line, const char* function)
 #endif
 }
 
-#if PLATFORM(BLACKBERRY)
-struct WTFLogLocker {
-    WTFLogLocker(BlackBerry::Platform::MessageLogLevel logLevel)
-    {
-        BlackBerry::Platform::lockLogging(logLevel);
-    }
-
-    ~WTFLogLocker()
-    {
-        BlackBerry::Platform::unlockLogging();
-    }
-};
-#endif
-
 void WTFReportAssertionFailure(const char* file, int line, const char* function, const char* assertion)
 {
-#if PLATFORM(BLACKBERRY)
-    WTFLogLocker locker(BlackBerry::Platform::LogLevelCritical);
-#endif
-
     if (assertion)
         printf_stderr_common("ASSERTION FAILED: %s\n", assertion);
     else
@@ -244,10 +226,6 @@ void WTFReportAssertionFailure(const char* file, int line, const char* function,
 
 void WTFReportAssertionFailureWithMessage(const char* file, int line, const char* function, const char* assertion, const char* format, ...)
 {
-#if PLATFORM(BLACKBERRY)
-    WTFLogLocker locker(BlackBerry::Platform::LogLevelCritical);
-#endif
-
     va_list args;
     va_start(args, format);
     vprintf_stderr_with_prefix("ASSERTION FAILED: ", format, args);
@@ -258,10 +236,6 @@ void WTFReportAssertionFailureWithMessage(const char* file, int line, const char
 
 void WTFReportArgumentAssertionFailure(const char* file, int line, const char* function, const char* argName, const char* assertion)
 {
-#if PLATFORM(BLACKBERRY)
-    WTFLogLocker locker(BlackBerry::Platform::LogLevelCritical);
-#endif
-
     printf_stderr_common("ARGUMENT BAD: %s, %s\n", argName, assertion);
     printCallSite(file, line, function);
 }
@@ -399,10 +373,6 @@ void WTFInstallReportBacktraceOnCrashHook()
 
 void WTFReportFatalError(const char* file, int line, const char* function, const char* format, ...)
 {
-#if PLATFORM(BLACKBERRY)
-    WTFLogLocker locker(BlackBerry::Platform::LogLevelCritical);
-#endif
-
     va_list args;
     va_start(args, format);
     vprintf_stderr_with_prefix("FATAL ERROR: ", format, args);
@@ -413,10 +383,6 @@ void WTFReportFatalError(const char* file, int line, const char* function, const
 
 void WTFReportError(const char* file, int line, const char* function, const char* format, ...)
 {
-#if PLATFORM(BLACKBERRY)
-    WTFLogLocker locker(BlackBerry::Platform::LogLevelWarn);
-#endif
-
     va_list args;
     va_start(args, format);
     vprintf_stderr_with_prefix("ERROR: ", format, args);
@@ -430,10 +396,6 @@ void WTFLog(WTFLogChannel* channel, const char* format, ...)
     if (channel->state != WTFLogChannelOn)
         return;
 
-#if PLATFORM(BLACKBERRY)
-    WTFLogLocker locker(BlackBerry::Platform::LogLevelInfo);
-#endif
-
     va_list args;
     va_start(args, format);
     vprintf_stderr_with_trailing_newline(format, args);
@@ -445,10 +407,6 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann
     if (channel->state != WTFLogChannelOn)
         return;
 
-#if PLATFORM(BLACKBERRY)
-    WTFLogLocker locker(BlackBerry::Platform::LogLevelInfo);
-#endif
-
     va_list args;
     va_start(args, format);
     vprintf_stderr_with_trailing_newline(format, args);
@@ -459,10 +417,6 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann
 
 void WTFLogAlways(const char* format, ...)
 {
-#if PLATFORM(BLACKBERRY)
-    WTFLogLocker locker(BlackBerry::Platform::LogLevelInfo);
-#endif
-
     va_list args;
     va_start(args, format);
     vprintf_stderr_with_trailing_newline(format, args);
index c25b135..6ac60e6 100644 (file)
@@ -149,6 +149,10 @@ public:
     AtomicString(const QString& s) : m_string(add(String(s).impl())) { }
     operator QString() const { return m_string; }
 #endif
+#if PLATFORM(BLACKBERRY)
+    AtomicString(const BlackBerry::Platform::String& s) : m_string(add(String(s).impl())) { }
+    operator BlackBerry::Platform::String() const { return m_string; }
+#endif
 
     // AtomicString::fromUTF8 will return a null string if
     // the input data contains invalid UTF-8 sequences.
index 43db7b4..14e1baa 100644 (file)
@@ -43,6 +43,10 @@ typedef const struct __CFString * CFStringRef;
 @class NSString;
 #endif
 
+#if PLATFORM(BLACKBERRY)
+#include <BlackBerryPlatformString.h>
+#endif
+
 // FIXME: This is a temporary layering violation while we move string code to WTF.
 // Landing the file moves in one patch, will follow on with patches to change the namespaces.
 namespace JSC {
index 5fb1a95..50c048d 100644 (file)
@@ -48,8 +48,8 @@ class wxString;
 
 #if PLATFORM(BLACKBERRY)
 namespace BlackBerry {
-namespace WebKit {
-    class WebString;
+namespace Platform {
+class String;
 }
 }
 #endif
@@ -409,8 +409,8 @@ public:
 #endif
 
 #if PLATFORM(BLACKBERRY)
-    String(const BlackBerry::WebKit::WebString&);
-    operator BlackBerry::WebKit::WebString() const;
+    String(const BlackBerry::Platform::String&);
+    operator BlackBerry::Platform::String() const;
 #endif
 
     WTF_EXPORT_STRING_API static String make8BitFrom16BitSource(const UChar*, size_t);
index 2354ebb..80f14f7 100644 (file)
@@ -1,3 +1,61 @@
+2012-10-15  George Staikos  <staikos@webkit.org>
+
+        [BlackBerry] Adapt to Platform API changes in string handling
+        https://bugs.webkit.org/show_bug.cgi?id=99248
+
+        Reviewed by Yong Li.
+
+        Convert usage of WebString, char* and std::string to BlackBerry::Platform::String.
+
+        * html/track/TextTrack.cpp:
+        (WebCore::TextTrack::TextTrack): Fix the build for BlackBerry.
+        * page/blackberry/SettingsBlackBerry.cpp:
+        (WebCore):
+        (WebCore::Settings::initializeDefaultFontFamilies):
+        * platform/blackberry/LocalizedStringsBlackBerry.cpp:
+        * platform/blackberry/MIMETypeRegistryBlackBerry.cpp:
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
+        (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
+        * platform/blackberry/PasteboardBlackBerry.cpp:
+        (WebCore::Pasteboard::writeSelection):
+        (WebCore::Pasteboard::writeURL):
+        (WebCore::Pasteboard::writePlainText):
+        (WebCore::Pasteboard::plainText):
+        (WebCore::Pasteboard::documentFragment):
+        * platform/blackberry/ReadOnlyLatin1String.h: Removed.
+        * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
+        (WebCore::MediaPlayerPrivate::getSupportedTypes):
+        (WebCore::MediaPlayerPrivate::supportsType):
+        (WebCore::MediaPlayerPrivate::setCertificatePath):
+        (WebCore::MediaPlayerPrivate::load):
+        (WebCore::generateProtectionSpaceFromMMRAuthChallenge):
+        (WebCore::MediaPlayerPrivate::onAuthenticationNeeded):
+        (WebCore::MediaPlayerPrivate::onAuthenticationAccepted):
+        (WebCore::MediaPlayerPrivate::lookupMediaStream):
+        * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h:
+        (MediaPlayerPrivate):
+        (WebCore::MediaPlayerPrivate::engineDescription):
+        * platform/network/blackberry/DNSBlackBerry.cpp:
+        (WebCore::prefetchDNS):
+        * platform/network/blackberry/NetworkJob.cpp:
+        (WebCore::NetworkJob::initialize):
+        (WebCore::NetworkJob::notifyStatusReceived):
+        (WebCore::NetworkJob::notifyHeadersReceived):
+        (WebCore::NetworkJob::handleNotifyClose):
+        (WebCore::NetworkJob::sendRequestWithCredentials):
+        * platform/network/blackberry/NetworkJob.h:
+        (NetworkJob):
+        * platform/network/blackberry/NetworkManager.cpp:
+        (WebCore::NetworkManager::startJob):
+        * platform/network/blackberry/ResourceRequestBlackBerry.cpp:
+        (WebCore::ResourceRequest::initializePlatformRequest):
+        * platform/network/blackberry/SocketStreamHandleBlackBerry.cpp:
+        (WebCore::SocketStreamHandle::SocketStreamHandle):
+        * platform/text/blackberry/StringBlackBerry.cpp:
+        (WTF::String::String):
+        (WTF::String::operator BlackBerry::Platform::String):
+        * platform/text/blackberry/TextBreakIteratorInternalICUBlackBerry.cpp:
+
 2012-10-15  Jay Civelli  <jcivelli@chromium.org>
 
         Calling WebCore::SharedBuffer::append(data, 0) on a shared buffer when
index 6abcacc..120fce7 100644 (file)
@@ -100,7 +100,7 @@ TextTrack::TextTrack(ScriptExecutionContext* context, TextTrackClient* client, c
     , m_mediaElement(0)
     , m_label(label)
     , m_language(language)
-    , m_mode(disabledKeyword())
+    , m_mode(disabledKeyword().string())
     , m_client(client)
     , m_trackType(type)
     , m_readinessState(NotLoaded)
index e59a591..ec02cc6 100644 (file)
 
 namespace WebCore {
 
-static const char* languages[] = {
-    "ar",
-    "bn",
-    "gu",
-    "he",
-    "hi",
-    "ja",
-    "kn",
-    "ko",
-    "ml",
-    "pa",
-    "ta",
-    "te",
-    "th",
-    "zh-CN",
-    "zh-TW",
-};
-
 void Settings::initializeDefaultFontFamilies()
 {
-    setCursiveFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-cursive", "").c_str());
-    setFantasyFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-fantasy", "").c_str());
-    setFixedFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-monospace", "").c_str());
-    setSansSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-sans-serif", "").c_str());
-    setSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-serif", "").c_str());
-    setStandardFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-standard", "").c_str());
+    static const char* kLanguages[] = {
+        "ar",
+        "bn",
+        "gu",
+        "he",
+        "hi",
+        "ja",
+        "kn",
+        "ko",
+        "ml",
+        "pa",
+        "ta",
+        "te",
+        "th",
+        "zh-CN",
+        "zh-TW",
+    };
+
+    static BlackBerry::Platform::String* languages[WTF_ARRAY_LENGTH(kLanguages)];
+    static bool init = false;
+    if (!init) {
+        for (size_t i = 0; i < WTF_ARRAY_LENGTH(kLanguages); ++i)
+            languages[i] = new BlackBerry::Platform::String(kLanguages[i]);
+        init = true;
+    }
+
+    STATIC_LOCAL_STRING(s_webkitCursive, "-webkit-cursive");
+    STATIC_LOCAL_STRING(s_webkitFantasy, "-webkit-fantasy");
+    STATIC_LOCAL_STRING(s_webkitMonospace, "-webkit-monospace");
+    STATIC_LOCAL_STRING(s_webkitSansSerif, "-webkit-sans-serif");
+    STATIC_LOCAL_STRING(s_webkitSerif, "-webkit-serif");
+    STATIC_LOCAL_STRING(s_webkitStandard, "-webkit-standard");
+
+    setCursiveFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_webkitCursive, BlackBerry::Platform::String::emptyString()));
+    setFantasyFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_webkitFantasy, BlackBerry::Platform::String::emptyString()));
+    setFixedFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_webkitMonospace, BlackBerry::Platform::String::emptyString()));
+    setSansSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_webkitSansSerif, BlackBerry::Platform::String::emptyString()));
+    setSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_webkitSerif, BlackBerry::Platform::String::emptyString()));
+    setStandardFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_webkitStandard, BlackBerry::Platform::String::emptyString()));
 
+    STATIC_LOCAL_STRING(s_monospace, "monospace");
+    STATIC_LOCAL_STRING(s_serif, "serif");
+    STATIC_LOCAL_STRING(s_sansSerif, "sans-serif");
     for (size_t i = 0; i < WTF_ARRAY_LENGTH(languages); ++i) {
-        UScriptCode script = localeToScriptCodeForFontSelection(languages[i]);
-        setFixedFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("monospace", languages[i]).c_str(), script);
-        setSansSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("sans-serif", languages[i]).c_str(), script);
-        setSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("serif", languages[i]).c_str(), script);
-        setStandardFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily("", languages[i]).c_str(), script);
+        UScriptCode script = localeToScriptCodeForFontSelection(*languages[i]);
+        setFixedFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_monospace, *languages[i]), script);
+        setSansSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_sansSerif, *languages[i]), script);
+        setSerifFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(s_serif, *languages[i]), script);
+        setStandardFontFamily(BlackBerry::Platform::FontInfo::instance()->fontFamily(BlackBerry::Platform::String::emptyString(), *languages[i]), script);
     }
 }
 
index 83339ef..6d7b3a3 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "IntSize.h"
 #include "NotImplemented.h"
+#include <BlackBerryPlatformString.h>
 #include <LocaleHandler.h>
 #include <LocalizeResource.h>
 #include <wtf/Vector.h>
index 44c6d8e..06d010d 100644 (file)
 
 #include "NotImplemented.h"
 #include <BlackBerryPlatformCommonFunctions.h>
+#include <BlackBerryPlatformString.h>
 #include <wtf/text/CString.h>
 
 namespace WebCore {
 
 String MIMETypeRegistry::getMIMETypeForExtension(const String& extension)
 {
-    return String(BlackBerry::Platform::getMIMETypeForExtension(extension.lower().utf8().data()).c_str());
+    return BlackBerry::Platform::getMIMETypeForExtension(extension.lower());
 }
 
 String MIMETypeRegistry::getPreferredExtensionForMIMEType(const String& type)
 {
-    return String(BlackBerry::Platform::getPreferredExtensionForMIMEType(type.lower().utf8().data()).c_str());
+    return BlackBerry::Platform::getPreferredExtensionForMIMEType(type.lower());
 }
 
 bool MIMETypeRegistry::isApplicationPluginMIMEType(const String&)
index 24d2007..c82afad 100644 (file)
@@ -63,9 +63,9 @@ void Pasteboard::writeClipboard(Clipboard*)
 
 void Pasteboard::writeSelection(Range* selectedRange, bool, Frame* frame)
 {
-    std::string text = frame->editor()->selectedText().utf8().data();
-    std::string html = createMarkup(selectedRange, 0, AnnotateForInterchange).utf8().data();
-    std::string url = frame->document()->url().string().utf8().data();
+    WTF::String text = frame->editor()->selectedText();
+    WTF::String html = createMarkup(selectedRange, 0, AnnotateForInterchange);
+    WTF::String url = frame->document()->url().string();
 
     BlackBerry::Platform::Clipboard::write(text, html, url);
 }
@@ -73,17 +73,17 @@ void Pasteboard::writeSelection(Range* selectedRange, bool, Frame* frame)
 void Pasteboard::writeURL(KURL const& url, String const&, Frame*)
 {
     ASSERT(!url.isEmpty());
-    BlackBerry::Platform::Clipboard::writeURL(url.string().utf8().data());
+    BlackBerry::Platform::Clipboard::writeURL(url.string());
 }
 
 void Pasteboard::writePlainText(const String& text, SmartReplaceOption)
 {
-    BlackBerry::Platform::Clipboard::writePlainText(text.utf8().data());
+    BlackBerry::Platform::Clipboard::writePlainText(text);
 }
 
 String Pasteboard::plainText(Frame*)
 {
-    return String::fromUTF8(BlackBerry::Platform::Clipboard::readPlainText().c_str());
+    return BlackBerry::Platform::Clipboard::readPlainText();
 }
 
 PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText)
@@ -93,10 +93,10 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP
     // Note: We are able to check if the format exists prior to reading but the check & the early return
     // path of get_clipboard_data are the exact same, so just use get_clipboard_data and validate the
     // return value to determine if the data was present.
-    String html = String::fromUTF8(BlackBerry::Platform::Clipboard::readHTML().c_str());
+    String html = BlackBerry::Platform::Clipboard::readHTML();
     RefPtr<DocumentFragment> fragment;
     if (!html.isEmpty()) {
-        String url = String::fromUTF8(BlackBerry::Platform::Clipboard::readURL().c_str());
+        String url = BlackBerry::Platform::Clipboard::readURL();
         if (fragment = createFragmentFromMarkup(frame->document(), html, url, DisallowScriptingContent))
             return fragment.release();
     }
@@ -104,7 +104,7 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP
     if (!allowPlainText)
         return 0;
 
-    String text = String::fromUTF8(BlackBerry::Platform::Clipboard::readPlainText().c_str());
+    String text = BlackBerry::Platform::Clipboard::readPlainText();
     if (fragment = createFragmentFromText(context.get(), text)) {
         chosePlainText = true;
         return fragment.release();
diff --git a/Source/WebCore/platform/blackberry/ReadOnlyLatin1String.h b/Source/WebCore/platform/blackberry/ReadOnlyLatin1String.h
deleted file mode 100644 (file)
index 613dbda..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 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 ReadOnlyLatin1String_h
-#define ReadOnlyLatin1String_h
-
-#include <wtf/text/CString.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-class ReadOnlyLatin1String {
-public:
-    explicit ReadOnlyLatin1String(const String& string)
-    {
-        if (string.is8Bit())
-            m_string = string;
-        else {
-            ASSERT(string.containsOnlyLatin1());
-            m_cstring = string.latin1();
-        }
-    }
-
-    const char* data() const { return m_string.isNull() ? m_cstring.data() : reinterpret_cast<const char*>(m_string.characters8()); }
-
-    size_t length() const { return m_string.isNull() ? m_cstring.length() : m_string.length(); }
-
-private:
-    String m_string;
-    CString m_cstring;
-};
-
-} // namespace WebCore
-
-#endif
index aff5e70..ea3c895 100644 (file)
@@ -42,7 +42,6 @@
 #include <BlackBerryPlatformSettings.h>
 #include <FrameLoaderClientBlackBerry.h>
 #include <set>
-#include <string>
 #include <wtf/text/CString.h>
 
 #if USE(ACCELERATED_COMPOSITING)
@@ -67,15 +66,15 @@ void MediaPlayerPrivate::registerMediaEngine(MediaEngineRegistrar registrar)
     registrar(create, getSupportedTypes, supportsType, 0, 0, 0);
 }
 
-void MediaPlayerPrivate::getSupportedTypes(HashSet<String>& types)
+void MediaPlayerPrivate::getSupportedTypes(HashSet<WTF::String>& types)
 {
-    set<string> supported = PlatformPlayer::allSupportedMimeTypes();
-    set<string>::iterator i = supported.begin();
+    set<BlackBerry::Platform::String> supported = PlatformPlayer::allSupportedMimeTypes();
+    set<BlackBerry::Platform::String>::iterator i = supported.begin();
     for (; i != supported.end(); i++)
-        types.add(i->c_str());
+        types.add(*i);
 }
 
-MediaPlayer::SupportsType MediaPlayerPrivate::supportsType(const String& type, const String& codecs, const KURL&)
+MediaPlayer::SupportsType MediaPlayerPrivate::supportsType(const WTF::String& type, const WTF::String& codecs, const KURL&)
 {
     if (type.isNull() || type.isEmpty()) {
         LOG(Media, "MediaPlayer does not support type; type is null or empty.");
@@ -96,9 +95,9 @@ void MediaPlayerPrivate::notifyAppActivatedEvent(bool activated)
     PlatformPlayer::notifyAppActivatedEvent(activated);
 }
 
-void MediaPlayerPrivate::setCertificatePath(const String& caPath)
+void MediaPlayerPrivate::setCertificatePath(const WTF::String& caPath)
 {
-    PlatformPlayer::setCertificatePath(string(caPath.utf8().data()));
+    PlatformPlayer::setCertificatePath(caPath);
 }
 
 MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
@@ -138,14 +137,14 @@ MediaPlayerPrivate::~MediaPlayerPrivate()
     deleteGuardedObject(m_platformPlayer);
 }
 
-void MediaPlayerPrivate::load(const String& url)
+void MediaPlayerPrivate::load(const WTF::String& url)
 {
-    String modifiedUrl(url);
+    WTF::String modifiedUrl(url);
 
     if (modifiedUrl.startsWith("local://")) {
         KURL kurl = KURL(KURL(), modifiedUrl);
         kurl.setProtocol("file");
-        String tempPath(BlackBerry::Platform::Settings::instance()->applicationLocalDirectory().c_str());
+        WTF::String tempPath(BlackBerry::Platform::Settings::instance()->applicationLocalDirectory().c_str());
         tempPath.append(kurl.path());
         kurl.setPath(tempPath);
         modifiedUrl = kurl.string();
@@ -165,7 +164,7 @@ void MediaPlayerPrivate::load(const String& url)
     m_platformPlayer = PlatformPlayer::create(this, tabId, false, modifiedUrl.utf8().data());
 #endif
 
-    String cookiePairs;
+    WTF::String cookiePairs;
     if (!url.isEmpty())
         cookiePairs = cookieManager().getCookie(KURL(ParsedURLString, url.utf8().data()), WithHttpOnlyCookies);
     if (!cookiePairs.isEmpty() && cookiePairs.utf8().data())
@@ -696,7 +695,7 @@ void MediaPlayerPrivate::onBuffering(bool flag)
 
 static ProtectionSpace generateProtectionSpaceFromMMRAuthChallenge(const MMRAuthChallenge& authChallenge)
 {
-    KURL url(ParsedURLString, String(authChallenge.url().c_str()));
+    KURL url(ParsedURLString, WTF::String(authChallenge.url().c_str()));
     ASSERT(url.isValid());
 
     return ProtectionSpace(url.host(), url.port(),
@@ -707,7 +706,7 @@ static ProtectionSpace generateProtectionSpaceFromMMRAuthChallenge(const MMRAuth
 
 void MediaPlayerPrivate::onAuthenticationNeeded(MMRAuthChallenge& authChallenge)
 {
-    KURL url(ParsedURLString, String(authChallenge.url().c_str()));
+    KURL url(ParsedURLString, WTF::String(authChallenge.url().c_str()));
     if (!url.isValid())
         return;
 
@@ -740,7 +739,7 @@ void MediaPlayerPrivate::notifyChallengeResult(const KURL& url, const Protection
 
 void MediaPlayerPrivate::onAuthenticationAccepted(const MMRAuthChallenge& authChallenge) const
 {
-    KURL url(ParsedURLString, String(authChallenge.url().c_str()));
+    KURL url(ParsedURLString, WTF::String(authChallenge.url().c_str()));
     if (!url.isValid())
         return;
 
@@ -805,9 +804,9 @@ static WebMediaStreamDescriptor toWebMediaStreamDescriptor(MediaStreamDescriptor
     return WebMediaStreamDescriptor(d->label().utf8().data(), audioSources, videoSources);
 }
 
-WebMediaStreamDescriptor MediaPlayerPrivate::lookupMediaStream(const string& url)
+WebMediaStreamDescriptor MediaPlayerPrivate::lookupMediaStream(const BlackBerry::Platform::String& url)
 {
-    MediaStreamDescriptor* descriptor = MediaStreamRegistry::registry().lookupMediaStreamDescriptor(String::fromUTF8(url.c_str()));
+    MediaStreamDescriptor* descriptor = MediaStreamRegistry::registry().lookupMediaStreamDescriptor(WTF::String::fromUTF8(url.c_str()));
     if (!descriptor)
         return WebMediaStreamDescriptor();
 
index 8578cc0..7b6654d 100644 (file)
@@ -39,12 +39,12 @@ public:
 
     static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*);
     static void registerMediaEngine(MediaEngineRegistrar);
-    static void getSupportedTypes(HashSet<String>&);
-    static MediaPlayer::SupportsType supportsType(const String&, const String&, const KURL&);
+    static void getSupportedTypes(HashSet<WTF::String>&);
+    static MediaPlayer::SupportsType supportsType(const WTF::String&, const WTF::String&, const KURL&);
     static void notifyAppActivatedEvent(bool);
-    static void setCertificatePath(const String&);
+    static void setCertificatePath(const WTF::String&);
 
-    virtual void load(const String& url);
+    virtual void load(const WTF::String& url);
     virtual void cancelLoad();
 
     virtual void prepareToPlay();
@@ -143,15 +143,15 @@ public:
     virtual bool isTabVisible() const;
     virtual int showErrorDialog(BlackBerry::Platform::PlatformPlayer::Error);
     virtual BlackBerry::Platform::Graphics::Window* platformWindow();
-    virtual BlackBerry::Platform::WebMediaStreamDescriptor lookupMediaStream(const std::string& url);
+    virtual BlackBerry::Platform::WebMediaStreamDescriptor lookupMediaStream(const BlackBerry::Platform::String& url);
 
 private:
     MediaPlayerPrivate(MediaPlayer*);
 
     void updateStates();
-    String userAgent(const String&) const;
+    WTF::String userAgent(const WTF::String&) const;
 
-    virtual String engineDescription() const { return "BlackBerry"; }
+    virtual WTF::String engineDescription() const { return "BlackBerry"; }
 
     MediaPlayer* m_webCorePlayer;
     BlackBerry::Platform::PlatformPlayer* m_platformPlayer;
index 69bd82d..2977b98 100644 (file)
@@ -31,7 +31,7 @@ void prefetchDNS(const String& host)
 {
     if (host.isEmpty())
         return;
-    BlackBerry::Platform::prefetchDNS(host.latin1().data());
+    BlackBerry::Platform::prefetchDNS(host);
 }
 
 }
index 41fb396..720ba13 100644 (file)
@@ -130,14 +130,12 @@ bool NetworkJob::initialize(int playerId,
     // We don't need to explicitly call notifyHeaderReceived, as the Content-Type
     // will ultimately get parsed when sendResponseIfNeeded gets called.
     if (!request.getOverrideContentType().empty()) {
-        m_contentType = String(request.getOverrideContentType().c_str());
+        m_contentType = String(request.getOverrideContentType());
         m_isOverrideContentType = true;
     }
 
-    if (!request.getSuggestedSaveName().empty()) {
-        m_contentDisposition = "filename=";
-        m_contentDisposition += request.getSuggestedSaveName().c_str();
-    }
+    if (!request.getSuggestedSaveName().empty())
+        m_contentDisposition = "filename=" + String(request.getSuggestedSaveName());
 
     BlackBerry::Platform::FilterStream* wrappedStream = m_streamFactory->createNetworkStream(request, m_playerId);
     if (!wrappedStream)
@@ -175,7 +173,7 @@ void NetworkJob::updateDeferLoadingCount(int delta)
     }
 }
 
-void NetworkJob::notifyStatusReceived(int status, const char* message)
+void NetworkJob::notifyStatusReceived(int status, const BlackBerry::Platform::String& message)
 {
     if (shouldDeferLoading())
         m_deferredData.deferOpen(status, message);
@@ -214,9 +212,9 @@ void NetworkJob::notifyHeadersReceived(BlackBerry::Platform::NetworkRequest::Hea
     BlackBerry::Platform::NetworkRequest::HeaderList::const_iterator endIt = headers.end();
     for (BlackBerry::Platform::NetworkRequest::HeaderList::const_iterator it = headers.begin(); it != endIt; ++it) {
         if (shouldDeferLoading())
-            m_deferredData.deferHeaderReceived(it->first.c_str(), it->second.c_str());
+            m_deferredData.deferHeaderReceived(it->first, it->second);
         else {
-            String keyString(it->first.c_str());
+            String keyString(it->first);
             String valueString;
             if (equalIgnoringCase(keyString, "Location")) {
                 // Location, like all headers, is supposed to be Latin-1. But some sites (wikipedia) send it in UTF-8.
@@ -227,11 +225,11 @@ void NetworkJob::notifyHeadersReceived(BlackBerry::Platform::NetworkRequest::Hea
                 // FIXME: maybe we should do this with other headers?
                 // Skip it for now - we don't want to rewrite random bytes unless we're sure. (Definitely don't want to
                 // rewrite cookies, for instance.) Needs more investigation.
-                valueString = String::fromUTF8(it->second.c_str());
+                valueString = it->second;
                 if (valueString.isNull())
-                    valueString = it->second.c_str();
+                    valueString = it->second;
             } else
-                valueString = it->second.c_str();
+                valueString = it->second;
 
             handleNotifyHeaderReceived(keyString, valueString);
         }
@@ -498,7 +496,7 @@ void NetworkJob::handleNotifyClose(int status)
     if (!m_cancelled) {
         if (!m_statusReceived) {
             // Connection failed before sending notifyStatusReceived: use generic NetworkError.
-            notifyStatusReceived(BlackBerry::Platform::FilterStream::StatusNetworkError, 0);
+            notifyStatusReceived(BlackBerry::Platform::FilterStream::StatusNetworkError, BlackBerry::Platform::String::emptyString());
         }
 
         if (shouldReleaseClientResource()) {
@@ -752,7 +750,7 @@ bool NetworkJob::sendRequestWithCredentials(ProtectionSpaceServerType type, Prot
         else
             proxyAddress.append("https://");
 
-        proxyAddress.append(BlackBerry::Platform::Settings::instance()->proxyAddress(newURL.string().ascii().data()).c_str());
+        proxyAddress.append(BlackBerry::Platform::Settings::instance()->proxyAddress(newURL.string()));
         KURL proxyURL(KURL(), proxyAddress.toString());
         host = proxyURL.host();
         port = proxyURL.port();
@@ -787,8 +785,8 @@ bool NetworkJob::sendRequestWithCredentials(ProtectionSpaceServerType type, Prot
         String password;
 
         if (type == ProtectionSpaceProxyHTTP || type == ProtectionSpaceProxyHTTPS) {
-            username = String(BlackBerry::Platform::Settings::instance()->proxyUsername().c_str());
-            password = String(BlackBerry::Platform::Settings::instance()->proxyPassword().c_str());
+            username = String(BlackBerry::Platform::Settings::instance()->proxyUsername());
+            password = String(BlackBerry::Platform::Settings::instance()->proxyPassword());
         } else {
             username = m_handle->getInternal()->m_user;
             password = m_handle->getInternal()->m_pass;
index 8bfb467..4e5749e 100644 (file)
@@ -69,7 +69,7 @@ public:
     int cancelJob();
     bool isDeferringLoading() const { return m_deferLoadingCount > 0; }
     void updateDeferLoadingCount(int delta);
-    virtual void notifyStatusReceived(int status, const char* message);
+    virtual void notifyStatusReceived(int status, const BlackBerry::Platform::String& message);
     void handleNotifyStatusReceived(int status, const String& message);
     virtual void notifyHeadersReceived(BlackBerry::Platform::NetworkRequest::HeaderList& headers);
     virtual void notifyMultipartHeaderReceived(const char* key, const char* value);
index 52cff9b..3d8c542 100644 (file)
@@ -28,7 +28,6 @@
 #include "FrameLoaderClientBlackBerry.h"
 #include "NetworkJob.h"
 #include "Page.h"
-#include "ReadOnlyLatin1String.h"
 #if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
 #include "ResourceHandleClient.h"
 #endif
@@ -87,12 +86,10 @@ bool NetworkManager::startJob(int playerId, const String& pageGroupName, PassRef
 
     const String& documentUrl = frame.document()->url().string();
     if (!documentUrl.isEmpty()) {
-        ReadOnlyLatin1String referrer(documentUrl);
-        platformRequest.setReferrer(referrer.data(), referrer.length());
+        platformRequest.setReferrer(documentUrl);
     }
 
-    ReadOnlyLatin1String securityOrigin(frame.document()->securityOrigin()->toRawString());
-    platformRequest.setSecurityOrigin(securityOrigin.data(), securityOrigin.length());
+    platformRequest.setSecurityOrigin(frame.document()->securityOrigin()->toRawString());
 
     // Attach any applicable auth credentials to the NetworkRequest.
     AuthenticationChallenge& challenge = guardJob->getInternal()->m_currentWebChallenge;
index 757bd3e..bda4021 100644 (file)
@@ -21,7 +21,6 @@
 
 #include "BlobRegistryImpl.h"
 #include "CookieManager.h"
-#include "ReadOnlyLatin1String.h"
 #include <network/NetworkRequest.h>
 #include <wtf/HashMap.h>
 #include <wtf/text/CString.h>
@@ -148,16 +147,14 @@ void ResourceRequest::initializePlatformRequest(NetworkRequest& platformRequest,
     if (isInitial)
         platformRequest.setRequestInitial(timeoutInterval());
     else {
-        ReadOnlyLatin1String latin1URL(url().string());
-        ReadOnlyLatin1String latin1HttpMethod(httpMethod());
-        platformRequest.setRequestUrl(latin1URL.data(), latin1URL.length(),
-                latin1HttpMethod.data(), latin1HttpMethod.length(),
+        platformRequest.setRequestUrl(url().string(),
+            httpMethod(),
                 platformCachePolicyForRequest(*this),
                 platformTargetTypeForRequest(*this),
                 timeoutInterval());
 
         platformRequest.setConditional(isConditional());
-        platformRequest.setSuggestedSaveName(suggestedSaveName().utf8().data());
+        platformRequest.setSuggestedSaveName(suggestedSaveName());
 
         if (httpBody() && !httpBody()->isEmpty()) {
             const Vector<FormDataElement>& elements = httpBody()->elements();
@@ -210,9 +207,7 @@ void ResourceRequest::initializePlatformRequest(NetworkRequest& platformRequest,
                         continue;
                     }
                 }
-                ReadOnlyLatin1String latin1Key(key);
-                ReadOnlyLatin1String latin1Value(value);
-                platformRequest.addHeader(latin1Key.data(), latin1Key.length(), latin1Value.data(), latin1Value.length());
+                platformRequest.addHeader(key, value);
             }
         }
 
index f7d708a..62c04b1 100644 (file)
@@ -39,7 +39,6 @@
 #include "Page.h"
 #include "PageClientBlackBerry.h"
 #include "PageGroup.h"
-#include "ReadOnlyLatin1String.h"
 #include "SocketStreamError.h"
 #include "SocketStreamHandleClient.h"
 
@@ -68,8 +67,7 @@ SocketStreamHandle::SocketStreamHandle(const String& groupName, const KURL& url,
 
     // Open the socket
     BlackBerry::Platform::NetworkRequest request;
-    ReadOnlyLatin1String latin1URL(url.string());
-    request.setRequestUrl(latin1URL.data(), latin1URL.length(), "CONNECT", 7);
+    request.setRequestUrl(url.string(), "CONNECT");
     m_socketStream = adoptPtr(factory->createNetworkStream(request, playerId));
     ASSERT(m_socketStream);
 
index 436569f..ab169b5 100644 (file)
  */
 
 #include "config.h"
-#include <wtf/text/WTFString.h>
-
-#include "WebString.h"
 
-using BlackBerry::WebKit::WebString;
+#include "CString.h"
+#include <BlackBerryPlatformString.h>
+#include <wtf/text/WTFString.h>
 
 namespace WTF {
 
-String::String(const WebString& webString)
-    : m_impl(webString.impl())
+String::String(const BlackBerry::Platform::String& webString)
 {
+    *this = String::fromUTF8(webString.data(), webString.length());
 }
 
-String::operator WebString() const
+String::operator BlackBerry::Platform::String() const
 {
-    WebString webString(m_impl.get());
-    return webString;
+    if (isEmpty())
+        return BlackBerry::Platform::String::emptyString();
+
+    if (is8Bit())
+        return BlackBerry::Platform::String(reinterpret_cast<const char*>(characters8()), length());
+
+    return BlackBerry::Platform::String(characters(), length());
 }
 
 } // namespace WTF
index cf36989..b9c7c69 100644 (file)
@@ -1,3 +1,14 @@
+2012-10-15  George Staikos  <staikos@webkit.org>
+
+        [BlackBerry] Adapt to Platform API changes in string handling
+        https://bugs.webkit.org/show_bug.cgi?id=99248
+
+        Reviewed by Yong Li.
+
+        Convert usage of WebString, char* and std::string to BlackBerry::Platform::String.
+
+        * PlatformBlackBerry.cmake:
+
 2012-10-13  Jakob Petsovits  <jpetsovits@rim.com>
 
         [BlackBerry] Fetch blit rects from a viewport accessor
index 77ae24b..5daad16 100644 (file)
@@ -94,7 +94,6 @@ LIST(APPEND WebKit_SOURCES
     blackberry/Api/WebPageCompositor.cpp
     blackberry/Api/WebPageGroupLoadDeferrer.cpp
     blackberry/Api/WebSettings.cpp
-    blackberry/Api/WebString.cpp
     blackberry/Api/WebViewportArguments.cpp
     blackberry/Api/JavaScriptVariant.cpp
     blackberry/WebCoreSupport/AutofillManager.cpp
index d8b5c51..96a0427 100644 (file)
 #include "PageCache.h"
 #include "PageGroup.h"
 #include "TextureCacheCompositingThread.h"
-#include "WebString.h"
 #include "bindings/js/GCController.h"
 #include "runtime/JSLock.h"
 #include <BlackBerryPlatformExecutableMessage.h>
 #include <BlackBerryPlatformMessageClient.h>
 #include <BlackBerryPlatformSettings.h>
+#include <BlackBerryPlatformString.h>
 #include <wtf/MainThread.h>
 
 using namespace WebCore;
@@ -135,12 +135,12 @@ void clearMemoryCaches()
     fontCache()->invalidate();
 }
 
-void clearAppCache(const WebString& pageGroupName)
+void clearAppCache(const BlackBerry::Platform::String& pageGroupName)
 {
     cacheStorage().empty();
 }
 
-void clearDatabase(const WebString& pageGroupName)
+void clearDatabase(const BlackBerry::Platform::String& pageGroupName)
 {
 }
 
index 9e6e7d5..6c79432 100644 (file)
 #endif
 
 namespace BlackBerry {
-namespace WebKit {
+namespace Platform {
+class String;
+}
 
-class WebString;
+namespace WebKit {
 
 BLACKBERRY_EXPORT void globalInitialize();
 void collectJavascriptGarbageNow();
 void clearCookieCache();
 BLACKBERRY_EXPORT void clearMemoryCaches();
-void clearAppCache(const WebString& pageGroupName);
+void clearAppCache(const BlackBerry::Platform::String& pageGroupName);
 void reopenAllAppCaches();
 void closeAllAppCaches();
-void clearDatabase(const WebString& pageGroupName);
+void clearDatabase(const BlackBerry::Platform::String& pageGroupName);
 void reopenAllTrackerDatabases();
 void closeAllTrackerDatabases();
 void updateOnlineStatus(bool online);
index 5c43387..8307268 100644 (file)
@@ -45,10 +45,15 @@ JavaScriptVariant JSValueRefToBlackBerryJavaScriptVariant(const JSGlobalContextR
         break;
     case kJSTypeString: {
         JSStringRef stringRef = JSValueToStringCopy(ctx, value, 0);
+        if (!stringRef) {
+            returnValue.setString(BlackBerry::Platform::String::emptyString());
+            break;
+        }
         size_t bufferSize = JSStringGetMaximumUTF8CStringSize(stringRef);
         WTF::Vector<char> buffer(bufferSize);
-        JSStringGetUTF8CString(stringRef, buffer.data(), bufferSize);
-        returnValue.setString(WebString::fromUtf8(buffer.data()).utf8().c_str());
+        size_t rc = JSStringGetUTF8CString(stringRef, buffer.data(), bufferSize);
+        returnValue.setString(BlackBerry::Platform::String(buffer.data(), rc - 1));
+        JSStringRelease(stringRef);
         break;
     }
     case kJSTypeObject:
@@ -78,7 +83,7 @@ JSValueRef BlackBerryJavaScriptVariantToJSValueRef(const JSGlobalContextRef& ctx
         ref = JSValueMakeNumber(ctx, variant.doubleValue());
         break;
     case JavaScriptVariant::String: {
-        JSStringRef str = JSStringCreateWithUTF8CString(variant.stringValue());
+        JSStringRef str = JSStringCreateWithUTF8CString(variant.stringValue().c_str());
         ref = JSValueMakeString(ctx, str);
         JSStringRelease(str);
         break;
@@ -93,56 +98,41 @@ JSValueRef BlackBerryJavaScriptVariantToJSValueRef(const JSGlobalContextRef& ctx
 
 JavaScriptVariant::JavaScriptVariant()
     : m_type(Undefined)
-    , m_stringValue(0)
 {
 }
 
 JavaScriptVariant::JavaScriptVariant(double value)
     : m_type(Undefined)
-    , m_stringValue(0)
 {
     setDouble(value);
 }
 
 JavaScriptVariant::JavaScriptVariant(int value)
     : m_type(Undefined)
-    , m_stringValue(0)
 {
     setDouble(value);
 }
 
-JavaScriptVariant::JavaScriptVariant(const char* value)
+JavaScriptVariant::JavaScriptVariant(const BlackBerry::Platform::String& value)
     : m_type(Undefined)
-    , m_stringValue(0)
 {
     setString(value);
 }
 
-JavaScriptVariant::JavaScriptVariant(const std::string& value)
-    : m_type(Undefined)
-    , m_stringValue(0)
-{
-    setString(value.c_str());
-}
-
 JavaScriptVariant::JavaScriptVariant(bool value)
     : m_type(Undefined)
-    , m_stringValue(0)
 {
     setBoolean(value);
 }
 
 JavaScriptVariant::JavaScriptVariant(const JavaScriptVariant &v)
     : m_type(Undefined)
-    , m_stringValue(0)
 {
     this->operator=(v);
 }
 
 JavaScriptVariant::~JavaScriptVariant()
 {
-    // Prevent memory leaks if we have strings
-    setType(Undefined);
 }
 
 JavaScriptVariant& JavaScriptVariant::operator=(const JavaScriptVariant& v)
@@ -171,9 +161,8 @@ JavaScriptVariant& JavaScriptVariant::operator=(const JavaScriptVariant& v)
 void JavaScriptVariant::setType(const DataType& type)
 {
     if (m_type == String)
-        free(m_stringValue);
+        m_stringValue = BlackBerry::Platform::String::emptyString();
     m_type = type;
-    m_stringValue = 0;
 }
 
 JavaScriptVariant::DataType JavaScriptVariant::type() const
@@ -192,13 +181,13 @@ double JavaScriptVariant::doubleValue() const
     return m_doubleValue;
 }
 
-void JavaScriptVariant::setString(const char* value)
+void JavaScriptVariant::setString(const BlackBerry::Platform::String& value)
 {
     setType(String);
-    m_stringValue = strdup(value);
+    m_stringValue = value;
 }
 
-char* JavaScriptVariant::stringValue() const
+const BlackBerry::Platform::String& JavaScriptVariant::stringValue() const
 {
     return m_stringValue;
 }
index 7623a56..ef6a204 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "BlackBerryGlobal.h"
 
-#include <string>
+#include <BlackBerryPlatformString.h>
 
 namespace BlackBerry {
 namespace WebKit {
@@ -42,9 +42,8 @@ public:
     JavaScriptVariant(const JavaScriptVariant&);
     JavaScriptVariant(double);
     JavaScriptVariant(int);
-    JavaScriptVariant(const char*);
-    JavaScriptVariant(bool);
-    JavaScriptVariant(const std::string&);
+    explicit JavaScriptVariant(bool);
+    JavaScriptVariant(const BlackBerry::Platform::String&);
     ~JavaScriptVariant();
 
     JavaScriptVariant& operator=(const JavaScriptVariant&);
@@ -55,20 +54,22 @@ public:
     void setDouble(double);
     double doubleValue() const;
 
-    void setString(const char*);
-    char* stringValue() const;
+    void setString(const BlackBerry::Platform::String&);
+    const BlackBerry::Platform::String& stringValue() const;
 
     void setBoolean(bool);
     bool booleanValue() const;
 
 private:
+    JavaScriptVariant(const char*);
     DataType m_type;
 
     union {
         bool m_booleanValue;
         double m_doubleValue;
-        char* m_stringValue;
     };
+
+    BlackBerry::Platform::String m_stringValue;
 };
 
 }
index e916ca5..4ae50de 100644 (file)
 #include "LayerCompositingThread.h"
 #include "LayerWebKitThread.h"
 #include "WebAnimation_p.h"
-#include "WebString.h"
 
 #include <BlackBerryPlatformMessageClient.h>
+#include <BlackBerryPlatformString.h>
 
 namespace BlackBerry {
 namespace WebKit {
 
 using namespace WebCore;
 
-WebAnimation WebAnimation::fadeAnimation(const WebString& name, float from, float to, double duration)
+WebAnimation WebAnimation::fadeAnimation(const BlackBerry::Platform::String& name, float from, float to, double duration)
 {
     WebAnimation tmp;
-    tmp.d->name = String(name.impl());
+    tmp.d->name = name;
     tmp.d->animation = Animation::create();
     tmp.d->animation->setDuration(duration);
     tmp.d->keyframes = KeyframeValueList(AnimatedPropertyOpacity);
@@ -47,9 +47,9 @@ WebAnimation WebAnimation::fadeAnimation(const WebString& name, float from, floa
     return tmp;
 }
 
-WebString WebAnimation::name() const
+BlackBerry::Platform::String WebAnimation::name() const
 {
-    return d->name.impl();
+    return d->name;
 }
 
 WebAnimation::WebAnimation()
index 7e9297d..1ff4d61 100644 (file)
@@ -37,7 +37,7 @@ class WebAnimationPrivate;
  */
 class BLACKBERRY_EXPORT WebAnimation {
 public:
-    static WebAnimation fadeAnimation(const WebString& name, float from, float to, double duration);
+    static WebAnimation fadeAnimation(const BlackBerry::Platform::String& name, float from, float to, double duration);
 
     WebAnimation();
     WebAnimation(const WebAnimation&);
@@ -45,7 +45,7 @@ public:
 
     WebAnimation& operator=(const WebAnimation&);
 
-    WebString name() const;
+    BlackBerry::Platform::String name() const;
 
 protected:
     friend class WebOverlay;
index da8964f..796f59b 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "CookieManager.h"
 #include "KURL.h"
-#include "WebString.h"
+#include <BlackBerryPlatformString.h>
 
 using namespace WebCore;
 
@@ -33,26 +33,26 @@ WebCookieJar::WebCookieJar()
 {
 }
 
-std::vector<WebString> WebCookieJar::cookies(const char* url)
+std::vector<BlackBerry::Platform::String> WebCookieJar::cookies(const BlackBerry::Platform::String& url)
 {
-    KURL kurl = KURL(KURL(), String(url));
+    KURL kurl = KURL(KURL(), url);
 
     Vector<ParsedCookie*> rawCookies;
     cookieManager().getRawCookies(rawCookies, kurl, WithHttpOnlyCookies);
 
-    std::vector<WebString> result;
+    std::vector<BlackBerry::Platform::String> result;
     for (size_t i = 0; i < rawCookies.size(); ++i)
-        result.push_back(WebString(rawCookies[i]->toNameValuePair().impl()));
+        result.push_back(rawCookies[i]->toNameValuePair());
 
     return result;
 }
 
-void WebCookieJar::setCookies(const char* url, const std::vector<WebString>& cookies)
+void WebCookieJar::setCookies(const BlackBerry::Platform::String& url, const std::vector<BlackBerry::Platform::String>& cookies)
 {
-    KURL kurl = KURL(KURL(), String(url));
+    KURL kurl = KURL(KURL(), url);
     Vector<String> coreCookies;
     for (size_t i = 0; i < cookies.size(); ++i)
-        coreCookies.append(String(cookies[i].impl()));
+        coreCookies.append(cookies[i]);
     cookieManager().setCookies(kurl, coreCookies, WithHttpOnlyCookies);
 }
 
index 0c174e4..964756b 100644 (file)
 #include <vector>
 
 namespace BlackBerry {
+namespace Platform {
+class String;
+}
+
 namespace WebKit {
 
 class WebPage;
-class WebString;
 
 /**
  * Represents the cookie database.
@@ -41,7 +44,7 @@ public:
      *
      * All cookies whose domain and path match the provided URL will be returned.
      */
-    std::vector<WebString> cookies(const char* url);
+    std::vector<BlackBerry::Platform::String> cookies(const BlackBerry::Platform::String& url);
 
     /**
      * This will add the cookies provided in the list to the cookie database.
@@ -52,7 +55,7 @@ public:
      * If no domain and/or path is provided in a cookie, the domain and/or path
      * will be inferred from the provided URL.
      */
-    void setCookies(const char* url, const std::vector<WebString>& cookies);
+    void setCookies(const BlackBerry::Platform::String& url, const std::vector<BlackBerry::Platform::String>& cookies);
 
 private:
     friend class WebPage;
index 9c98af4..401b0bb 100644 (file)
 #include "WebKitMIMETypeConverter.h"
 
 #include "MIMETypeRegistry.h"
+#include <BlackBerryPlatformString.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
 
 namespace BlackBerry {
 namespace WebKit {
 
-bool getExtensionForMimeType(const std::string& mime, std::string& extension)
+bool getExtensionForMimeType(const BlackBerry::Platform::String& mime, BlackBerry::Platform::String& extension)
 {
-    String mimeType(mime.data(), mime.length());
-    String preferredExtension = WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType(mimeType);
-    if (preferredExtension.isEmpty())
-        return false;
-
-    CString utf8 = preferredExtension.utf8();
-    extension.clear();
-    extension.append(utf8.data(), utf8.length());
-    return true;
+    extension = WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType(mime);
+    return !extension.empty();
 }
 
-bool getMimeTypeForExtension(const std::string& extension, std::string& mimeType)
+bool getMimeTypeForExtension(const BlackBerry::Platform::String& extension, BlackBerry::Platform::String& mimeType)
 {
-    String extStr(extension.data(), extension.length());
-    String mime = WebCore::MIMETypeRegistry::getMediaMIMETypeForExtension(extStr);
-    if (mime.isEmpty())
-        return false;
-
-    CString utf8 = mime.utf8();
-    mimeType.clear();
-    mimeType.append(utf8.data(), utf8.length());
-    return true;
+    mimeType = WebCore::MIMETypeRegistry::getMediaMIMETypeForExtension(extension);
+    return !mimeType.empty();
 }
 
 } // namespace WebKit
index 3ff3d74..09d654e 100644 (file)
 #define WebKitMIMETypeConverter_h
 
 #include "BlackBerryGlobal.h"
-#include <string>
 
 namespace BlackBerry {
+namespace Platform {
+class String;
+}
+
 namespace WebKit {
 
-BLACKBERRY_EXPORT bool getExtensionForMimeType(const std::string& mime, std::string& extension);
-BLACKBERRY_EXPORT bool getMimeTypeForExtension(const std::string& extension, std::string& mimeType);
+BLACKBERRY_EXPORT bool getExtensionForMimeType(const BlackBerry::Platform::String& mime, BlackBerry::Platform::String& extension);
+BLACKBERRY_EXPORT bool getMimeTypeForExtension(const BlackBerry::Platform::String& extension, BlackBerry::Platform::String& mimeType);
 
 } // namespace WebKit
 } // namespace BlackBerry
index 1c2813e..8269c92 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "KURL.h"
 #include "TextCodecICU.h"
+#include <BlackBerryPlatformString.h>
 #include <wtf/Vector.h>
 #include <wtf/text/Base64.h>
 #include <wtf/text/CString.h>
@@ -92,7 +93,7 @@ WTF::Base64DecodePolicy base64DecodePolicyForWTF(Base64DecodePolicy policy)
     return static_cast<WTF::Base64DecodePolicy>(policy);
 }
 
-bool base64Decode(const std::string& base64, std::vector<char>& binary, Base64DecodePolicy policy)
+bool base64Decode(const BlackBerry::Platform::String& base64, std::vector<char>& binary, Base64DecodePolicy policy)
 {
     Vector<char> result;
     if (!WTF::base64Decode(base64.c_str(), base64.length(), result, base64DecodePolicyForWTF(policy)))
@@ -110,37 +111,26 @@ WTF::Base64DecodePolicy base64EncodePolicyForWTF(Base64EncodePolicy policy)
     return static_cast<WTF::Base64EncodePolicy>(policy);
 }
 
-bool base64Encode(const std::vector<char>& binary, std::string& base64, Base64EncodePolicy policy)
+bool base64Encode(const std::vector<char>& binary, BlackBerry::Platform::String& base64, Base64EncodePolicy policy)
 {
     Vector<char> result;
     result.append(&binary[0], binary.size());
 
     WTF::base64Encode(&binary[0], binary.size(), result, base64EncodePolicyForWTF(policy));
 
-    base64.clear();
-    base64.append(&result[0], result.size());
+    base64 = Blackberry::Platform::String(&result[0], result.size());
 
     return true;
 }
 
-void unescapeURL(const std::string& escaped, std::string& url)
+void unescapeURL(const BlackBerry::Platform::String& escaped, BlackBerry::Platform::String& url)
 {
-    String escapedString(escaped.data(), escaped.length());
-    String urlString = WebCore::decodeURLEscapeSequences(escapedString);
-    CString utf8 = urlString.utf8();
-
-    url.clear();
-    url.append(utf8.data(), utf8.length());
+    url = WebCore::decodeURLEscapeSequences(escaped);
 }
 
-void escapeURL(const std::string& url, std::string& escaped)
+void escapeURL(const BlackBerry::Platform::String& url, BlackBerry::Platform::String& escaped)
 {
-    String urlString(url.data(), url.length());
-    String escapedString = WebCore::encodeWithURLEscapeSequences(urlString);
-    CString utf8 = escapedString.utf8();
-
-    escaped.clear();
-    escaped.append(utf8.data(), utf8.length());
+    escaped = WebCore::encodeWithURLEscapeSequences(url);
 }
 
 } // namespace WebKit
index 2834be7..b6a19e0 100644 (file)
 #define WebKitTextCodec_h
 
 #include "BlackBerryGlobal.h"
-#include <string>
 #include <vector>
 
 namespace BlackBerry {
+namespace Platform {
+class String;
+}
+
 namespace WebKit {
 
 enum TranscodeResult {
@@ -49,11 +52,11 @@ BLACKBERRY_EXPORT bool isSameEncoding(const char* encoding1, const char* encodin
 BLACKBERRY_EXPORT bool isASCIICompatibleEncoding(const char* encoding);
 BLACKBERRY_EXPORT TranscodeResult transcode(const char* sourceEncoding, const char* targetEncoding, const char*& sourceStart, int sourceLength, char*& targetStart, unsigned targetLength);
 
-BLACKBERRY_EXPORT bool base64Decode(const std::string& base64, std::vector<char>& binary, Base64DecodePolicy);
-BLACKBERRY_EXPORT bool base64Encode(const std::vector<char>& binary, std::string& base64, Base64EncodePolicy);
+BLACKBERRY_EXPORT bool base64Decode(const BlackBerry::Platform::String& base64, std::vector<char>& binary, Base64DecodePolicy);
+BLACKBERRY_EXPORT bool base64Encode(const std::vector<char>& binary, BlackBerry::Platform::String& base64, Base64EncodePolicy);
 
-BLACKBERRY_EXPORT void unescapeURL(const std::string& escaped, std::string& url);
-BLACKBERRY_EXPORT void escapeURL(const std::string& url, std::string& escaped);
+BLACKBERRY_EXPORT void unescapeURL(const BlackBerry::Platform::String& escaped, BlackBerry::Platform::String& url);
+BLACKBERRY_EXPORT void escapeURL(const BlackBerry::Platform::String& url, BlackBerry::Platform::String& escaped);
 
 } // namespace WebKit
 } // namespace BlackBerry
index 0d9a099..d8b2bdc 100644 (file)
@@ -34,9 +34,9 @@
 #include "WebPageCompositorClient.h"
 #include "WebPageCompositor_p.h"
 #include "WebPage_p.h"
-#include "WebString.h"
 
 #include <BlackBerryPlatformMessageClient.h>
+#include <BlackBerryPlatformString.h>
 #include <GLES2/gl2.h>
 #include <SkDevice.h>
 
@@ -137,9 +137,9 @@ void WebOverlay::addAnimation(const WebAnimation& animation)
     d->addAnimation(animation.d->name, animation.d->animation.get(), animation.d->keyframes);
 }
 
-void WebOverlay::removeAnimation(const WebString& name)
+void WebOverlay::removeAnimation(const BlackBerry::Platform::String& name)
 {
-    d->removeAnimation(String(PassRefPtr<StringImpl>(name.impl())));
+    d->removeAnimation(name);
 }
 
 WebOverlay* WebOverlay::parent() const
@@ -754,7 +754,7 @@ void WebOverlay::addAnimation(const WebAnimation&)
 {
 }
 
-void WebOverlay::removeAnimation(const WebString&)
+void WebOverlay::removeAnimation(const BlackBerry::Platform::String&)
 {
 }
 
index a59f60e..d6cd7b2 100644 (file)
@@ -29,6 +29,10 @@ class GraphicsLayerClient;
 }
 
 namespace BlackBerry {
+namespace Platform {
+class String;
+}
+
 namespace WebKit {
 
 class WebAnimation;
@@ -36,7 +40,6 @@ class WebOverlayClient;
 class WebOverlayOverride;
 class WebOverlayPrivate;
 class WebPage;
-class WebString;
 
 /**
  * Represents an overlay that is rendered superimposed on a web page.
@@ -90,10 +93,10 @@ public:
     void setOpacity(float);
 
     // Adds/removes an animation
-    // Note that WebAnimation and WebString are not thread safe and have to be
+    // Note that WebAnimation and BlackBerry::Platform::String are not thread safe and have to be
     // created on the thread where they'll be used.
     void addAnimation(const WebAnimation&);
-    void removeAnimation(const WebString& name);
+    void removeAnimation(const BlackBerry::Platform::String& name);
 
     WebOverlay* parent() const;
     bool addChild(WebOverlay*);
index 831b2f9..1ba6036 100644 (file)
@@ -24,9 +24,9 @@
 #include "WebAnimation.h"
 #include "WebAnimation_p.h"
 #include "WebOverlay_p.h"
-#include "WebString.h"
 
 #include <BlackBerryPlatformMessageClient.h>
+#include <BlackBerryPlatformString.h>
 #include <wtf/CurrentTime.h>
 
 namespace BlackBerry {
@@ -86,9 +86,9 @@ void WebOverlayOverride::addAnimation(const WebAnimation& animation)
     d->scheduleCompositingRun();
 }
 
-void WebOverlayOverride::removeAnimation(const WebString& name)
+void WebOverlayOverride::removeAnimation(const BlackBerry::Platform::String& name)
 {
-    d->layerCompositingThread()->override()->removeAnimation(String(PassRefPtr<StringImpl>(name.impl())));
+    d->layerCompositingThread()->override()->removeAnimation(name);
     d->scheduleCompositingRun();
 }
 
@@ -130,7 +130,7 @@ void WebOverlayOverride::addAnimation(const WebAnimation&)
 {
 }
 
-void WebOverlayOverride::removeAnimation(const WebString&)
+void WebOverlayOverride::removeAnimation(const BlackBerry::Platform::String&)
 {
 }
 
index 3c1b654..adfc12b 100644 (file)
 #include <BlackBerryPlatformPrimitives.h>
 
 namespace BlackBerry {
+namespace Platform {
+class String;
+}
+
 namespace WebKit {
 
 class WebAnimation;
 class WebOverlayPrivate;
-class WebString;
 
 /**
  * Compositing thread only
  *
- * Note that the WebAnimation and WebString classes are not thread safe, but
+ * Note that the WebAnimation class is not thread safe, but
  * reentrant, and have to be created on the thread where they'll be used.
  */
 class BLACKBERRY_EXPORT WebOverlayOverride {
@@ -49,7 +52,7 @@ public:
     void setOpacity(float);
 
     void addAnimation(const WebAnimation&);
-    void removeAnimation(const WebString& name);
+    void removeAnimation(const BlackBerry::Platform::String& name);
 
 private:
     friend class WebOverlayPrivate;
index 48d2d90..7b5d14e 100644 (file)
@@ -333,12 +333,12 @@ protected:
     typedef DeferredTask<isActive> DeferredTaskType;
 };
 
-void WebPage::autofillTextField(const string& item)
+void WebPage::autofillTextField(const BlackBerry::Platform::String& item)
 {
     if (!d->m_webSettings->isFormAutofillEnabled())
         return;
 
-    d->m_autofillManager->autofillTextField(item.c_str());
+    d->m_autofillManager->autofillTextField(item);
 }
 
 void WebPage::enableQnxJavaScriptObject(bool enabled)
@@ -346,10 +346,9 @@ void WebPage::enableQnxJavaScriptObject(bool enabled)
     d->m_enableQnxJavaScriptObject = enabled;
 }
 
-WebString WebPage::renderTreeAsText()
+BlackBerry::Platform::String WebPage::renderTreeAsText()
 {
-    String result = externalRepresentation(d->m_mainFrame);
-    return WebString(result.impl());
+    return externalRepresentation(d->m_mainFrame);
 }
 
 WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const IntRect& rect)
@@ -443,7 +442,7 @@ WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const In
     AuthenticationChallengeManager::instance()->pageCreated(this);
 }
 
-WebPage::WebPage(WebPageClient* client, const WebString& pageGroupName, const Platform::IntRect& rect)
+WebPage::WebPage(WebPageClient* client, const BlackBerry::Platform::String& pageGroupName, const Platform::IntRect& rect)
 {
     globalInitialize();
     d = new WebPagePrivate(this, client, rect);
@@ -511,7 +510,7 @@ Page* WebPagePrivate::core(const WebPage* webPage)
     return webPage->d->m_page;
 }
 
-void WebPagePrivate::init(const WebString& pageGroupName)
+void WebPagePrivate::init(const BlackBerry::Platform::String& pageGroupName)
 {
     ChromeClientBlackBerry* chromeClient = new ChromeClientBlackBerry(this);
     ContextMenuClientBlackBerry* contextMenuClient = 0;
@@ -665,7 +664,7 @@ private:
     }
 };
 
-void WebPagePrivate::load(const char* url, const char* networkToken, const char* method, Platform::NetworkRequest::CachePolicy cachePolicy, const char* data, size_t dataLength, const char* const* headers, size_t headersLength, bool isInitial, bool mustHandleInternally, bool forceDownload, const char* overrideContentType, const char* suggestedSaveName)
+void WebPagePrivate::load(const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& networkToken, const BlackBerry::Platform::String& method, Platform::NetworkRequest::CachePolicy cachePolicy, const char* data, size_t dataLength, const char* const* headers, size_t headersLength, bool isInitial, bool mustHandleInternally, bool forceDownload, const BlackBerry::Platform::String& overrideContentType, const BlackBerry::Platform::String& suggestedSaveName)
 {
     stopCurrentLoad();
     DeferredTaskLoadManualScript::finishOrCancel(this);
@@ -696,7 +695,7 @@ void WebPagePrivate::load(const char* url, const char* networkToken, const char*
         request.setMustHandleInternally(true);
     request.setHTTPMethod(method);
     request.setCachePolicy(toWebCoreCachePolicy(cachePolicy));
-    if (overrideContentType)
+    if (!overrideContentType.empty())
         request.setOverrideContentType(overrideContentType);
 
     if (data)
@@ -713,7 +712,7 @@ void WebPagePrivate::load(const char* url, const char* networkToken, const char*
     m_mainFrame->loader()->load(request, "" /* name */, false);
 }
 
-void WebPage::load(const char* url, const char* networkToken, bool isInitial)
+void WebPage::load(const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& networkToken, bool isInitial)
 {
     d->load(url, networkToken, "GET", Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, isInitial, false);
 }
@@ -723,15 +722,15 @@ void WebPage::loadExtended(const char* url, const char* networkToken, const char
     d->load(url, networkToken, method, cachePolicy, data, dataLength, headers, headersLength, false, mustHandleInternally, false, "");
 }
 
-void WebPage::loadFile(const char* path, const char* overrideContentType)
+void WebPage::loadFile(const BlackBerry::Platform::String& path, const BlackBerry::Platform::String& overrideContentType)
 {
-    std::string fileUrl(path);
-    if (!fileUrl.find("/"))
-        fileUrl.insert(0, "file://");
-    else if (fileUrl.find("file:///"))
+    BlackBerry::Platform::String fileUrl(path);
+    if (fileUrl.startsWith("/"))
+        fileUrl = BlackBerry::Platform::String("file://", 7) + fileUrl;
+    else if (!fileUrl.startsWith("file:///"))
         return;
 
-    d->load(fileUrl.c_str(), 0, "GET", Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, false, false, false, overrideContentType);
+    d->load(fileUrl, BlackBerry::Platform::String::emptyString(), BlackBerry::Platform::String("GET", 3), Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, false, false, false, overrideContentType.c_str());
 }
 
 void WebPage::download(const Platform::NetworkRequest& request)
@@ -742,30 +741,31 @@ void WebPage::download(const Platform::NetworkRequest& request)
         headers.push_back(list[i].first.c_str());
         headers.push_back(list[i].second.c_str());
     }
-    d->load(request.getUrlRef().c_str(), 0, "GET", Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, headers.empty() ? 0 : &headers[0], headers.size(), false, false, true, "", request.getSuggestedSaveName().c_str());
+    d->load(request.getUrlRef(), BlackBerry::Platform::String::emptyString(), "GET", Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, headers.empty() ? 0 : &headers[0], headers.size(), false, false, true, "", request.getSuggestedSaveName().c_str());
 }
 
-void WebPagePrivate::loadString(const char* string, const char* baseURL, const char* contentType, const char* failingURL)
+void WebPagePrivate::loadString(const BlackBerry::Platform::String& string, const BlackBerry::Platform::String& baseURL, const BlackBerry::Platform::String& contentType, const BlackBerry::Platform::String& failingURL)
 {
     KURL kurl = parseUrl(baseURL);
     ResourceRequest request(kurl);
     WTF::RefPtr<SharedBuffer> buffer
-        = SharedBuffer::create(string, strlen(string));
+        = SharedBuffer::create(string.c_str(), string.length());
     SubstituteData substituteData(buffer,
-                                  extractMIMETypeFromMediaType(contentType),
-                                  extractCharsetFromMediaType(contentType),
-                                  failingURL ? parseUrl(failingURL) : KURL());
+        extractMIMETypeFromMediaType(contentType),
+        extractCharsetFromMediaType(contentType),
+        !failingURL.empty() ? parseUrl(failingURL) : KURL());
     m_mainFrame->loader()->load(request, substituteData, false);
 }
 
-void WebPage::loadString(const char* string, const char* baseURL, const char* mimeType, const char* failingURL)
+void WebPage::loadString(const BlackBerry::Platform::String& string, const BlackBerry::Platform::String& baseURL, const BlackBerry::Platform::String& mimeType, const BlackBerry::Platform::String& failingURL)
 {
     d->loadString(string, baseURL, mimeType, failingURL);
 }
 
-bool WebPagePrivate::executeJavaScript(const char* scriptUTF8, JavaScriptDataType& returnType, WebString& returnValue)
+bool WebPagePrivate::executeJavaScript(const BlackBerry::Platform::String& scriptUTF8, JavaScriptDataType& returnType, WebString& returnValue)
 {
-    String script = String::fromUTF8(scriptUTF8);
+    BLACKBERRY_ASSERT(scriptUTF8.isUtf8());
+    String script = scriptUTF8;
 
     if (script.isNull()) {
         returnType = JSException;
@@ -812,20 +812,18 @@ bool WebPagePrivate::executeJavaScript(const char* scriptUTF8, JavaScriptDataTyp
         break;
     }
 
-    if (returnType == JSBoolean || returnType == JSNumber || returnType == JSString || returnType == JSObject) {
-        String str = result.toString(exec);
-        returnValue = WebString(str.impl());
-    }
+    if (returnType == JSBoolean || returnType == JSNumber || returnType == JSString || returnType == JSObject)
+        returnValue = result.toString(exec);
 
     return true;
 }
 
-bool WebPage::executeJavaScript(const char* script, JavaScriptDataType& returnType, WebString& returnValue)
+bool WebPage::executeJavaScript(const BlackBerry::Platform::String& script, JavaScriptDataType& returnType, BlackBerry::Platform::String& returnValue)
 {
     return d->executeJavaScript(script, returnType, returnValue);
 }
 
-bool WebPagePrivate::executeJavaScriptInIsolatedWorld(const ScriptSourceCode& sourceCode, JavaScriptDataType& returnType, WebString& returnValue)
+bool WebPagePrivate::executeJavaScriptInIsolatedWorld(const ScriptSourceCode& sourceCode, JavaScriptDataType& returnType, BlackBerry::Platform::String& returnValue)
 {
     if (!m_isolatedWorld)
         m_isolatedWorld = m_mainFrame->script()->createWorld();
@@ -865,15 +863,13 @@ bool WebPagePrivate::executeJavaScriptInIsolatedWorld(const ScriptSourceCode& so
         break;
     }
 
-    if (returnType == JSBoolean || returnType == JSNumber || returnType == JSString || returnType == JSObject) {
-        String str = result.toString(exec);
-        returnValue = WebString(str.impl());
-    }
+    if (returnType == JSBoolean || returnType == JSNumber || returnType == JSString || returnType == JSObject)
+        returnValue = result.toString(exec);
 
     return true;
 }
 
-bool WebPage::executeJavaScriptInIsolatedWorld(const std::wstring& script, JavaScriptDataType& returnType, WebString& returnValue)
+bool WebPage::executeJavaScriptInIsolatedWorld(const std::wstring& script, JavaScriptDataType& returnType, BlackBerry::Platform::String& returnValue)
 {
     // On our platform wchar_t is unsigned int and UChar is unsigned short
     // so we have to convert using ICU conversion function
@@ -894,13 +890,14 @@ bool WebPage::executeJavaScriptInIsolatedWorld(const std::wstring& script, JavaS
     return d->executeJavaScriptInIsolatedWorld(sourceCode, returnType, returnValue);
 }
 
-bool WebPage::executeJavaScriptInIsolatedWorld(const char* script, JavaScriptDataType& returnType, WebString& returnValue)
+bool WebPage::executeJavaScriptInIsolatedWorld(const BlackBerry::Platform::String& scriptUTF8, JavaScriptDataType& returnType, BlackBerry::Platform::String& returnValue)
 {
-    ScriptSourceCode sourceCode(String::fromUTF8(script), KURL());
+    BLACKBERRY_ASSERT(scriptUTF8.isUtf8());
+    ScriptSourceCode sourceCode(scriptUTF8, KURL());
     return d->executeJavaScriptInIsolatedWorld(sourceCode, returnType, returnValue);
 }
 
-void WebPage::executeJavaScriptFunction(const std::vector<std::string> &function, const std::vector<JavaScriptVariant> &args, JavaScriptVariant& returnValue)
+void WebPage::executeJavaScriptFunction(const std::vector<BlackBerry::Platform::String> &function, const std::vector<JavaScriptVariant> &args, JavaScriptVariant& returnValue)
 {
     if (!d->m_mainFrame) {
         returnValue.setType(JavaScriptVariant::Exception);
@@ -1022,7 +1019,7 @@ void WebPage::enableCrossSiteXHR()
     d->enableCrossSiteXHR();
 }
 
-void WebPagePrivate::addOriginAccessWhitelistEntry(const char* sourceOrigin, const char* destinationOrigin, bool allowDestinationSubdomains)
+void WebPagePrivate::addOriginAccessWhitelistEntry(const BlackBerry::Platform::String& sourceOrigin, const BlackBerry::Platform::String& destinationOrigin, bool allowDestinationSubdomains)
 {
     RefPtr<SecurityOrigin> source = SecurityOrigin::createFromString(sourceOrigin);
     if (source->isUnique())
@@ -1032,12 +1029,12 @@ void WebPagePrivate::addOriginAccessWhitelistEntry(const char* sourceOrigin, con
     SecurityPolicy::addOriginAccessWhitelistEntry(*source, destination.protocol(), destination.host(), allowDestinationSubdomains);
 }
 
-void WebPage::addOriginAccessWhitelistEntry(const char* sourceOrigin, const char* destinationOrigin, bool allowDestinationSubdomains)
+void WebPage::addOriginAccessWhitelistEntry(const BlackBerry::Platform::String& sourceOrigin, const BlackBerry::Platform::String& destinationOrigin, bool allowDestinationSubdomains)
 {
     d->addOriginAccessWhitelistEntry(sourceOrigin, destinationOrigin, allowDestinationSubdomains);
 }
 
-void WebPagePrivate::removeOriginAccessWhitelistEntry(const char* sourceOrigin, const char* destinationOrigin, bool allowDestinationSubdomains)
+void WebPagePrivate::removeOriginAccessWhitelistEntry(const BlackBerry::Platform::String& sourceOrigin, const BlackBerry::Platform::String& destinationOrigin, bool allowDestinationSubdomains)
 {
     RefPtr<SecurityOrigin> source = SecurityOrigin::createFromString(sourceOrigin);
     if (source->isUnique())
@@ -1047,7 +1044,7 @@ void WebPagePrivate::removeOriginAccessWhitelistEntry(const char* sourceOrigin,
     SecurityPolicy::removeOriginAccessWhitelistEntry(*source, destination.protocol(), destination.host(), allowDestinationSubdomains);
 }
 
-void WebPage::removeOriginAccessWhitelistEntry(const char* sourceOrigin, const char* destinationOrigin, bool allowDestinationSubdomains)
+void WebPage::removeOriginAccessWhitelistEntry(const BlackBerry::Platform::String& sourceOrigin, const BlackBerry::Platform::String& destinationOrigin, bool allowDestinationSubdomains)
 {
     d->removeOriginAccessWhitelistEntry(sourceOrigin, destinationOrigin, allowDestinationSubdomains);
 }
@@ -2209,9 +2206,9 @@ bool WebPagePrivate::isActive() const
 
 void WebPagePrivate::authenticationChallenge(const KURL& url, const ProtectionSpace& protectionSpace, const Credential& inputCredential)
 {
-    WebString username;
-    WebString password;
     AuthenticationChallengeManager* authmgr = AuthenticationChallengeManager::instance();
+    BlackBerry::Platform::String username;
+    BlackBerry::Platform::String password;
 
 #if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD
     if (m_dumpRenderTree) {
@@ -2252,14 +2249,14 @@ PageClientBlackBerry::SaveCredentialType WebPagePrivate::notifyShouldSaveCredent
 
 void WebPagePrivate::syncProxyCredential(const WebCore::Credential& credential)
 {
-    m_client->syncProxyCredential(credential.user().utf8().data(), credential.password().utf8().data());
+    m_client->syncProxyCredential(credential.user(), credential.password());
 }
 
 void WebPagePrivate::notifyPopupAutofillDialog(const Vector<String>& candidates, const WebCore::IntRect& screenRect)
 {
-    vector<string> textItems;
+    vector<BlackBerry::Platform::String> textItems;
     for (size_t i = 0; i < candidates.size(); i++)
-        textItems.push_back(candidates[i].utf8().data());
+        textItems.push_back(candidates[i]);
     m_client->notifyPopupAutofillDialog(textItems, screenRect);
 }
 
@@ -2308,10 +2305,10 @@ Platform::WebContext WebPagePrivate::webContext(TargetDetectionStrategy strategy
 
         String pattern = findPatternStringForUrl(href);
         if (!pattern.isEmpty())
-            context.setPattern(pattern.utf8().data());
+            context.setPattern(pattern);
 
         if (!href.string().isEmpty()) {
-            context.setUrl(href.string().utf8().data());
+            context.setUrl(href.string());
 
             // Links are non-selectable by default, but selection should be allowed
             // providing the page is selectable, use the parent to determine it.
@@ -2338,12 +2335,12 @@ Platform::WebContext WebPagePrivate::webContext(TargetDetectionStrategy strategy
             if (CachedResource* cachedResource = imageElement->cachedImage()) {
                 if (cachedResource->isLoaded() && cachedResource->data()) {
                     String url = stripLeadingAndTrailingHTMLSpaces(imageElement->getAttribute(HTMLNames::srcAttr).string());
-                    context.setSrc(node->document()->completeURL(url).string().utf8().data());
+                    context.setSrc(node->document()->completeURL(url).string());
                 }
             }
             String alt = imageElement->altText();
             if (!alt.isNull())
-                context.setAlt(alt.utf8().data());
+                context.setAlt(alt);
         }
 
         if (mediaElement) {
@@ -2353,14 +2350,14 @@ Platform::WebContext WebPagePrivate::webContext(TargetDetectionStrategy strategy
                 context.setFlag(Platform::WebContext::IsVideo);
 
             String src = stripLeadingAndTrailingHTMLSpaces(mediaElement->getAttribute(HTMLNames::srcAttr).string());
-            context.setSrc(node->document()->completeURL(src).string().utf8().data());
+            context.setSrc(node->document()->completeURL(src).string());
         }
     }
 
     if (node->isTextNode()) {
         Text* curText = toText(node.get());
         if (!curText->wholeText().isEmpty())
-            context.setText(curText->wholeText().utf8().data());
+            context.setText(curText->wholeText());
     }
 
     bool canStartSelection = node->canStartSelection();
@@ -2371,7 +2368,7 @@ Platform::WebContext WebPagePrivate::webContext(TargetDetectionStrategy strategy
         String webWorksContext(DOMSupport::webWorksContext(element));
         if (!webWorksContext.stripWhiteSpace().isEmpty()) {
             context.setFlag(Platform::WebContext::IsWebWorksContext);
-            context.setWebWorksContext(webWorksContext.utf8().data());
+            context.setWebWorksContext(webWorksContext);
         }
 
         if (DOMSupport::isTextBasedContentEditableElement(element)) {
@@ -2390,7 +2387,7 @@ Platform::WebContext WebPagePrivate::webContext(TargetDetectionStrategy strategy
 
             String elementText(DOMSupport::inputElementText(element));
             if (!elementText.stripWhiteSpace().isEmpty())
-                context.setText(elementText.utf8().data());
+                context.setText(elementText);
         }
     }
 
@@ -3324,7 +3321,7 @@ int WebPage::inputCaretPosition() const
 
 class DeferredTaskPopupListSelectMultiple: public DeferredTask<&WebPagePrivate::m_wouldPopupListSelectMultiple> {
 public:
-    DeferredTaskPopupListSelectMultiple(WebPagePrivate* webPagePrivate, int size, const bool* selecteds) 
+    DeferredTaskPopupListSelectMultiple(WebPagePrivate* webPagePrivate, int size, const bool* selecteds)
         : DeferredTaskType(webPagePrivate)
     {
         webPagePrivate->m_cachedPopupListSelecteds.append(selecteds, size);
@@ -3374,7 +3371,7 @@ void WebPage::popupListClosed(int index)
 
 class DeferredTaskSetDateTimeInput: public DeferredTask<&WebPagePrivate::m_wouldSetDateTimeInput> {
 public:
-    explicit DeferredTaskSetDateTimeInput(WebPagePrivate* webPagePrivate, WebString value)
+    explicit DeferredTaskSetDateTimeInput(WebPagePrivate* webPagePrivate, BlackBerry::Platform::String value)
         : DeferredTaskType(webPagePrivate)
     {
         webPagePrivate->m_cachedDateTimeInput = value;
@@ -3386,19 +3383,19 @@ private:
     }
 };
 
-void WebPage::setDateTimeInput(const WebString& value)
+void WebPage::setDateTimeInput(const BlackBerry::Platform::String& value)
 {
     if (d->m_page->defersLoading()) {
         d->m_deferredTasks.append(adoptPtr(new DeferredTaskSetDateTimeInput(d, value)));
         return;
     }
     DeferredTaskSetDateTimeInput::finishOrCancel(d);
-    d->m_inputHandler->setInputValue(String(value.impl()));
+    d->m_inputHandler->setInputValue(value);
 }
 
 class DeferredTaskSetColorInput: public DeferredTask<&WebPagePrivate::m_wouldSetColorInput> {
 public:
-    explicit DeferredTaskSetColorInput(WebPagePrivate* webPagePrivate, WebString value)
+    explicit DeferredTaskSetColorInput(WebPagePrivate* webPagePrivate, BlackBerry::Platform::String value)
         : DeferredTaskType(webPagePrivate)
     {
         webPagePrivate->m_cachedColorInput = value;
@@ -3410,14 +3407,14 @@ private:
     }
 };
 
-void WebPage::setColorInput(const WebString& value)
+void WebPage::setColorInput(const BlackBerry::Platform::String& value)
 {
     if (d->m_page->defersLoading()) {
         d->m_deferredTasks.append(adoptPtr(new DeferredTaskSetColorInput(d, value)));
         return;
     }
     DeferredTaskSetColorInput::finishOrCancel(d);
-    d->m_inputHandler->setInputValue(String(value.impl()));
+    d->m_inputHandler->setInputValue(value);
 }
 
 void WebPage::setVirtualViewportSize(int width, int height)
@@ -4249,7 +4246,7 @@ void WebPagePrivate::clearFocusNode()
         frame->page()->focusController()->setFocusedNode(0, frame);
 }
 
-WebString WebPage::textEncoding()
+BlackBerry::Platform::String WebPage::textEncoding()
 {
     Frame* frame = d->focusedOrMainFrame();
     if (!frame)
@@ -4262,22 +4259,22 @@ WebString WebPage::textEncoding()
     return document->loader()->writer()->encoding();
 }
 
-WebString WebPage::forcedTextEncoding()
+BlackBerry::Platform::String WebPage::forcedTextEncoding()
 {
     Frame* frame = d->focusedOrMainFrame();
     if (!frame)
-        return "";
+        return BlackBerry::Platform::String::emptyString();
 
     Document* document = frame->document();
     if (!document)
-        return "";
+        return BlackBerry::Platform::String::emptyString();
 
     return document->loader()->overrideEncoding();
 }
 
-void WebPage::setForcedTextEncoding(const char* encoding)
+void WebPage::setForcedTextEncoding(const BlackBerry::Platform::String& encoding)
 {
-    if (encoding && d->focusedOrMainFrame() && d->focusedOrMainFrame()->loader() && d->focusedOrMainFrame()->loader())
+    if (!encoding.empty() && d->focusedOrMainFrame() && d->focusedOrMainFrame()->loader() && d->focusedOrMainFrame()->loader())
         return d->focusedOrMainFrame()->loader()->reloadWithOverrideEncoding(encoding);
 }
 
@@ -4445,27 +4442,27 @@ bool WebPage::selectionContains(const Platform::IntPoint& point)
     return d->m_selectionHandler->selectionContains(d->mapFromTransformed(point));
 }
 
-WebString WebPage::title() const
+BlackBerry::Platform::String WebPage::title() const
 {
     if (d->m_mainFrame->document())
         return d->m_mainFrame->loader()->documentLoader()->title().string();
-    return WebString();
+    return BlackBerry::Platform::String::emptyString();
 }
 
-WebString WebPage::selectedText() const
+BlackBerry::Platform::String WebPage::selectedText() const
 {
     return d->m_selectionHandler->selectedText();
 }
 
-WebString WebPage::cutSelectedText()
+BlackBerry::Platform::String WebPage::cutSelectedText()
 {
-    WebString selectedText = d->m_selectionHandler->selectedText();
-    if (!d->m_page->defersLoading() && !selectedText.isEmpty())
+    BlackBerry::Platform::String selectedText = d->m_selectionHandler->selectedText();
+    if (!d->m_page->defersLoading() && !selectedText.empty())
         d->m_inputHandler->deleteSelection();
     return selectedText;
 }
 
-void WebPage::insertText(const WebString& string)
+void WebPage::insertText(const BlackBerry::Platform::String& string)
 {
     if (d->m_page->defersLoading())
         return;
@@ -5057,6 +5054,7 @@ void WebPage::getBackForwardList(SharedArray<BackForwardEntry>& result) const
         resultEntry.lastVisitWasHTTPNonGet = entry->lastVisitWasHTTPNonGet();
         resultEntry.id = backForwardIdFromHistoryItem(entry.get());
 
+        // FIXME: seems we can remove this now?
         // Make sure the HistoryItem is not disposed while the result list is still being used, to make sure the pointer is not reused
         // will be balanced by deref in releaseBackForwardEntry.
         entry->ref();
@@ -5367,7 +5365,7 @@ void WebPage::onNetworkAvailabilityChanged(bool available)
     updateOnlineStatus(available);
 }
 
-void WebPage::onCertificateStoreLocationSet(const WebString& caPath)
+void WebPage::onCertificateStoreLocationSet(const BlackBerry::Platform::String& caPath)
 {
 #if ENABLE(VIDEO)
     MediaPlayerPrivate::setCertificatePath(caPath);
@@ -5419,10 +5417,9 @@ void WebPage::disablePasswordEcho()
     d->m_page->settings()->setPasswordEchoEnabled(false);
 }
 
-void WebPage::dispatchInspectorMessage(const std::string& message)
+void WebPage::dispatchInspectorMessage(const BlackBerry::Platform::String& message)
 {
-    String stringMessage = String::fromUTF8(message.data(), message.length());
-    d->m_page->inspectorController()->dispatchMessageFromFrontend(stringMessage);
+    d->m_page->inspectorController()->dispatchMessageFromFrontend(message);
 }
 
 void WebPage::inspectCurrentContextElement()
@@ -6003,26 +6000,26 @@ void WebPagePrivate::didChangeSettings(WebSettings* webSettings)
     coreSettings->setDefaultFixedFontSize(webSettings->defaultFixedFontSize());
     coreSettings->setDefaultFontSize(webSettings->defaultFontSize());
     coreSettings->setMinimumLogicalFontSize(webSettings->minimumFontSize());
-    if (!webSettings->serifFontFamily().isEmpty())
-        coreSettings->setSerifFontFamily(webSettings->serifFontFamily().impl());
-    if (!webSettings->fixedFontFamily().isEmpty())
-        coreSettings->setFixedFontFamily(webSettings->fixedFontFamily().impl());
-    if (!webSettings->sansSerifFontFamily().isEmpty())
-        coreSettings->setSansSerifFontFamily(webSettings->sansSerifFontFamily().impl());
-    if (!webSettings->standardFontFamily().isEmpty())
-        coreSettings->setStandardFontFamily(webSettings->standardFontFamily().impl());
+    if (!webSettings->serifFontFamily().empty())
+        coreSettings->setSerifFontFamily(String(webSettings->serifFontFamily()));
+    if (!webSettings->fixedFontFamily().empty())
+        coreSettings->setFixedFontFamily(String(webSettings->fixedFontFamily()));
+    if (!webSettings->sansSerifFontFamily().empty())
+        coreSettings->setSansSerifFontFamily(String(webSettings->sansSerifFontFamily()));
+    if (!webSettings->standardFontFamily().empty())
+        coreSettings->setStandardFontFamily(String(webSettings->standardFontFamily()));
     coreSettings->setJavaScriptCanOpenWindowsAutomatically(webSettings->canJavaScriptOpenWindowsAutomatically());
     coreSettings->setAllowScriptsToCloseWindows(webSettings->canJavaScriptOpenWindowsAutomatically()); // Why are we using the same value as setJavaScriptCanOpenWindowsAutomatically()?
     coreSettings->setPluginsEnabled(webSettings->arePluginsEnabled());
-    coreSettings->setDefaultTextEncodingName(webSettings->defaultTextEncodingName().impl());
+    coreSettings->setDefaultTextEncodingName(webSettings->defaultTextEncodingName());
     coreSettings->setDownloadableBinaryFontsEnabled(webSettings->downloadableBinaryFontsEnabled());
     coreSettings->setSpatialNavigationEnabled(m_webSettings->isSpatialNavigationEnabled());
     coreSettings->setAsynchronousSpellCheckingEnabled(m_webSettings->isAsynchronousSpellCheckingEnabled());
 
-    WebString stylesheetURL = webSettings->userStyleSheetString();
-    if (stylesheetURL.isEmpty())
+    BlackBerry::Platform::String stylesheetURL = webSettings->userStyleSheetString();
+    if (stylesheetURL.empty())
         stylesheetURL = webSettings->userStyleSheetLocation();
-    if (!stylesheetURL.isEmpty())
+    if (!stylesheetURL.empty())
         coreSettings->setUserStyleSheetLocation(KURL(KURL(), stylesheetURL));
 
     coreSettings->setFirstScheduledLayoutDelay(webSettings->firstScheduledLayoutDelay());
@@ -6033,14 +6030,14 @@ void WebPagePrivate::didChangeSettings(WebSettings* webSettings)
     // make sense to change database path after DatabaseTracker has
     // already been initialized.
     static bool dbinit = false;
-    if (!dbinit && !webSettings->databasePath().isEmpty()) {
+    if (!dbinit && !webSettings->databasePath().empty()) {
         dbinit = true;
         DatabaseTracker::initializeTracker(webSettings->databasePath());
     }
 
     // The directory of cacheStorage for one page group can only be initialized once.
     static bool acinit = false;
-    if (!acinit && !webSettings->appCachePath().isEmpty()) {
+    if (!acinit && !webSettings->appCachePath().empty()) {
         acinit = true;
         cacheStorage().setCacheDirectory(webSettings->appCachePath());
     }
@@ -6099,7 +6096,7 @@ void WebPagePrivate::didChangeSettings(WebSettings* webSettings)
     m_page->setDeviceScaleFactor(webSettings->devicePixelRatio());
 }
 
-WebString WebPage::textHasAttribute(const WebString& query) const
+BlackBerry::Platform::String WebPage::textHasAttribute(const BlackBerry::Platform::String& query) const
 {
     if (Document* doc = d->m_page->focusController()->focusedOrMainFrame()->document())
         return doc->queryCommandValue(query);
@@ -6107,10 +6104,10 @@ WebString WebPage::textHasAttribute(const WebString& query) const
     return "";
 }
 
-void WebPage::setAllowNotification(const WebString& domain, bool allow)
+void WebPage::setAllowNotification(const BlackBerry::Platform::String& domain, bool allow)
 {
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-    static_cast<NotificationPresenterImpl*>(NotificationPresenterImpl::instance())->onPermission(domain.utf8(), allow);
+    static_cast<NotificationPresenterImpl*>(NotificationPresenterImpl::instance())->onPermission(domain.c_str(), allow);
 #else
     UNUSED_PARAM(domain);
     UNUSED_PARAM(allow);
@@ -6165,10 +6162,10 @@ void WebPagePrivate::frameUnloaded(const Frame* frame)
     m_inPageSearchManager->frameUnloaded(frame);
 }
 
-const String& WebPagePrivate::defaultUserAgent()
+const BlackBerry::Platform::String& WebPagePrivate::defaultUserAgent()
 {
-    static String* defaultUserAgent = new String;
-    if (defaultUserAgent->isEmpty()) {
+    static BlackBerry::Platform::String* defaultUserAgent = 0;
+    if (!defaultUserAgent) {
         BlackBerry::Platform::DeviceInfo* info = BlackBerry::Platform::DeviceInfo::instance();
         char uaBuffer[256];
         int uaSize = snprintf(uaBuffer, 256, "Mozilla/5.0 (%s) AppleWebKit/%d.%d+ (KHTML, like Gecko) Version/%s %sSafari/%d.%d+",
@@ -6178,7 +6175,7 @@ const String& WebPagePrivate::defaultUserAgent()
         if (uaSize <= 0 || uaSize >= 256)
             BLACKBERRY_CRASH();
 
-        defaultUserAgent->append(uaBuffer);
+        defaultUserAgent = new BlackBerry::Platform::String(uaBuffer, uaSize);
     }
 
     return *defaultUserAgent;
index 0cb76e1..3d7b6c2 100644 (file)
 
 #include "BlackBerryGlobal.h"
 #include "JavaScriptVariant.h"
-#include "WebString.h"
 
 #include <BlackBerryPlatformGuardedPointer.h>
 #include <BlackBerryPlatformInputEvents.h>
+#include <BlackBerryPlatformString.h>
 #include <BlackBerryPlatformWebContext.h>
 #include <imf/input_data.h>
 #include <network/NetworkRequest.h>
@@ -86,30 +86,30 @@ enum TargetDetectionStrategy {PointBased, RectBased};
 
 class BLACKBERRY_EXPORT WebPage : public Platform::GuardedPointerBase {
 public:
-    WebPage(WebPageClient*, const WebString& pageGroupName, const Platform::IntRect&);
+    WebPage(WebPageClient*, const BlackBerry::Platform::String& pageGroupName, const Platform::IntRect&);
     void destroy();
 
     WebPageClient* client() const;
 
-    void load(const char* url, const char* networkToken, bool isInitial = false);
+    void load(const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& networkToken, bool isInitial = false);
 
     void loadExtended(const char* url, const char* networkToken, const char* method, Platform::NetworkRequest::CachePolicy = Platform::NetworkRequest::UseProtocolCachePolicy, const char* data = 0, size_t dataLength = 0, const char* const* headers = 0, size_t headersLength = 0, bool mustHandleInternally = false);
 
-    void loadFile(const char* path, const char* overrideContentType = "");
+    void loadFile(const BlackBerry::Platform::String& path, const BlackBerry::Platform::String& overrideContentType = "");
 
-    void loadString(const char* string, const char* baseURL, const char* contentType = "text/html", const char* failingURL = 0);
+    void loadString(const BlackBerry::Platform::String&, const BlackBerry::Platform::String& baseURL, const BlackBerry::Platform::String& contentType = "text/html", const BlackBerry::Platform::String& failingURL = BlackBerry::Platform::String::emptyString());
 
     void download(const Platform::NetworkRequest&);
 
-    bool executeJavaScript(const char* script, JavaScriptDataType& returnType, WebString& returnValue);
+    bool executeJavaScript(const BlackBerry::Platform::String& script, JavaScriptDataType& returnType, BlackBerry::Platform::String& returnValue);
 
     // This will execute the script even if in-page JavaScript is disabled.
-    bool executeJavaScriptInIsolatedWorld(const char* script, JavaScriptDataType& returnType, WebString& returnValue);
+    bool executeJavaScriptInIsolatedWorld(const BlackBerry::Platform::String& script, JavaScriptDataType& returnType, BlackBerry::Platform::String& returnValue);
 
     // Takes a UTF16 encoded script that is used explicitly by the pattern matching code
-    bool executeJavaScriptInIsolatedWorld(const std::wstring& script, JavaScriptDataType& returnType, WebString& returnValue);
+    bool executeJavaScriptInIsolatedWorld(const std::wstring& script, JavaScriptDataType& returnType, BlackBerry::Platform::String& returnValue);
 
-    void executeJavaScriptFunction(const std::vector<std::string> &function, const std::vector<JavaScriptVariant> &args, JavaScriptVariant& returnValue);
+    void executeJavaScriptFunction(const std::vector<BlackBerry::Platform::String> &function, const std::vector<JavaScriptVariant> &args, JavaScriptVariant& returnValue);
 
     void initializeIconDataBase();
 
@@ -121,8 +121,8 @@ public:
     void prepareToDestroy();
 
     void enableCrossSiteXHR();
-    void addOriginAccessWhitelistEntry(const char* sourceOrigin, const char* destinationOrigin, bool allowDestinationSubdomains);
-    void removeOriginAccessWhitelistEntry(const char* sourceOrigin, const char* destinationOrigin, bool allowDestinationSubdomains);
+    void addOriginAccessWhitelistEntry(const BlackBerry::Platform::String& sourceOrigin, const BlackBerry::Platform::String& destinationOrigin, bool allowDestinationSubdomains);
+    void removeOriginAccessWhitelistEntry(const BlackBerry::Platform::String& sourceOrigin, const BlackBerry::Platform::String& destinationOrigin, bool allowDestinationSubdomains);
 
     void reload();
     void reloadFromCache();
@@ -160,10 +160,10 @@ public:
     // Returns true if the key stroke was handled by WebKit.
     bool keyEvent(const Platform::KeyboardEvent&);
 
-    WebString title() const;
-    WebString selectedText() const;
-    WebString cutSelectedText();
-    void insertText(const WebString&);
+    BlackBerry::Platform::String title() const;
+    BlackBerry::Platform::String selectedText() const;
+    BlackBerry::Platform::String cutSelectedText();
+    void insertText(const BlackBerry::Platform::String&);
     void clearCurrentInputField();
 
     void cut();
@@ -172,9 +172,9 @@ public:
     void selectAll();
 
     // Text encoding.
-    WebString textEncoding();
-    WebString forcedTextEncoding();
-    void setForcedTextEncoding(const char*);
+    BlackBerry::Platform::String textEncoding();
+    BlackBerry::Platform::String forcedTextEncoding();
+    void setForcedTextEncoding(const BlackBerry::Platform::String&);
 
     // Scroll position returned is in transformed coordinates.
     Platform::IntPoint scrollPosition() const;
@@ -281,25 +281,25 @@ public:
 
     void popupListClosed(int size, const bool* selecteds);
     void popupListClosed(int index);
-    void setDateTimeInput(const WebString& value);
-    void setColorInput(const WebString& value);
+    void setDateTimeInput(const BlackBerry::Platform::String& value);
+    void setColorInput(const BlackBerry::Platform::String& value);
 
     void onInputLocaleChanged(bool isRTL);
     static void onNetworkAvailabilityChanged(bool available);
-    static void onCertificateStoreLocationSet(const WebString& caPath);
+    static void onCertificateStoreLocationSet(const BlackBerry::Platform::String& caPath);
 
-    WebString textHasAttribute(const WebString& query) const;
+    BlackBerry::Platform::String textHasAttribute(const BlackBerry::Platform::String& query) const;
 
-    void setAllowNotification(const WebString& domain, bool allow);
+    void setAllowNotification(const BlackBerry::Platform::String& domain, bool allow);
 
     Platform::WebContext webContext(TargetDetectionStrategy) const;
 
     typedef intptr_t BackForwardId;
     struct BackForwardEntry {
-        WebString url;
-        WebString originalUrl;
-        WebString title;
-        WebString networkToken;
+        BlackBerry::Platform::String url;
+        BlackBerry::Platform::String originalUrl;
+        BlackBerry::Platform::String title;
+        BlackBerry::Platform::String networkToken;
         BackForwardId id;
         bool lastVisitWasHTTPNonGet;
     };
@@ -339,7 +339,7 @@ public:
     bool isWebInspectorEnabled();
     void enablePasswordEcho();
     void disablePasswordEcho();
-    void dispatchInspectorMessage(const std::string& message);
+    void dispatchInspectorMessage(const BlackBerry::Platform::String& message);
     void inspectCurrentContextElement();
 
     // FIXME: Needs API review on this header. See PR #120402.
@@ -385,11 +385,11 @@ public:
     bool hasOpenedPopup() const;
     WebCore::PagePopupBlackBerry* popup();
 
-    void autofillTextField(const std::string&);
+    void autofillTextField(const BlackBerry::Platform::String&);
 
     void enableQnxJavaScriptObject(bool);
 
-    WebString renderTreeAsText();
+    BlackBerry::Platform::String renderTreeAsText();
 
 private:
     virtual ~WebPage();
index e9ed52e..aab7d09 100644 (file)
 #define WebPageClient_h
 
 #include "BlackBerryGlobal.h"
-#include "WebString.h"
 
 #include <BlackBerryPlatformCursor.h>
 #include <BlackBerryPlatformInputEvents.h>
 #include <BlackBerryPlatformNavigationType.h>
 #include <BlackBerryPlatformPrimitives.h>
+#include <BlackBerryPlatformString.h>
 #include <imf/events.h>
 #include <interaction/ScrollViewBase.h>
 #include <vector>
@@ -108,14 +108,14 @@ public:
     virtual void notifyDocumentOnLoad(bool) = 0;
 
     virtual void notifyWindowObjectCleared() = 0;
-    virtual WebString invokeClientJavaScriptCallback(const char* const* args, unsigned numArgs) = 0;
+    virtual BlackBerry::Platform::String invokeClientJavaScriptCallback(const char* const* args, unsigned numArgs) = 0;
 
     virtual void addMessageToConsole(const unsigned short* message, unsigned messageLength, const unsigned short* source, unsigned sourceLength, unsigned lineNumber) = 0;
     virtual int showAlertDialog(AlertType) = 0;
 
     virtual void runJavaScriptAlert(const unsigned short* message, unsigned messageLength, const char* origin, unsigned originLength) = 0;
     virtual bool runJavaScriptConfirm(const unsigned short* message, unsigned messageLength, const char* origin, unsigned originLength) = 0;
-    virtual bool runJavaScriptPrompt(const unsigned short* message, unsigned messageLength, const unsigned short* defaultValue, unsigned defaultValueLength, const char* origin, unsigned originLength, WebString& result) = 0;
+    virtual bool runJavaScriptPrompt(const unsigned short* message, unsigned messageLength, const unsigned short* defaultValue, unsigned defaultValueLength, const char* origin, unsigned originLength, BlackBerry::Platform::String& result) = 0;
     virtual bool runBeforeUnloadConfirmPanel(const unsigned short* message, unsigned messageLength, const char* origin, unsigned originLength) = 0;
 
     virtual bool shouldInterruptJavaScript() = 0;
@@ -166,10 +166,10 @@ public:
 
     virtual void resetBackForwardList(unsigned listSize, unsigned currentIndex) = 0;
 
-    virtual void openPopupList(bool multiple, int size, const ScopeArray<WebString>& labels, const bool* enableds, const int* itemType, const bool* selecteds) = 0;
-    virtual bool chooseFilenames(bool allowMultiple, const SharedArray<WebString>& acceptTypes, const SharedArray<WebString>& initialFiles, const WebString& capture, SharedArray<WebString>& chosenFiles) = 0;
+    virtual void openPopupList(bool multiple, int size, const ScopeArray<BlackBerry::Platform::String>& labels, const bool* enableds, const int* itemType, const bool* selecteds) = 0;
+    virtual bool chooseFilenames(bool allowMultiple, const SharedArray<BlackBerry::Platform::String>& acceptTypes, const SharedArray<BlackBerry::Platform::String>& initialFiles, const BlackBerry::Platform::String& capture, SharedArray<BlackBerry::Platform::String>& chosenFiles) = 0;
 
-    virtual void loadPluginForMimetype(int, int width, int height, const SharedArray<WebString>& paramNames, const SharedArray<WebString>& paramValues, const char* url) = 0;
+    virtual void loadPluginForMimetype(int, int width, int height, const SharedArray<BlackBerry::Platform::String>& paramNames, const SharedArray<BlackBerry::Platform::String>& paramValues, const char* url) = 0;
     virtual void notifyPluginRectChanged(int, Platform::IntRect rectChanged) = 0;
     virtual void destroyPlugin(int) = 0;
     virtual void playMedia(int) = 0;
@@ -179,27 +179,27 @@ public:
     virtual void setVolume(int, float) = 0;
     virtual void setMuted(int, bool) = 0;
 
-    virtual WebPage* createWindow(int x, int y, int width, int height, unsigned flags, const WebString& url, const WebString& windowName) = 0;
+    virtual WebPage* createWindow(int x, int y, int width, int height, unsigned flags, const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& windowName) = 0;
 
     virtual void scheduleCloseWindow() = 0;
 
     // Database interface.
     virtual unsigned long long databaseQuota(const unsigned short* origin, unsigned originLength, const unsigned short* databaseName, unsigned databaseNameLength, unsigned long long totalUsage, unsigned long long originUsage, unsigned long long estimatedSize) = 0;
 
-    virtual void setIconForUrl(const char* originalPageUrl, const char* finalPageUrl, const char* iconUrl) = 0;
-    virtual void setFavicon(const char* dataInBase64, const char* url) = 0;
-    virtual void setLargeIcon(const char* iconUrl) = 0;
+    virtual void setIconForUrl(const BlackBerry::Platform::String& originalPageUrl, const BlackBerry::Platform::String& finalPageUrl, const BlackBerry::Platform::String& iconUrl) = 0;
+    virtual void setFavicon(const BlackBerry::Platform::String& dataInBase64, const BlackBerry::Platform::String& url) = 0;
+    virtual void setLargeIcon(const BlackBerry::Platform::String& iconUrl) = 0;
     virtual void setWebAppCapable() = 0;
-    virtual void setSearchProviderDetails(const char* title, const char* documentUrl) = 0;
-    virtual void setAlternateFeedDetails(const char* title, const char* feedUrl) = 0;
+    virtual void setSearchProviderDetails(const BlackBerry::Platform::String& title, const BlackBerry::Platform::String& documentUrl) = 0;
+    virtual void setAlternateFeedDetails(const BlackBerry::Platform::String& title, const BlackBerry::Platform::String& feedUrl) = 0;
 
-    virtual WebString getErrorPage(int errorCode, const char* errorMessage, const char* url) = 0;
+    virtual BlackBerry::Platform::String getErrorPage(int errorCode, const BlackBerry::Platform::String& errorMessage, const BlackBerry::Platform::String& url) = 0;
 
     virtual void willDeferLoading() = 0;
     virtual void didResumeLoading() = 0;
 
     // Headers is a list of alternating key and value.
-    virtual void setMetaHeaders(const ScopeArray<WebString>& headers, unsigned int headersSize) = 0;
+    virtual void setMetaHeaders(const ScopeArray<BlackBerry::Platform::String>& headers, unsigned headersSize) = 0;
 
     virtual void needMoreData() = 0;
     virtual void handleWebInspectorMessageToFrontend(int id, const char* message, int length) = 0;
@@ -210,10 +210,10 @@ public:
     virtual void animateBlockZoom(const Platform::FloatPoint& finalPoint, double finalScale) = 0;
 
     virtual void setPreventsScreenIdleDimming(bool noDimming) = 0;
-    virtual bool authenticationChallenge(const unsigned short* realm, unsigned int realmLength, WebString& username, WebString& password) = 0;
+    virtual bool authenticationChallenge(const unsigned short* realm, unsigned realmLength, BlackBerry::Platform::String& username, BlackBerry::Platform::String& password) = 0;
     virtual SaveCredentialType notifyShouldSaveCredential(bool isNew) = 0;
-    virtual void syncProxyCredential(const WebString& username, const WebString& password) = 0;
-    virtual void notifyPopupAutofillDialog(const std::vector<std::string>&, const Platform::IntRect&) = 0;
+    virtual void syncProxyCredential(const BlackBerry::Platform::String& username, const BlackBerry::Platform::String& password) = 0;
+    virtual void notifyPopupAutofillDialog(const std::vector<BlackBerry::Platform::String>&, const Platform::IntRect&) = 0;
     virtual void notifyDismissAutofillDialog() = 0;
 
     virtual bool shouldPluginEnterFullScreen() = 0;
@@ -225,16 +225,15 @@ public:
     virtual void unlockOrientation() = 0;
     virtual bool isActive() const = 0;
     virtual bool isVisible() const = 0;
-    virtual void requestWebGLPermission(const WebString&) = 0;
 
-    virtual void setToolTip(WebString) = 0;
-    virtual void setStatus(WebString) = 0;
+    virtual void setToolTip(const BlackBerry::Platform::String&) = 0;
+    virtual void setStatus(const BlackBerry::Platform::String&) = 0;
     virtual bool acceptNavigationRequest(const Platform::NetworkRequest&, Platform::NavigationType) = 0;
     virtual void cursorEventModeChanged(Platform::CursorEventMode) = 0;
     virtual void touchEventModeChanged(Platform::TouchEventMode) = 0;
 
-    virtual bool downloadAllowed(const char* url) = 0;
-    virtual void downloadRequested(Platform::FilterStream*, const WebString& suggestedFilename) = 0;
+    virtual bool downloadAllowed(const BlackBerry::Platform::String& url) = 0;
+    virtual void downloadRequested(Platform::FilterStream*, const BlackBerry::Platform::String& suggestedFilename) = 0;
 
     virtual int fullscreenStart() = 0;
     virtual int fullscreenStart(const char* contextName, Platform::Graphics::Window*, unsigned x, unsigned y, unsigned width, unsigned height) = 0;
@@ -263,9 +262,9 @@ public:
         ProtocolHandlersRegistered,
         ProtocolHandlersDeclined
     };
-    virtual void registerProtocolHandler(const WebString& /*scheme*/, const WebString& /*baseURL*/, const WebString& /*url*/, const WebString& /*title*/) = 0;
-    virtual ProtocolHandlersState isProtocolHandlerRegistered(const WebString& /*scheme*/, const WebString& /*baseURL*/, const WebString& /*url*/) = 0;
-    virtual void unregisterProtocolHandler(const WebString& /*scheme*/, const WebString& /*baseURL*/, const WebString& /*url*/) = 0;
+    virtual void registerProtocolHandler(const BlackBerry::Platform::String& /*scheme*/, const BlackBerry::Platform::String& /*baseURL*/, const BlackBerry::Platform::String& /*url*/, const BlackBerry::Platform::String& /*title*/) = 0;
+    virtual ProtocolHandlersState isProtocolHandlerRegistered(const BlackBerry::Platform::String& /*scheme*/, const BlackBerry::Platform::String& /*baseURL*/, const BlackBerry::Platform::String& /*url*/) = 0;
+    virtual void unregisterProtocolHandler(const BlackBerry::Platform::String& /*scheme*/, const BlackBerry::Platform::String& /*baseURL*/, const BlackBerry::Platform::String& /*url*/) = 0;
 
     virtual void requestUserMedia(const Platform::WebUserMediaRequest&) = 0;
     virtual void cancelUserMediaRequest(const Platform::WebUserMediaRequest&) = 0;
index 0192b3a..eeb7775 100644 (file)
@@ -106,21 +106,21 @@ public:
 
     WebPageClient* client() const { return m_client; }
 
-    void init(const WebString& pageGroupName);
+    void init(const BlackBerry::Platform::String& pageGroupName);
     bool handleMouseEvent(WebCore::PlatformMouseEvent&);
     bool handleWheelEvent(WebCore::PlatformWheelEvent&);
 
-    void load(const char* url, const char* networkToken, const char* method, Platform::NetworkRequest::CachePolicy, const char* data, size_t dataLength, const char* const* headers, size_t headersLength, bool isInitial, bool mustHandleInternally = false, bool forceDownload = false, const char* overrideContentType = "", const char* suggestedSaveName = "");
-    void loadString(const char* string, const char* baseURL, const char* mimeType, const char* failingURL = 0);
-    bool executeJavaScript(const char* script, JavaScriptDataType& returnType, WebString& returnValue);
-    bool executeJavaScriptInIsolatedWorld(const WebCore::ScriptSourceCode&, JavaScriptDataType& returnType, WebString& returnValue);
+    void load(const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& networkToken, const BlackBerry::Platform::String& method, Platform::NetworkRequest::CachePolicy, const char* data, size_t dataLength, const char* const* headers, size_t headersLength, bool isInitial, bool mustHandleInternally = false, bool forceDownload = false, const BlackBerry::Platform::String& overrideContentType = BlackBerry::Platform::String::emptyString(), const BlackBerry::Platform::String& suggestedSaveName = BlackBerry::Platform::String::emptyString());
+    void loadString(const BlackBerry::Platform::String&, const BlackBerry::Platform::String& baseURL, const BlackBerry::Platform::String& mimeType, const BlackBerry::Platform::String& failingURL);
+    bool executeJavaScript(const BlackBerry::Platform::String& script, JavaScriptDataType& returnType, BlackBerry::Platform::String& returnValue);
+    bool executeJavaScriptInIsolatedWorld(const WebCore::ScriptSourceCode&, JavaScriptDataType& returnType, BlackBerry::Platform::String& returnValue);
 
     void stopCurrentLoad();
     void prepareToDestroy();
 
     void enableCrossSiteXHR();
-    void addOriginAccessWhitelistEntry(const char* sourceOrigin, const char* destinationOrigin, bool allowDestinationSubdomains);
-    void removeOriginAccessWhitelistEntry(const char* sourceOrigin, const char* destinationOrigin, bool allowDestinationSubdomains);
+    void addOriginAccessWhitelistEntry(const BlackBerry::Platform::String& sourceOrigin, const BlackBerry::Platform::String& destinationOrigin, bool allowDestinationSubdomains);
+    void removeOriginAccessWhitelistEntry(const BlackBerry::Platform::String& sourceOrigin, const BlackBerry::Platform::String& destinationOrigin, bool allowDestinationSubdomains);
 
     LoadState loadState() const { return m_loadState; }
     bool isLoading() const { return m_loadState == WebPagePrivate::Provisional || m_loadState == WebPagePrivate::Committed; }
@@ -444,7 +444,7 @@ public:
     static WebCore::RenderLayer* enclosingPositionedAncestorOrSelfIfPositioned(WebCore::RenderLayer*);
     static WebCore::RenderLayer* enclosingFixedPositionedAncestorOrSelfIfFixedPositioned(WebCore::RenderLayer*);
 
-    static const String& defaultUserAgent();
+    static const BlackBerry::Platform::String& defaultUserAgent();
 
     void setVisible(bool);
 #if ENABLE(PAGE_VISIBILITY_API)
@@ -601,14 +601,13 @@ public:
     bool m_wouldLoadManualScript;
     bool m_wouldSetFocused;
     bool m_wouldSetPageVisibilityState;
+    bool m_cachedFocused;
+    bool m_enableQnxJavaScriptObject;
     Vector<bool> m_cachedPopupListSelecteds;
     int m_cachedPopupListSelectedIndex;
-    WebString m_cachedDateTimeInput;
-    WebString m_cachedColorInput;
+    BlackBerry::Platform::String m_cachedDateTimeInput;
+    BlackBerry::Platform::String m_cachedColorInput;
     WebCore::KURL m_cachedManualScript;
-    bool m_cachedFocused;
-
-    bool m_enableQnxJavaScriptObject;
 
     class DeferredTaskBase {
     public:
index 18bfbc5..f639131 100644 (file)
 #include "MIMETypeRegistry.h"
 #include "WebSettings_p.h"
 
-#include "WebString.h"
 #include <BlackBerryPlatformDeviceInfo.h>
 #include <BlackBerryPlatformFontInfo.h>
 #include <BlackBerryPlatformScreen.h>
+#include <BlackBerryPlatformString.h>
 #include <Color.h>
 #include <FloatSize.h>
 #include <PageCache.h>
@@ -201,15 +201,15 @@ WebSettings* WebSettings::standardSettings()
     settings->m_private->setInteger(WebKitMinimumFontSize, 8);
     settings->m_private->setBoolean(WebKitWebSocketsEnabled, true);
 
-    settings->m_private->setString(WebKitFixedFontFamily, BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-monospace", "").c_str());
-    settings->m_private->setString(WebKitSansSeriffFontFamily, BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-sans-serif", "").c_str());
-    settings->m_private->setString(WebKitSeriffFontFamily, BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-serif", "").c_str());
-    settings->m_private->setString(WebKitStandardFontFamily, BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-standard", "").c_str());
+    settings->m_private->setString(WebKitFixedFontFamily, BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-monospace", ""));
+    settings->m_private->setString(WebKitSansSeriffFontFamily, BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-sans-serif", ""));
+    settings->m_private->setString(WebKitSeriffFontFamily, BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-serif", ""));
+    settings->m_private->setString(WebKitStandardFontFamily, BlackBerry::Platform::FontInfo::instance()->fontFamily("-webkit-standard", ""));
 
     return settings;
 }
 
-void WebSettings::addSupportedObjectPluginMIMEType(const char* type)
+void WebSettings::addSupportedObjectPluginMIMEType(const BlackBerry::Platform::String& type)
 {
     if (!s_supportedObjectMIMETypes)
         s_supportedObjectMIMETypes = new HashSet<String>;
@@ -217,9 +217,9 @@ void WebSettings::addSupportedObjectPluginMIMEType(const char* type)
     s_supportedObjectMIMETypes->add(type);
 }
 
-bool WebSettings::isSupportedObjectMIMEType(const WebString& mimeType)
+bool WebSettings::isSupportedObjectMIMEType(const BlackBerry::Platform::String& mimeType)
 {
-    if (mimeType.isEmpty())
+    if (mimeType.empty())
         return false;
 
     if (!s_supportedObjectMIMETypes)
@@ -328,62 +328,62 @@ void WebSettings::setMinimumFontSize(int minimumFontSize)
     m_private->setInteger(WebKitMinimumFontSize, minimumFontSize);
 }
 
-WebString WebSettings::serifFontFamily() const
+BlackBerry::Platform::String WebSettings::serifFontFamily() const
 {
     return m_private->getString(WebKitSeriffFontFamily);
 }
 
-void WebSettings::setSerifFontFamily(const char* seriffFontFamily)
+void WebSettings::setSerifFontFamily(const BlackBerry::Platform::String& seriffFontFamily)
 {
     m_private->setString(WebKitSeriffFontFamily, seriffFontFamily);
 }
 
-WebString WebSettings::fixedFontFamily() const
+BlackBerry::Platform::String WebSettings::fixedFontFamily() const
 {
     return m_private->getString(WebKitFixedFontFamily);
 }
 
-void WebSettings::setFixedFontFamily(const char* fixedFontFamily)
+void WebSettings::setFixedFontFamily(const BlackBerry::Platform::String& fixedFontFamily)
 {
     m_private->setString(WebKitFixedFontFamily, fixedFontFamily);
 }
 
-WebString WebSettings::sansSerifFontFamily() const
+BlackBerry::Platform::String WebSettings::sansSerifFontFamily() const
 {
     return m_private->getString(WebKitSansSeriffFontFamily);
 }
 
-void WebSettings::setSansSerifFontFamily(const char* sansSeriffFontFamily)
+void WebSettings::setSansSerifFontFamily(const BlackBerry::Platform::String& sansSeriffFontFamily)
 {
     m_private->setString(WebKitSansSeriffFontFamily, sansSeriffFontFamily);
 }
 
-WebString WebSettings::standardFontFamily() const
+BlackBerry::Platform::String WebSettings::standardFontFamily() const
 {
     return m_private->getString(WebKitStandardFontFamily);
 }
 
-void WebSettings::setStandardFontFamily(const char* standardFontFamily)
+void WebSettings::setStandardFontFamily(const BlackBerry::Platform::String& standardFontFamily)
 {
     m_private->setString(WebKitStandardFontFamily, standardFontFamily);
 }
 
-WebString WebSettings::userAgentString() const
+BlackBerry::Platform::String WebSettings::userAgentString() const
 {
     return m_private->getString(BlackBerryUserAgentString);
 }
 
-void WebSettings::setUserAgentString(const WebString& userAgentString)
+void WebSettings::setUserAgentString(const BlackBerry::Platform::String& userAgentString)
 {
     m_private->setString(BlackBerryUserAgentString, userAgentString);
 }
 
-WebString WebSettings::defaultTextEncodingName() const
+BlackBerry::Platform::String WebSettings::defaultTextEncodingName() const
 {
     return m_private->getString(WebKitDefaultTextEncodingName);
 }
 
-void WebSettings::setDefaultTextEncodingName(const char* defaultTextEncodingName)
+void WebSettings::setDefaultTextEncodingName(const BlackBerry::Platform::String& defaultTextEncodingName)
 {
     m_private->setString(WebKitDefaultTextEncodingName, defaultTextEncodingName);
 }
@@ -458,20 +458,19 @@ void WebSettings::setGetFocusNodeContext(bool enabled)
     m_private->setBoolean(BlackBerryGetFocusNodeContextEnabled, enabled);
 }
 
-WebString WebSettings::userStyleSheetString() const
+BlackBerry::Platform::String WebSettings::userStyleSheetString() const
 {
     return m_private->getString(WebKitUserStyleSheet);
 }
 
-void WebSettings::setUserStyleSheetString(const char* userStyleSheetString)
+void WebSettings::setUserStyleSheetString(const BlackBerry::Platform::String& userStyleSheetString)
 {
     // FIXME: This doesn't seem like the appropriate place to do this as WebSettings should ideally be a state store.
     // Either the caller of this function should do this conversion or caller of the getter corresponding to this function
     // should do this conversion.
 
-    size_t length = strlen(userStyleSheetString);
     Vector<char> data;
-    data.append(userStyleSheetString, length);
+    data.append(userStyleSheetString.c_str(), userStyleSheetString.length());
 
     Vector<char> encodedData;
     base64Encode(data, encodedData);
@@ -485,12 +484,12 @@ void WebSettings::setUserStyleSheetString(const char* userStyleSheetString)
     m_private->setString(WebKitUserStyleSheet, String(dataURL.data(), dataURL.size()));
 }
 
-WebString WebSettings::userStyleSheetLocation()
+BlackBerry::Platform::String WebSettings::userStyleSheetLocation()
 {
     return m_private->getString(WebKitUserStyleSheetLocation);
 }
 
-void WebSettings::setUserStyleSheetLocation(const char* userStyleSheetLocation)
+void WebSettings::setUserStyleSheetLocation(const BlackBerry::Platform::String& userStyleSheetLocation)
 {
     m_private->setString(WebKitUserStyleSheetLocation, userStyleSheetLocation);
 }
@@ -640,52 +639,52 @@ void WebSettings::setMaximumPagesInCache(int pages)
     m_private->setUnsigned(WebKitMaximumPagesInCache, realPages);
 }
 
-WebString WebSettings::localStoragePath() const
+BlackBerry::Platform::String WebSettings::localStoragePath() const
 {
     return m_private->getString(WebKitLocalStoragePath);
 }
 
-void WebSettings::setLocalStoragePath(const WebString& path)
+void WebSettings::setLocalStoragePath(const BlackBerry::Platform::String& path)
 {
     m_private->setString(WebKitLocalStoragePath, path);
 }
 
-WebString WebSettings::indexedDataBasePath() const
+BlackBerry::Platform::String WebSettings::indexedDataBasePath() const
 {
     return m_private->getString(WebKitIndexedDataBasePath);
 }
 
-void WebSettings::setIndexedDataBasePath(const WebString& path)
+void WebSettings::setIndexedDataBasePath(const BlackBerry::Platform::String& path)
 {
     m_private->setString(WebKitIndexedDataBasePath, path);
 }
 
-WebString WebSettings::databasePath() const
+BlackBerry::Platform::String WebSettings::databasePath() const
 {
     return m_private->getString(WebKitDatabasePath);
 }
 
-void WebSettings::setDatabasePath(const WebString& path)
+void WebSettings::setDatabasePath(const BlackBerry::Platform::String& path)
 {
     m_private->setString(WebKitDatabasePath, path);
 }
 
-WebString WebSettings::appCachePath() const
+BlackBerry::Platform::String WebSettings::appCachePath() const
 {
     return m_private->getString(WebKitOfflineWebApplicationCachePath);
 }
 
-void WebSettings::setAppCachePath(const WebString& path)
+void WebSettings::setAppCachePath(const BlackBerry::Platform::String& path)
 {
     m_private->setString(WebKitOfflineWebApplicationCachePath, path);
 }
 
-WebString WebSettings::pageGroupName() const
+BlackBerry::Platform::String WebSettings::pageGroupName() const
 {
     return m_private->getString(WebKitPageGroupName);
 }
 
-void WebSettings::setPageGroupName(const WebString& pageGroupName)
+void WebSettings::setPageGroupName(const BlackBerry::Platform::String& pageGroupName)
 {
     m_private->setString(WebKitPageGroupName, pageGroupName);
 }
index b60cb6d..792d5d9 100644 (file)
@@ -54,8 +54,8 @@ public:
     void setDelegate(WebSettingsDelegate*);
     WebSettingsDelegate* delegate();
 
-    static void addSupportedObjectPluginMIMEType(const char*);
-    static bool isSupportedObjectMIMEType(const WebString&);
+    static void addSupportedObjectPluginMIMEType(const BlackBerry::Platform::String&);
+    static bool isSupportedObjectMIMEType(const BlackBerry::Platform::String&);
 
     bool xssAuditorEnabled() const;
     void setXSSAuditorEnabled(bool);
@@ -84,23 +84,23 @@ public:
     int minimumFontSize() const;
     void setMinimumFontSize(int);
 
-    WebString serifFontFamily() const;
-    void setSerifFontFamily(const char*);
-    WebString fixedFontFamily() const;
-    void setFixedFontFamily(const char*);
-    WebString sansSerifFontFamily() const;
-    void setSansSerifFontFamily(const char*);
-    WebString standardFontFamily() const;
-    void setStandardFontFamily(const char*);
+    BlackBerry::Platform::String serifFontFamily() const;
+    void setSerifFontFamily(const BlackBerry::Platform::String&);
+    BlackBerry::Platform::String fixedFontFamily() const;
+    void setFixedFontFamily(const BlackBerry::Platform::String&);
+    BlackBerry::Platform::String sansSerifFontFamily() const;
+    void setSansSerifFontFamily(const BlackBerry::Platform::String&);
+    BlackBerry::Platform::String standardFontFamily() const;
+    void setStandardFontFamily(const BlackBerry::Platform::String&);
 
     void setDownloadableBinaryFontsEnabled(bool);
     bool downloadableBinaryFontsEnabled() const;
 
-    WebString userAgentString() const;
-    void setUserAgentString(const WebString&);
+    BlackBerry::Platform::String userAgentString() const;
+    void setUserAgentString(const BlackBerry::Platform::String&);
 
-    WebString defaultTextEncodingName() const;
-    void setDefaultTextEncodingName(const char*);
+    BlackBerry::Platform::String defaultTextEncodingName() const;
+    void setDefaultTextEncodingName(const BlackBerry::Platform::String&);
 
     bool isZoomToFitOnLoad() const;
     void setZoomToFitOnLoad(bool);
@@ -126,11 +126,11 @@ public:
     bool doesGetFocusNodeContext() const;
     void setGetFocusNodeContext(bool);
 
-    WebString userStyleSheetString() const;
-    void setUserStyleSheetString(const char*);
+    BlackBerry::Platform::String userStyleSheetString() const;
+    void setUserStyleSheetString(const BlackBerry::Platform::String&);
 
-    WebString userStyleSheetLocation();
-    void setUserStyleSheetLocation(const char*);
+    BlackBerry::Platform::String userStyleSheetLocation();
+    void setUserStyleSheetLocation(const BlackBerry::Platform::String&);
 
     // External link handlers
     bool areLinksHandledExternally() const;
@@ -175,20 +175,20 @@ public:
     void setMaximumPagesInCache(int);
     int maximumPagesInCache() const;
 
-    WebString localStoragePath() const;
-    void setLocalStoragePath(const WebString&);
+    BlackBerry::Platform::String localStoragePath() const;
+    void setLocalStoragePath(const BlackBerry::Platform::String&);
 
-    WebString indexedDataBasePath() const;
-    void setIndexedDataBasePath(const WebString&);
+    BlackBerry::Platform::String indexedDataBasePath() const;
+    void setIndexedDataBasePath(const BlackBerry::Platform::String&);
 
-    WebString databasePath() const;
-    void setDatabasePath(const WebString&);
+    BlackBerry::Platform::String databasePath() const;
+    void setDatabasePath(const BlackBerry::Platform::String&);
 
-    WebString appCachePath() const;
-    void setAppCachePath(const WebString&);
+    BlackBerry::Platform::String appCachePath() const;
+    void setAppCachePath(const BlackBerry::Platform::String&);
 
-    WebString pageGroupName() const;
-    void setPageGroupName(const WebString&);
+    BlackBerry::Platform::String pageGroupName() const;
+    void setPageGroupName(const BlackBerry::Platform::String&);
 
     // FIXME: We shouldn't have an email mode. Instead, we should expose all email-related settings
     // so that the email client can toggle them directly.
diff --git a/Source/WebKit/blackberry/Api/WebString.cpp b/Source/WebKit/blackberry/Api/WebString.cpp
deleted file mode 100644 (file)
index 0e75fc1..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (C) 2009, 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
- */
-
-#include "config.h"
-#include "WebString.h"
-
-#include <wtf/text/CString.h>
-#include <wtf/text/WTFString.h>
-
-namespace BlackBerry {
-namespace WebKit {
-
-WebString::WebString(const char* latin1)
-    : m_impl(StringImpl::create(latin1).leakRef())
-{
-}
-
-WebString::WebString(const char* latin1, unsigned length)
-    : m_impl(StringImpl::create(latin1, length).leakRef())
-{
-}
-
-WebString::WebString(const unsigned short* utf16, unsigned length)
-    : m_impl(StringImpl::create(utf16, length).leakRef())
-{
-}
-
-WebString::WebString(StringImpl* impl)
-    : m_impl(impl)
-{
-    if (m_impl)
-        m_impl->ref();
-}
-
-WebString::~WebString()
-{
-    if (m_impl)
-        m_impl->deref();
-}
-
-WebString::WebString(const WebString& str)
-    : m_impl(str.m_impl)
-{
-    if (m_impl)
-        m_impl->ref();
-}
-
-WebString WebString::fromUtf8(const char* utf8)
-{
-    return String::fromUTF8(utf8);
-}
-
-WebString WebString::fromUtf8(const char* utf8, size_t length)
-{
-    return String::fromUTF8(utf8, length);
-}
-
-WebString& WebString::operator=(const WebString& str)
-{
-    if (&str == this)
-        return *this;
-    if (str.m_impl)
-        str.m_impl->ref();
-    if (m_impl)
-        m_impl->deref();
-    m_impl = str.m_impl;
-    return *this;
-}
-
-std::string WebString::utf8() const
-{
-    std::string utf8;
-    if (!m_impl)
-        return utf8;
-
-    CString cstr = String(m_impl).utf8();
-    utf8.assign(cstr.data(), cstr.length());
-    return utf8;
-}
-
-const unsigned short* WebString::characters() const
-{
-    return m_impl ? m_impl->characters() : 0;
-}
-
-unsigned WebString::length() const
-{
-    return m_impl ? m_impl->length() : 0;
-}
-
-bool WebString::isEmpty() const
-{
-    return !m_impl || !m_impl->length();
-}
-
-bool WebString::equal(const char* utf8) const
-{
-    return WTF::equal(m_impl, utf8);
-}
-
-bool WebString::equalIgnoringCase(const char* utf8) const
-{
-    return WTF::equalIgnoringCase(utf8, WTF::String(m_impl));
-}
-
-} // namespace WebKit
-} // namespace BlackBerry
diff --git a/Source/WebKit/blackberry/Api/WebString.h b/Source/WebKit/blackberry/Api/WebString.h
deleted file mode 100644 (file)
index c2af16b..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2009, 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 WebString_h
-#define WebString_h
-
-#include "BlackBerryGlobal.h"
-#include <string>
-
-// Not for public API purpose.
-namespace WTF {
-class StringImpl;
-}
-
-namespace BlackBerry {
-namespace WebKit {
-
-class BLACKBERRY_EXPORT WebString {
-public:
-    WebString() : m_impl(0) { }
-    ~WebString();
-    WebString(const char* latin1);
-    WebString(const char* latin1, unsigned length);
-    WebString(const unsigned short* utf16, unsigned length);
-    WebString(const WebString&);
-    WebString& operator=(const WebString&);
-    std::string utf8() const;
-    static WebString fromUtf8(const char* utf8);
-    static WebString fromUtf8(const char* utf8, size_t length);
-    const unsigned short* characters() const;
-    unsigned length() const;
-    bool isEmpty() const;
-    bool equal(const char* utf8) const;
-    bool equalIgnoringCase(const char* utf8) const;
-
-    // Not for public API purpose.
-    WebString(WTF::StringImpl*);
-    WTF::StringImpl* impl() const { return m_impl; }
-
-private:
-    WTF::StringImpl* m_impl;
-};
-} // namespace WebKit
-} // namespace BlackBerry
-
-#endif // WebString_h
index 755f04e..2ecce07 100644 (file)
@@ -1,3 +1,228 @@
+2012-10-15  George Staikos  <staikos@webkit.org>
+
+        [BlackBerry] Adapt to Platform API changes in string handling
+        https://bugs.webkit.org/show_bug.cgi?id=99248
+
+        Reviewed by Yong Li.
+
+        Convert usage of WebString, char* and std::string to BlackBerry::Platform::String.
+
+        * Api/BlackBerryGlobal.cpp:
+        (BlackBerry::WebKit::clearAppCache):
+        (BlackBerry::WebKit::clearDatabase):
+        * Api/BlackBerryGlobal.h:
+        (Platform):
+        (WebKit):
+        * Api/JavaScriptVariant.cpp:
+        (BlackBerry::WebKit::JSValueRefToBlackBerryJavaScriptVariant):
+        (BlackBerry::WebKit::BlackBerryJavaScriptVariantToJSValueRef):
+        (BlackBerry::WebKit::JavaScriptVariant::JavaScriptVariant):
+        (WebKit):
+        (BlackBerry::WebKit::JavaScriptVariant::~JavaScriptVariant):
+        (BlackBerry::WebKit::JavaScriptVariant::setType):
+        (BlackBerry::WebKit::JavaScriptVariant::setString):
+        (BlackBerry::WebKit::JavaScriptVariant::stringValue):
+        * Api/JavaScriptVariant.h:
+        * Api/WebAnimation.cpp:
+        (BlackBerry::WebKit::WebAnimation::fadeAnimation):
+        (BlackBerry::WebKit::WebAnimation::name):
+        * Api/WebAnimation.h:
+        * Api/WebCookieJar.cpp:
+        (BlackBerry::WebKit::WebCookieJar::cookies):
+        (BlackBerry::WebKit::WebCookieJar::setCookies):
+        * Api/WebCookieJar.h:
+        (Platform):
+        (BlackBerry):
+        (WebKit):
+        * Api/WebKitMIMETypeConverter.cpp:
+        (BlackBerry::WebKit::getExtensionForMimeType):
+        (BlackBerry::WebKit::getMimeTypeForExtension):
+        * Api/WebKitMIMETypeConverter.h:
+        (Platform):
+        (BlackBerry):
+        (WebKit):
+        * Api/WebKitTextCodec.cpp:
+        (BlackBerry::WebKit::base64Decode):
+        (BlackBerry::WebKit::base64Encode):
+        (BlackBerry::WebKit::unescapeURL):
+        (BlackBerry::WebKit::escapeURL):
+        * Api/WebKitTextCodec.h:
+        (Platform):
+        (BlackBerry):
+        * Api/WebOverlay.cpp:
+        (BlackBerry::WebKit::WebOverlay::removeAnimation):
+        * Api/WebOverlay.h:
+        (Platform):
+        (BlackBerry):
+        (WebKit):
+        * Api/WebOverlayOverride.cpp:
+        (BlackBerry::WebKit::WebOverlayOverride::removeAnimation):
+        * Api/WebOverlayOverride.h:
+        (Platform):
+        (BlackBerry):
+        (WebKit):
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPage::autofillTextField):
+        (BlackBerry::WebKit::WebPage::renderTreeAsText):
+        (BlackBerry::WebKit::WebPage::WebPage):
+        (BlackBerry::WebKit::WebPagePrivate::init):
+        (BlackBerry::WebKit::WebPagePrivate::load):
+        (BlackBerry::WebKit::WebPage::load):
+        (BlackBerry::WebKit::WebPage::loadFile):
+        (BlackBerry::WebKit::WebPage::download):
+        (BlackBerry::WebKit::WebPagePrivate::loadString):
+        (BlackBerry::WebKit::WebPage::loadString):
+        (BlackBerry::WebKit::WebPagePrivate::executeJavaScript):
+        (BlackBerry::WebKit::WebPage::executeJavaScript):
+        (BlackBerry::WebKit::WebPagePrivate::executeJavaScriptInIsolatedWorld):
+        (BlackBerry::WebKit::WebPage::executeJavaScriptInIsolatedWorld):
+        (BlackBerry::WebKit::WebPage::executeJavaScriptFunction):
+        (BlackBerry::WebKit::WebPagePrivate::addOriginAccessWhitelistEntry):
+        (BlackBerry::WebKit::WebPage::addOriginAccessWhitelistEntry):
+        (BlackBerry::WebKit::WebPagePrivate::removeOriginAccessWhitelistEntry):
+        (BlackBerry::WebKit::WebPage::removeOriginAccessWhitelistEntry):
+        (BlackBerry::WebKit::WebPagePrivate::authenticationChallenge):
+        (BlackBerry::WebKit::WebPagePrivate::syncProxyCredential):
+        (BlackBerry::WebKit::WebPagePrivate::notifyPopupAutofillDialog):
+        (BlackBerry::WebKit::WebPagePrivate::webContext):
+        (BlackBerry::WebKit::WebPage::setDateTimeInput):
+        (BlackBerry::WebKit::WebPage::setColorInput):
+        (BlackBerry::WebKit::WebPage::textEncoding):
+        (BlackBerry::WebKit::WebPage::forcedTextEncoding):
+        (BlackBerry::WebKit::WebPage::setForcedTextEncoding):
+        (BlackBerry::WebKit::WebPage::title):
+        (BlackBerry::WebKit::WebPage::selectedText):
+        (BlackBerry::WebKit::WebPage::cutSelectedText):
+        (BlackBerry::WebKit::WebPage::insertText):
+        (BlackBerry::WebKit::WebPage::getBackForwardList):
+        (BlackBerry::WebKit::WebPage::onCertificateStoreLocationSet):
+        (BlackBerry::WebKit::WebPage::dispatchInspectorMessage):
+        (BlackBerry::WebKit::WebPagePrivate::didChangeSettings):
+        (BlackBerry::WebKit::WebPage::textHasAttribute):
+        (BlackBerry::WebKit::WebPage::setAllowNotification):
+        (BlackBerry::WebKit::WebPagePrivate::defaultUserAgent):
+        * Api/WebPage.h:
+        * Api/WebPageClient.h:
+        * Api/WebPage_p.h:
+        (WebPagePrivate):
+        * Api/WebSettings.cpp:
+        (BlackBerry::WebKit::WebSettings::standardSettings):
+        (BlackBerry::WebKit::WebSettings::addSupportedObjectPluginMIMEType):
+        (BlackBerry::WebKit::WebSettings::isSupportedObjectMIMEType):
+        (BlackBerry::WebKit::WebSettings::serifFontFamily):
+        (BlackBerry::WebKit::WebSettings::setSerifFontFamily):
+        (BlackBerry::WebKit::WebSettings::fixedFontFamily):
+        (BlackBerry::WebKit::WebSettings::setFixedFontFamily):
+        (BlackBerry::WebKit::WebSettings::sansSerifFontFamily):
+        (BlackBerry::WebKit::WebSettings::setSansSerifFontFamily):
+        (BlackBerry::WebKit::WebSettings::standardFontFamily):
+        (BlackBerry::WebKit::WebSettings::setStandardFontFamily):
+        (BlackBerry::WebKit::WebSettings::userAgentString):
+        (BlackBerry::WebKit::WebSettings::setUserAgentString):
+        (BlackBerry::WebKit::WebSettings::defaultTextEncodingName):
+        (BlackBerry::WebKit::WebSettings::setDefaultTextEncodingName):
+        (BlackBerry::WebKit::WebSettings::userStyleSheetString):
+        (BlackBerry::WebKit::WebSettings::setUserStyleSheetString):
+        (BlackBerry::WebKit::WebSettings::userStyleSheetLocation):
+        (BlackBerry::WebKit::WebSettings::setUserStyleSheetLocation):
+        (BlackBerry::WebKit::WebSettings::localStoragePath):
+        (BlackBerry::WebKit::WebSettings::setLocalStoragePath):
+        (BlackBerry::WebKit::WebSettings::indexedDataBasePath):
+        (BlackBerry::WebKit::WebSettings::setIndexedDataBasePath):
+        (BlackBerry::WebKit::WebSettings::databasePath):
+        (BlackBerry::WebKit::WebSettings::setDatabasePath):
+        (BlackBerry::WebKit::WebSettings::appCachePath):
+        (BlackBerry::WebKit::WebSettings::setAppCachePath):
+        (BlackBerry::WebKit::WebSettings::pageGroupName):
+        (BlackBerry::WebKit::WebSettings::setPageGroupName):
+        * Api/WebSettings.h:
+        * Api/WebString.cpp: Removed.
+        * Api/WebString.h: Removed.
+        * WebCoreSupport/ChromeClientBlackBerry.cpp:
+        (WebCore::ChromeClientBlackBerry::runJavaScriptPrompt):
+        (WebCore::ChromeClientBlackBerry::createWindow):
+        (WebCore::ChromeClientBlackBerry::runOpenPanel):
+        (WebCore):
+        * WebCoreSupport/ChromeClientBlackBerry.h:
+        (ChromeClientBlackBerry):
+        * WebCoreSupport/ClientExtension.cpp:
+        (clientExtensionMethod):
+        * WebCoreSupport/ColorPickerClient.cpp:
+        (WebCore::ColorPickerClient::ColorPickerClient):
+        (WebCore::ColorPickerClient::generateHTML):
+        * WebCoreSupport/ColorPickerClient.h:
+        (Platform):
+        (BlackBerry):
+        (WebKit):
+        (ColorPickerClient):
+        * WebCoreSupport/CredentialManager.cpp:
+        (WebCore::CredentialManager::autofillAuthenticationChallenge):
+        * WebCoreSupport/CredentialManager.h:
+        (Platform):
+        (CredentialManager):
+        * WebCoreSupport/DatePickerClient.cpp:
+        (WebCore::DatePickerClient::DatePickerClient):
+        (WebCore::DatePickerClient::generateHTML):
+        * WebCoreSupport/DatePickerClient.h:
+        (Platform):
+        (BlackBerry):
+        (WebKit):
+        (DatePickerClient):
+        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+        (WebCore::FrameLoaderClientBlackBerry::dispatchDecidePolicyForResponse):
+        (WebCore::FrameLoaderClientBlackBerry::createDocumentLoader):
+        (WebCore::FrameLoaderClientBlackBerry::dispatchDidFinishLoad):
+        (WebCore::FrameLoaderClientBlackBerry::dispatchDidFailProvisionalLoad):
+        (WebCore::FrameLoaderClientBlackBerry::dispatchCreatePage):
+        (WebCore::FrameLoaderClientBlackBerry::dispatchWillSendRequest):
+        (WebCore::FrameLoaderClientBlackBerry::loadIconExternally):
+        (WebCore::FrameLoaderClientBlackBerry::startDownload):
+        (WebCore::FrameLoaderClientBlackBerry::dispatchDidReceiveIcon):
+        * WebCoreSupport/IconDatabaseClientBlackBerry.cpp:
+        * WebCoreSupport/NotificationPresenterImpl.cpp:
+        (WebCore::NotificationPresenterImpl::show):
+        (WebCore::NotificationPresenterImpl::cancel):
+        (WebCore::NotificationPresenterImpl::requestPermission):
+        (WebCore::NotificationPresenterImpl::onPermission):
+        (WebCore::NotificationPresenterImpl::notificationClicked):
+        * WebCoreSupport/NotificationPresenterImpl.h:
+        (Platform):
+        (NotificationPresenterImpl):
+        * WebCoreSupport/SelectPopupClient.cpp:
+        (WebCore::SelectPopupClient::SelectPopupClient):
+        (WebCore::SelectPopupClient::update):
+        (WebCore::SelectPopupClient::generateHTML):
+        * WebCoreSupport/SelectPopupClient.h:
+        (Platform):
+        (BlackBerry):
+        (SelectPopupClient):
+        * WebCoreSupport/UserMediaClientImpl.cpp:
+        (WebCore::toMediaStreamSource):
+        (WebCore::toMediaStreamDescriptor):
+        (WebCore::UserMediaClientImpl::requestUserMedia):
+        (WebCore::UserMediaClientImpl::cancelUserMediaRequest):
+        * WebKitSupport/AboutData.cpp:
+        (BlackBerry::WebKit::cachePage):
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::convertStringToWchar):
+        (BlackBerry::WebKit::convertStringToWcharVector):
+        (BlackBerry::WebKit::convertSpannableStringToString):
+        (BlackBerry::WebKit::InputHandler::learnText):
+        (BlackBerry::WebKit::InputHandler::spellCheckingRequestProcessed):
+        (BlackBerry::WebKit::InputHandler::openDatePopup):
+        (BlackBerry::WebKit::InputHandler::openSelectPopup):
+        (BlackBerry::WebKit::InputHandler::setText):
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::SelectionHandler::selectedText):
+        * WebKitSupport/SelectionHandler.h:
+        (Platform):
+        (WebKit):
+        (SelectionHandler):
+        * WebKitSupport/SurfacePool.cpp:
+        (BlackBerry::WebKit::SurfacePool::sharedPixmapGroup):
+        * WebKitSupport/SurfacePool.h:
+        (SurfacePool):
+
 2012-10-15  Antonio Gomes  <agomes@rim.com>
 
         [BlackBerry] Clean up BackingStoreClient (part II)
index be60aa1..e49109d 100644 (file)
 #include "WebPage_p.h"
 #include "WebPopupType.h"
 #include "WebSettings.h"
-#include "WebString.h"
 #include "WindowFeatures.h"
 
 #include <BlackBerryPlatformLog.h>
 #include <BlackBerryPlatformSettings.h>
+#include <BlackBerryPlatformString.h>
 #include <BlackBerryPlatformWindow.h>
 
 #include <wtf/text/CString.h>
@@ -138,7 +138,7 @@ bool ChromeClientBlackBerry::runJavaScriptPrompt(Frame* frame, const String& mes
 
     TimerBase::fireTimersInNestedEventLoop();
     CString latinOrigin = toOriginString(frame);
-    WebString clientResult;
+    BlackBerry::Platform::String clientResult;
     if (m_webPagePrivate->m_client->runJavaScriptPrompt(message.characters(), message.length(), defaultValue.characters(), defaultValue.length(), latinOrigin.data(), latinOrigin.length(), clientResult)) {
         result = clientResult;
         return true;
@@ -248,7 +248,7 @@ Page* ChromeClientBlackBerry::createWindow(Frame*, const FrameLoadRequest& reque
     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()));
+    WebPage* webPage = m_webPagePrivate->m_client->createWindow(x, y, width, height, flags, request.resourceRequest().url().string(), request.frameName());
     if (!webPage)
         return 0;
 
@@ -507,26 +507,26 @@ void ChromeClientBlackBerry::exceededDatabaseQuota(Frame* frame, const String& n
 
 void ChromeClientBlackBerry::runOpenPanel(Frame*, PassRefPtr<FileChooser> chooser)
 {
-    SharedArray<WebString> initialFiles;
+    SharedArray<BlackBerry::Platform::String> initialFiles;
     unsigned numberOfInitialFiles = chooser->settings().selectedFiles.size();
     if (numberOfInitialFiles > 0)
-        initialFiles.reset(new WebString[numberOfInitialFiles], numberOfInitialFiles);
+        initialFiles.reset(new BlackBerry::Platform::String[numberOfInitialFiles], numberOfInitialFiles);
     for (unsigned i = 0; i < numberOfInitialFiles; ++i)
         initialFiles[i] = chooser->settings().selectedFiles[i];
 
-    SharedArray<WebString> acceptMIMETypes;
+    SharedArray<BlackBerry::Platform::String> acceptMIMETypes;
     unsigned numberOfTypes = chooser->settings().acceptMIMETypes.size();
     if (numberOfTypes > 0)
-        acceptMIMETypes.reset(new WebString[numberOfTypes], numberOfTypes);
+        acceptMIMETypes.reset(new BlackBerry::Platform::String[numberOfTypes], numberOfTypes);
     for (unsigned i = 0; i < numberOfTypes; ++i)
         acceptMIMETypes[i] = chooser->settings().acceptMIMETypes[i];
 
-    WebString capture;
+    BlackBerry::Platform::String capture;
 #if ENABLE(MEDIA_CAPTURE)
     capture = chooser->settings().capture;
 #endif
 
-    SharedArray<WebString> chosenFiles;
+    SharedArray<BlackBerry::Platform::String> chosenFiles;
 
     {
         PageGroupLoadDeferrer deferrer(m_webPagePrivate->m_page, true);
@@ -773,16 +773,6 @@ void ChromeClientBlackBerry::fullScreenRendererChanged(RenderBox* fullScreenRend
 }
 #endif
 
-#if ENABLE(WEBGL)
-void ChromeClientBlackBerry::requestWebGLPermission(Frame* frame)
-{
-    if (frame) {
-        CString latinOrigin = toOriginString(frame);
-        m_webPagePrivate->m_client->requestWebGLPermission(latinOrigin.data());
-    }
-}
-#endif
-
 #if ENABLE(SVG)
 void ChromeClientBlackBerry::didSetSVGZoomAndPan(Frame* frame, unsigned short zoomAndPan)
 {
index 5172fa8..f35dfe4 100644 (file)
@@ -131,9 +131,6 @@ public:
     virtual void exitFullScreenForElement(Element*);
     virtual void fullScreenRendererChanged(RenderBox*);
 #endif
-#if ENABLE(WEBGL)
-    virtual void requestWebGLPermission(Frame*);
-#endif
 
 #if ENABLE(SVG)
     virtual void didSetSVGZoomAndPan(Frame*, unsigned short zoomAndPan);
index 54c456a..8153321 100644 (file)
@@ -50,9 +50,10 @@ static JSValueRef clientExtensionMethod(
     }
 
     WebPageClient* client = reinterpret_cast<WebPageClient*>(JSObjectGetPrivate(thisObject));
-    string retVal;
+    BlackBerry::Platform::String retVal;
     if (client)
-        retVal = client->invokeClientJavaScriptCallback(strArgs, argumentCount).utf8();
+        retVal = client->invokeClientJavaScriptCallback(strArgs, argumentCount);
+    // FIXME: add a mechanism to pass the length of the string here
     if (!retVal.empty())
         jsRetVal = JSValueMakeString(ctx, JSStringCreateWithUTF8CString(retVal.c_str()));
 
index dc577ec..dfc893f 100644 (file)
 #include "PopupPicker.h"
 #include "RenderObject.h"
 #include "WebPage_p.h"
-#include "WebString.h"
 
+#include <BlackBerryPlatformString.h>
 #include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
-ColorPickerClient::ColorPickerClient(const BlackBerry::WebKit::WebString& value, BlackBerry::WebKit::WebPagePrivate* webPage, HTMLInputElement* element)
+ColorPickerClient::ColorPickerClient(const BlackBerry::Platform::String& value, BlackBerry::WebKit::WebPagePrivate* webPage, HTMLInputElement* element)
     : m_webPage(webPage)
     , m_element(element)
 {
     generateHTML(value);
 }
 
-void ColorPickerClient::generateHTML(const BlackBerry::WebKit::WebString& value)
+void ColorPickerClient::generateHTML(const BlackBerry::Platform::String& value)
 {
     StringBuilder source;
     source.appendLiteral("<style>\n");
@@ -56,8 +56,8 @@ void ColorPickerClient::generateHTML(const BlackBerry::WebKit::WebString& value)
     source.appendLiteral("<script>\n");
     source.appendLiteral("window.addEventListener('load', function () {");
     source.appendLiteral("window.popupcontrol.show(");
-    if (!value.isEmpty())
-        source.append("\"" + String(value.impl()) + "\"); \n }); \n");
+    if (!value.empty())
+        source.append("\"" + String(value) + "\"); \n }); \n");
     else
         source.appendLiteral("); \n }); \n");
     source.append(colorControlBlackBerryJs, sizeof(colorControlBlackBerryJs));
index bfd2064..8449651 100644 (file)
 #include <BlackBerryPlatformInputEvents.h>
 
 namespace BlackBerry {
+namespace Platform {
+class String;
+}
+
 namespace WebKit {
 class WebPagePrivate;
-class WebString;
 }
 }
 
@@ -35,9 +38,9 @@ class HTMLInputElement;
 
 class ColorPickerClient : public PagePopupClient {
 public:
-    ColorPickerClient(const BlackBerry::WebKit::WebString& value, BlackBerry::WebKit::WebPagePrivate*, HTMLInputElement*);
+    ColorPickerClient(const BlackBerry::Platform::String& value, BlackBerry::WebKit::WebPagePrivate*, HTMLInputElement*);
 
-    void generateHTML(const BlackBerry::WebKit::WebString& value);
+    void generateHTML(const BlackBerry::Platform::String& value);
     void writeDocument(DocumentWriter&);
     IntSize contentSize();
     String htmlSource() const;
index e806086..c4e7e99 100644 (file)
@@ -27,9 +27,8 @@
 #include "KURL.h"
 #include "Logging.h"
 #include "PageClientBlackBerry.h"
-#include "WebString.h"
 
-using BlackBerry::WebKit::WebString;
+#include <BlackBerryPlatformString.h>
 
 namespace WebCore {
 
@@ -41,7 +40,7 @@ CredentialManager& credentialManager()
     return *credentialManager;
 }
 
-void CredentialManager::autofillAuthenticationChallenge(const ProtectionSpace& protectionSpace, WebString& username, WebString& password)
+void CredentialManager::autofillAuthenticationChallenge(const ProtectionSpace& protectionSpace, BlackBerry::Platform::String& username, BlackBerry::Platform::String& password)
 {
     if (credentialBackingStore().hasNeverRemember(protectionSpace))
         return;
index 92ce530..5a23a6b 100644 (file)
@@ -27,8 +27,8 @@
 class PageClientBlackBerry;
 
 namespace BlackBerry {
-namespace WebKit {
-class WebString;
+namespace Platform {
+class String;
 }
 }
 
@@ -39,7 +39,7 @@ class CredentialTransformData;
 
 class CredentialManager {
 public:
-    void autofillAuthenticationChallenge(const ProtectionSpace&, BlackBerry::WebKit::WebString& username, BlackBerry::WebKit::WebString& password);
+    void autofillAuthenticationChallenge(const ProtectionSpace&, BlackBerry::Platform::String& username, BlackBerry::Platform::String& password);
     void autofillPasswordForms(PassRefPtr<HTMLCollection> docForms);
     void saveCredentialIfConfirmed(PageClientBlackBerry*, const CredentialTransformData&);
     void clearCredentials();
index 6778330..40655d3 100644 (file)
 #include "PopupPicker.h"
 #include "RenderObject.h"
 #include "WebPage_p.h"
-#include "WebString.h"
 
+#include <BlackBerryPlatformString.h>
 #include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
-DatePickerClient::DatePickerClient(BlackBerry::Platform::BlackBerryInputType type, const BlackBerry::WebKit::WebString& value, const BlackBerry::WebKit::WebString& min, const BlackBerry::WebKit::WebString& max, double step, BlackBerry::WebKit::WebPagePrivate* webPage, HTMLInputElement* element)
+DatePickerClient::DatePickerClient(BlackBerry::Platform::BlackBerryInputType type, const BlackBerry::Platform::String& value, const BlackBerry::Platform::String& min, const BlackBerry::Platform::String& max, double step, BlackBerry::WebKit::WebPagePrivate* webPage, HTMLInputElement* element)
     : m_type(type)
     , m_webPage(webPage)
     , m_element(element)
@@ -47,7 +47,7 @@ DatePickerClient::~DatePickerClient()
 {
 }
 
-void DatePickerClient::generateHTML(BlackBerry::Platform::BlackBerryInputType type, const BlackBerry::WebKit::WebString& value, const BlackBerry::WebKit::WebString& min, const BlackBerry::WebKit::WebString& max, double step)
+void DatePickerClient::generateHTML(BlackBerry::Platform::BlackBerryInputType type, const BlackBerry::Platform::String& value, const BlackBerry::Platform::String& min, const BlackBerry::Platform::String& max, double step)
 {
     StringBuilder source;
     source.appendLiteral("<style>\n");
@@ -80,17 +80,17 @@ void DatePickerClient::generateHTML(BlackBerry::Platform::BlackBerryInputType ty
     default:
         break;
     }
-    if (!value.isEmpty())
-        source.append("\"" + String(value.impl()) + "\", ");
+    if (!value.empty())
+        source.append("\"" + String(value) + "\", ");
     else
         source.appendLiteral("0, ");
 
-    if (!min.isEmpty())
-        source.append(String(min.impl()) + ", ");
+    if (!min.empty())
+        source.append(String(min) + ", ");
     else
         source.appendLiteral("0, ");
-    if (!max.isEmpty())
-        source.append(String(max.impl()) + ", ");
+    if (!max.empty())
+        source.append(String(max) + ", ");
     else
         source.appendLiteral("0, ");
     source.append(String::number(step));
index 8cea033..2e3be9e 100644 (file)
 #include <BlackBerryPlatformInputEvents.h>
 
 namespace BlackBerry {
+namespace Platform {
+class String;
+}
+
 namespace WebKit {
 class WebPagePrivate;
-class WebString;
 }
 }
 
@@ -35,10 +38,10 @@ class HTMLInputElement;
 
 class DatePickerClient : public PagePopupClient {
 public:
-    DatePickerClient(BlackBerry::Platform::BlackBerryInputType, const BlackBerry::WebKit::WebString& value, const BlackBerry::WebKit::WebString& min, const BlackBerry::WebKit::WebString& max, double step, BlackBerry::WebKit::WebPagePrivate*, HTMLInputElement*);
+    DatePickerClient(BlackBerry::Platform::BlackBerryInputType, const BlackBerry::Platform::String& value, const BlackBerry::Platform::String& min, const BlackBerry::Platform::String& max, double step, BlackBerry::WebKit::WebPagePrivate*, HTMLInputElement*);
     ~DatePickerClient();
 
-    void generateHTML(BlackBerry::Platform::BlackBerryInputType, const BlackBerry::WebKit::WebString& value, const BlackBerry::WebKit::WebString& min, const BlackBerry::WebKit::WebString& max, double step);
+    void generateHTML(BlackBerry::Platform::BlackBerryInputType, const BlackBerry::Platform::String& value, const BlackBerry::Platform::String& min, const BlackBerry::Platform::String& max, double step);
 
     void writeDocument(DocumentWriter&);
     virtual IntSize contentSize();
index 8603cb6..b9a5193 100644 (file)
@@ -196,8 +196,7 @@ void FrameLoaderClientBlackBerry::dispatchDecidePolicyForResponse(FramePolicyFun
         policy = PolicyDownload;
     else if (canShowMIMEType(response.mimeType()))
         policy = PolicyUse;
-    else if ((ResourceRequest::TargetIsMainFrame == request.targetType())
-             && m_webPagePrivate->m_client->downloadAllowed(request.url().string().utf8().data()))
+    else if (ResourceRequest::TargetIsMainFrame == request.targetType() && m_webPagePrivate->m_client->downloadAllowed(request.url().string()))
         policy = PolicyDownload;
 
     (m_frame->loader()->policyChecker()->*function)(policy);
@@ -405,7 +404,7 @@ PassRefPtr<DocumentLoader> FrameLoaderClientBlackBerry::createDocumentLoader(con
             String aboutWhat = request.url().string().substring(6);
             source = aboutData(aboutWhat);
         } else if (request.url().protocolIs("rtsp"))
-            source = BlackBerry::Platform::mediaDocument(request.url().string().utf8().data()).c_str();
+            source = BlackBerry::Platform::mediaDocument(request.url().string());
 
         if (!source.isEmpty()) {
             // Always ignore existing substitute data if any.
@@ -596,10 +595,10 @@ void FrameLoaderClientBlackBerry::dispatchDidFinishLoad()
     // Process document metadata.
     RefPtr<NodeList> nodeList = headElement->getElementsByTagName(HTMLNames::metaTag.localName());
     unsigned int size = nodeList->length();
-    ScopeArray<WebString> headers;
+    ScopeArray<BlackBerry::Platform::String> headers;
 
     // This may allocate more space than needed since not all meta elements will be http-equiv.
-    headers.reset(new WebString[2 * size]);
+    headers.reset(new BlackBerry::Platform::String[2 * size]);
     unsigned headersLength = 0;
 
     for (unsigned i = 0; i < size; ++i) {
@@ -634,11 +633,11 @@ void FrameLoaderClientBlackBerry::dispatchDidFinishLoad()
                 m_webPagePrivate->m_client->setLargeIcon(href.latin1().data());
             else if (WTF::equalIgnoringCase(linkElement->rel(), "search")) {
                 if (WTF::equalIgnoringCase(linkElement->type(), "application/opensearchdescription+xml"))
-                    m_webPagePrivate->m_client->setSearchProviderDetails(title.utf8().data(), href.utf8().data());
+                    m_webPagePrivate->m_client->setSearchProviderDetails(title, href);
             } else if (WTF::equalIgnoringCase(linkElement->rel(), "alternate")
                 && (WTF::equalIgnoringCase(linkElement->type(), "application/rss+xml")
                 || WTF::equalIgnoringCase(linkElement->type(), "application/atom+xml")))
-                m_webPagePrivate->m_client->setAlternateFeedDetails(title.utf8().data(), href.utf8().data());
+                m_webPagePrivate->m_client->setAlternateFeedDetails(title, href);
         }
     }
 
@@ -708,9 +707,7 @@ void FrameLoaderClientBlackBerry::dispatchDidFailProvisionalLoad(const ResourceE
     if (!isMainFrame())
         return;
 
-    String errorPage = m_webPagePrivate->m_client->getErrorPage(error.errorCode()
-            , error.localizedDescription().isEmpty() ? "" : error.localizedDescription().utf8().data()
-            , error.failingURL().isEmpty() ? "" : error.failingURL().utf8().data());
+    String errorPage = m_webPagePrivate->m_client->getErrorPage(error.errorCode(), error.localizedDescription(), error.failingURL());
 
     // Make sure we're still in the provisionalLoad state - getErrorPage runs a
     // nested event loop while it's waiting for client resources to load so
@@ -945,7 +942,7 @@ void FrameLoaderClientBlackBerry::notifyBackForwardListChanged() const
 
 Frame* FrameLoaderClientBlackBerry::dispatchCreatePage(const NavigationAction& navigation)
 {
-    WebPage* webPage = m_webPagePrivate->m_client->createWindow(0, 0, -1, -1, WebPageClient::FlagWindowDefault, navigation.url().string(), WebString());
+    WebPage* webPage = m_webPagePrivate->m_client->createWindow(0, 0, -1, -1, WebPageClient::FlagWindowDefault, navigation.url().string(), BlackBerry::Platform::String::emptyString());
     if (!webPage)
         return 0;
 
@@ -977,8 +974,8 @@ void FrameLoaderClientBlackBerry::dispatchWillSendRequest(DocumentLoader* docLoa
     m_webPagePrivate->m_client->populateCustomHeaders(platformRequest);
     const NetworkRequest::HeaderList& headerLists = platformRequest.getHeaderListRef();
     for (NetworkRequest::HeaderList::const_iterator it = headerLists.begin(); it != headerLists.end(); ++it) {
-        std::string headerString = it->first;
-        std::string headerValueString = it->second;
+        BlackBerry::Platform::String headerString = it->first;
+        BlackBerry::Platform::String headerValueString = it->second;
         request.setHTTPHeaderField(String::fromUTF8WithLatin1Fallback(headerString.data(), headerString.length()), String::fromUTF8WithLatin1Fallback(headerValueString.data(), headerValueString.length()));
     }
     if (!isMainResourceLoad) {
@@ -1024,7 +1021,7 @@ bool FrameLoaderClientBlackBerry::shouldUseCredentialStorage(DocumentLoader* loa
 
 void FrameLoaderClientBlackBerry::loadIconExternally(const String& originalPageUrl, const String& finalPageUrl, const String& iconUrl)
 {
-    m_webPagePrivate->m_client->setIconForUrl(originalPageUrl.utf8().data(), finalPageUrl.utf8().data(), iconUrl.utf8().data());
+    m_webPagePrivate->m_client->setIconForUrl(originalPageUrl, finalPageUrl, iconUrl);
 }
 
 void FrameLoaderClientBlackBerry::saveViewStateToItem(HistoryItem* item)
@@ -1182,7 +1179,7 @@ PassRefPtr<FrameNetworkingContext> FrameLoaderClientBlackBerry::createNetworking
 
 void FrameLoaderClientBlackBerry::startDownload(const ResourceRequest& request, const String& suggestedName)
 {
-    m_webPagePrivate->load(request.url().string().utf8().data(), 0, "GET", NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, false, false, true, "", suggestedName.utf8().data());
+    m_webPagePrivate->load(request.url().string(), BlackBerry::Platform::String::emptyString(), "GET", NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, false, false, true, "", suggestedName);
 }
 
 void FrameLoaderClientBlackBerry::download(ResourceHandle* handle, const ResourceRequest&, const ResourceRequest&, const ResourceResponse& r)
@@ -1211,7 +1208,7 @@ void FrameLoaderClientBlackBerry::dispatchDidReceiveIcon()
     base64Encode(static_cast<const char*>(data->data()), data->size(), out);
     out.append('\0'); // Make it null-terminated.
     String iconUrl = iconDatabase().synchronousIconURLForPageURL(url);
-    m_webPagePrivate->m_client->setFavicon(out.data(), iconUrl.utf8().data());
+    m_webPagePrivate->m_client->setFavicon(out.data(), iconUrl);
     data->unref();
 }
 
index da95cb0..04c1eb0 100644 (file)
@@ -22,7 +22,6 @@
 #include "BlackBerryPlatformSettings.h"
 #include "IconDatabase.h"
 #include "WebSettings.h"
-#include "WebString.h"
 
 namespace WebCore {
 
index 48ccf3a..8725d93 100644 (file)
@@ -20,6 +20,7 @@
 #include "NotificationPresenterImpl.h"
 
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+#include <BlackBerryPlatformString.h>
 #include <Event.h>
 #include <Notification.h>
 #include <NotificationPresenterBlackBerry.h>
@@ -68,7 +69,7 @@ bool NotificationPresenterImpl::show(Notification* notification)
         message = n->contents().title + ": " + n->contents().body;
     }
 
-    m_platformPresenter->show(std::string(uuid.utf8().data()), std::string(message.utf8().data()));
+    m_platformPresenter->show(uuid, message);
     return true;
 }
 
@@ -81,7 +82,7 @@ void NotificationPresenterImpl::cancel(Notification* notification)
     if (it == m_notifications.end())
         return;
 
-    m_platformPresenter->cancel(std::string(it->value.utf8().data()));
+    m_platformPresenter->cancel(it->value);
     m_notifications.remove(it);
 }
 
@@ -99,23 +100,22 @@ void NotificationPresenterImpl::requestPermission(ScriptExecutionContext* contex
 {
     ASSERT(context);
     m_permissionRequests.add(context, callback);
-    m_platformPresenter->requestPermission(std::string(context->url().host().utf8().data()));
+    m_platformPresenter->requestPermission(context->url().host());
 }
 
-void NotificationPresenterImpl::onPermission(const std::string& domain, bool isAllowed)
+void NotificationPresenterImpl::onPermission(const BlackBerry::Platform::String& domain, bool isAllowed)
 {
     ASSERT(!domain.empty());
-    String domainString = String::fromUTF8(domain.c_str());
     PermissionRequestMap::iterator it = m_permissionRequests.begin();
     for (; it != m_permissionRequests.end(); ++it) {
-        if (it->key->url().host() != domainString)
+        if (it->key->url().host() != domain)
             continue;
 
         if (isAllowed) {
-            m_allowedDomains.add(domainString);
+            m_allowedDomains.add(domain);
             it->value->handleEvent();
         } else
-            m_allowedDomains.remove(domainString);
+            m_allowedDomains.remove(domain);
 
         m_permissionRequests.remove(it);
         return;
@@ -138,13 +138,12 @@ NotificationClient::Permission NotificationPresenterImpl::checkPermission(Script
 }
 
 // This function is called in platform side.
-void NotificationPresenterImpl::notificationClicked(const std::string& id)
+void NotificationPresenterImpl::notificationClicked(const BlackBerry::Platform::String& id)
 {
     ASSERT(!id.empty());
-    String idString = String::fromUTF8(id.c_str());
     NotificationMap::iterator it = m_notifications.begin();
     for (; it != m_notifications.end(); ++it) {
-        if (it->value == idString && it->key->scriptExecutionContext()) {
+        if (it->value == id && it->key->scriptExecutionContext()) {
             RefPtr<Notification> notification = it->key;
             it->key->dispatchEvent(Event::create(eventNames().clickEvent, false, true));
             m_notifications.remove(notification);
index 25e916a..2d5e520 100644 (file)
 #include <NotificationAckListener.h>
 #include <NotificationClient.h>
 #include <NotificationPresenterBlackBerry.h>
-#include <string>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/text/StringHash.h>
 
+namespace BlackBerry {
+namespace Platform {
+class String;
+}
+}
+
 namespace WebCore {
 
 class NotificationPresenterImpl : public WebCore::NotificationClient, public BlackBerry::Platform::NotificationAckListener {
@@ -61,8 +66,8 @@ public:
     virtual Permission checkPermission(WebCore::ScriptExecutionContext*);
 
     // Interfaces inherited from NotificationAckListener.
-    virtual void notificationClicked(const std::string& id);
-    virtual void onPermission(const std::string& domain, bool isAllowed);
+    virtual void notificationClicked(const BlackBerry::Platform::String& id);
+    virtual void onPermission(const BlackBerry::Platform::String& domain, bool isAllowed);
 
 private:
     NotificationPresenterImpl();
index 97a552f..99d1a06 100644 (file)
 #include "RenderObject.h"
 #include "WebPage_p.h"
 
+#include <BlackBerryPlatformString.h>
 #include <wtf/text/StringBuilder.h>
 
 #define CELL_HEIGHT 30
 
 namespace WebCore {
 
-SelectPopupClient::SelectPopupClient(bool multiple, int size, const ScopeArray<BlackBerry::WebKit::WebString>& labels, bool* enableds,
+SelectPopupClient::SelectPopupClient(bool multiple, int size, const ScopeArray<BlackBerry::Platform::String>& labels, bool* enableds,
     const int* itemType, bool* selecteds, BlackBerry::WebKit::WebPagePrivate* webPage, HTMLSelectElement* element)
     : m_multiple(multiple)
     , m_size(size)
@@ -53,7 +54,7 @@ SelectPopupClient::~SelectPopupClient()
 {
 }
 
-void SelectPopupClient::update(bool multiple, int size, const ScopeArray<BlackBerry::WebKit::WebString>& labels, bool* enableds,
+void SelectPopupClient::update(bool multiple, int size, const ScopeArray<BlackBerry::Platform::String>& labels, bool* enableds,
     const int* itemType, bool* selecteds, BlackBerry::WebKit::WebPagePrivate*, HTMLSelectElement* element)
 {
     m_multiple = multiple;
@@ -62,7 +63,7 @@ void SelectPopupClient::update(bool multiple, int size, const ScopeArray<BlackBe
     generateHTML(multiple, size, labels, enableds, itemType, selecteds);
 }
 
-void SelectPopupClient::generateHTML(bool multiple, int size, const ScopeArray<BlackBerry::WebKit::WebString>& labels, bool* enableds,
+void SelectPopupClient::generateHTML(bool multiple, int size, const ScopeArray<BlackBerry::Platform::String>& labels, bool* enableds,
     const int* itemType, bool* selecteds)
 {
     StringBuilder source;
@@ -83,7 +84,7 @@ void SelectPopupClient::generateHTML(bool multiple, int size, const ScopeArray<B
     // Add labels.
     source.append('[');
     for (int i = 0; i < size; i++) {
-        source.append("'" + String(labels[i].impl()).replace('\\', "\\\\").replace('\'', "\\'") + "'");
+        source.append("'" + String(labels[i]).replace('\\', "\\\\").replace('\'', "\\'") + "'");
         // Don't append ',' to last element.
         if (i != size - 1)
             source.appendLiteral(", ");
index d55ffe9..2b5f55c 100644 (file)
 #include "PagePopupClient.h"
 #include "ScopePointer.h"
 #include "Timer.h"
-#include "WebString.h"
 #include <wtf/text/WTFString.h>
 
 namespace BlackBerry {
+namespace Platform {
+class String;
+}
+
 namespace WebKit {
 class WebPagePrivate;
 }
@@ -39,12 +42,12 @@ class PagePopup;
 
 class SelectPopupClient : public PagePopupClient {
 public:
-    SelectPopupClient(bool multiple, int size, const ScopeArray<BlackBerry::WebKit::WebString>& labels, bool* enableds, const int* itemType, bool* selecteds, BlackBerry::WebKit::WebPagePrivate*, HTMLSelectElement*);
+    SelectPopupClient(bool multiple, int size, const ScopeArray<BlackBerry::Platform::String>& labels, bool* enableds, const int* itemType, bool* selecteds, BlackBerry::WebKit::WebPagePrivate*, HTMLSelectElement*);
     ~SelectPopupClient();
 
-    void update(bool multiple, int size, const ScopeArray<BlackBerry::WebKit::WebString>& labels, bool* enableds, const int* itemType, bool* selecteds, BlackBerry::WebKit::WebPagePrivate*, HTMLSelectElement*);
+    void update(bool multiple, int size, const ScopeArray<BlackBerry::Platform::String>& labels, bool* enableds, const int* itemType, bool* selecteds, BlackBerry::WebKit::WebPagePrivate*, HTMLSelectElement*);
 
-    void generateHTML(bool multiple, int size, const ScopeArray<BlackBerry::WebKit::WebString>& labels, bool* enableds, const int* itemType, bool* selecteds);
+    void generateHTML(bool multiple, int size, const ScopeArray<BlackBerry::Platform::String>& labels, bool* enableds, const int* itemType, bool* selecteds);
     void notifySelectionChange(WebCore::Timer<SelectPopupClient> *);
 
     void writeDocument(DocumentWriter&);
index 1a2e7b2..95d2c23 100644 (file)
@@ -50,7 +50,7 @@ static UserMediaRequestsMap& userMediaRequestsMap()
 
 static PassRefPtr<MediaStreamSource> toMediaStreamSource(const WebMediaStreamSource& src)
 {
-    return MediaStreamSource::create(String::fromUTF8(src.id().c_str()), static_cast<MediaStreamSource::Type>(src.type()), String::fromUTF8(src.name().c_str()));
+    return MediaStreamSource::create(WTF::String::fromUTF8(src.id().c_str()), static_cast<MediaStreamSource::Type>(src.type()), WTF::String::fromUTF8(src.name().c_str()));
 }
 
 static PassRefPtr<MediaStreamDescriptor> toMediaStreamDescriptor(const WebMediaStreamDescriptor& d)
@@ -67,7 +67,7 @@ static PassRefPtr<MediaStreamDescriptor> toMediaStreamDescriptor(const WebMediaS
         videoSources.append(src.release());
     }
 
-    return MediaStreamDescriptor::create(String::fromUTF8(d.label().c_str()), audioSources, videoSources);
+    return MediaStreamDescriptor::create(WTF::String::fromUTF8(d.label().c_str()), audioSources, videoSources);
 }
 
 class WebUserMediaRequestClientImpl : public WebUserMediaRequestClient {
@@ -118,7 +118,7 @@ void UserMediaClientImpl::requestUserMedia(PassRefPtr<UserMediaRequest> prpReque
     OwnPtr<WebUserMediaRequestClientImpl> requestClient = adoptPtr(new WebUserMediaRequestClientImpl(prpRequest));
 
     SecurityOrigin* origin = request->scriptExecutionContext()->securityOrigin();
-    m_page->client()->requestUserMedia(WebUserMediaRequest(request->audio(), request->video(), origin->toString().utf8().data(), requestClient.get()));
+    m_page->client()->requestUserMedia(WebUserMediaRequest(request->audio(), request->video(), origin->toString(), requestClient.get()));
     userMediaRequestsMap().add(request, requestClient.release());
 }
 
@@ -129,7 +129,7 @@ void UserMediaClientImpl::cancelUserMediaRequest(UserMediaRequest* request)
         return;
 
     SecurityOrigin* origin = request->scriptExecutionContext()->securityOrigin();
-    m_page->client()->cancelUserMediaRequest(WebUserMediaRequest(request->audio(), request->video(), origin->toString().utf8().data(), it->value.get()));
+    m_page->client()->cancelUserMediaRequest(WebUserMediaRequest(request->audio(), request->video(), origin->toString(), it->value.get()));
     userMediaRequestsMap().remove(it);
 }
 
index 61b362b..970ebda 100644 (file)
@@ -460,8 +460,8 @@ static String cachePage(String cacheCommand)
     if (cacheCommand.isEmpty())
         result.append(String(BlackBerry::Platform::generateHtmlFragmentForCacheKeys().data()));
     else if (cacheCommand.startsWith("?query=", false)) {
-        std::string key(cacheCommand.substring(7).utf8().data()); // 7 is length of "query=".
-        result.append(String(key.data()));
+        String key(cacheCommand.substring(7).utf8().data()); // 7 is length of "query=".
+        result.append(key);
         result.append(String("<hr>"));
         result.append(String(BlackBerry::Platform::generateHtmlFragmentForCacheHeaders(key).data()));
     } else {
index 10d4b16..bfe3a1b 100644 (file)
@@ -459,7 +459,7 @@ void InputHandler::setPluginFocused(Element* element)
     m_currentFocusElement = element;
 }
 
-static bool convertStringToWchar(const String& string, wchar_t* dest, int destCapacity, int* destLength)
+static bool convertStringToWchar(const WTF::String& string, wchar_t* dest, int destCapacity, int* destLength)
 {
     ASSERT(dest);
 
@@ -479,7 +479,7 @@ static bool convertStringToWchar(const String& string, wchar_t* dest, int destCa
     return true;
 }
 
-static bool convertStringToWcharVector(const String& string, WTF::Vector<wchar_t>& wcharString)
+static bool convertStringToWcharVector(const WTF::String& string, WTF::Vector<wchar_t>& wcharString)
 {
     ASSERT(wcharString.isEmpty());
 
@@ -500,16 +500,16 @@ static bool convertStringToWcharVector(const String& string, WTF::Vector<wchar_t
     return true;
 }
 
-static String convertSpannableStringToString(spannable_string_t* src)
+static WTF::String convertSpannableStringToString(spannable_string_t* src)
 {
     if (!src || !src->str || !src->length)
-        return String();
+        return WTF::String();
 
     WTF::Vector<UChar> dest;
     int destCapacity = (src->length * 2) + 1;
     if (!dest.tryReserveCapacity(destCapacity)) {
         logAlways(LogLevelCritical, "InputHandler::convertSpannableStringToString Cannot allocate memory for string.");
-        return String();
+        return WTF::String();
     }
 
     int destLength = 0;
@@ -518,10 +518,10 @@ static String convertSpannableStringToString(spannable_string_t* src)
     u_strFromUTF32(dest.data(), destCapacity, &destLength, reinterpret_cast<UChar32*>(src->str), src->length, &ec);
     if (ec) {
         logAlways(LogLevelCritical, "InputHandler::convertSpannableStringToString Error converting string ec (%d).", ec);
-        return String();
+        return WTF::String();
     }
     dest.resize(destLength);
-    return String(dest.data(), destLength);
+    return WTF::String(dest.data(), destLength);
 }
 
 void InputHandler::sendLearnTextDetails(const WTF::String& string)
@@ -542,7 +542,7 @@ void InputHandler::learnText()
     if (m_currentFocusElementTextEditMask & NO_PREDICTION || m_currentFocusElementTextEditMask & NO_AUTO_TEXT)
         return;
 
-    String textInField(elementText());
+    WTF::String textInField(elementText());
     textInField = textInField.substring(std::max(0, static_cast<int>(textInField.length() - MaxLearnTextDataSize)), textInField.length());
     textInField.remove(0, textInField.find(" "));
 
@@ -642,7 +642,7 @@ void InputHandler::spellCheckingRequestProcessed(int32_t transactionId, spannabl
     Vector<TextCheckingResult> results;
 
     // Convert the spannableString to TextCheckingResult then append to results vector.
-    String replacement;
+    WTF::String replacement;
     TextCheckingResult textCheckingResult;
     textCheckingResult.type = TextCheckingTypeSpelling;
     textCheckingResult.replacement = replacement;
@@ -959,9 +959,9 @@ bool InputHandler::openDatePopup(HTMLInputElement* element, BlackBerryInputType
     case BlackBerry::Platform::InputTypeMonth: {
         // Check if popup already exists, close it if does.
         m_webPage->m_page->chrome()->client()->closePagePopup(0);
-        String value = element->value();
-        String min = element->getAttribute(HTMLNames::minAttr).string();
-        String max = element->getAttribute(HTMLNames::maxAttr).string();
+        WTF::String value = element->value();
+        WTF::String min = element->getAttribute(HTMLNames::minAttr).string();
+        WTF::String max = element->getAttribute(HTMLNames::maxAttr).string();
         double step = element->getAttribute(HTMLNames::stepAttr).toDouble();
 
         DatePickerClient* client = new DatePickerClient(type, value, min, max, step,  m_webPage, element);
@@ -1641,8 +1641,8 @@ bool InputHandler::openSelectPopup(HTMLSelectElement* select)
     int size = listItems.size();
 
     bool multiple = select->multiple();
-    ScopeArray<WebString> labels;
-    labels.reset(new WebString[size]);
+    ScopeArray<BlackBerry::Platform::String> labels;
+    labels.reset(new BlackBerry::Platform::String[size]);
 
     // Check if popup already exists, close it if does.
     m_webPage->m_page->chrome()->client()->closePagePopup(0);
@@ -2051,7 +2051,7 @@ bool InputHandler::setText(spannable_string_t* spannableString)
     // changes should not be handled as notification event.
     m_webPage->m_selectionHandler->setSelectionActive(false);
 
-    String textToInsert = convertSpannableStringToString(spannableString);
+    WTF::String textToInsert = convertSpannableStringToString(spannableString);
     int textLength = textToInsert.length();
 
     InputLog(LogLevelInfo, "InputHandler::setText spannableString is '%s', of length %d", textToInsert.latin1().data(), textLength);
index e6c07ff..2cd4ee3 100644 (file)
@@ -91,7 +91,7 @@ void SelectionHandler::cancelSelection()
         m_webPage->focusedOrMainFrame()->selection()->clear();
 }
 
-WebString SelectionHandler::selectedText() const
+BlackBerry::Platform::String SelectionHandler::selectedText() const
 {
     return m_webPage->focusedOrMainFrame()->editor()->selectedText();
 }
index 74f1746..5bf4a67 100644 (file)
@@ -40,11 +40,13 @@ class VisibleSelection;
 }
 
 namespace BlackBerry {
+namespace Platform {
+class String;
+}
 
 namespace WebKit {
 
 class WebPagePrivate;
-class WebString;
 
 class SelectionHandler {
 public:
@@ -55,7 +57,7 @@ public:
     void setSelectionActive(bool active) { m_selectionActive = active; }
 
     void cancelSelection();
-    WebString selectedText() const;
+    BlackBerry::Platform::String selectedText() const;
 
     bool selectionContains(const WebCore::IntPoint&);
 
index 0e0c834..d2d917e 100644 (file)
@@ -151,7 +151,7 @@ TileBuffer* SurfacePool::backBuffer() const
     return reinterpret_cast<TileBuffer*>(m_backBuffer);
 }
 
-std::string SurfacePool::sharedPixmapGroup() const
+const char *SurfacePool::sharedPixmapGroup() const
 {
     return SHARED_PIXMAP_GROUP;
 }
index 6f4b22f..28626a6 100644 (file)
@@ -60,7 +60,7 @@ public:
     // backingstore.
     TileBuffer* backBuffer() const;
 
-    std::string sharedPixmapGroup() const;
+    const char *sharedPixmapGroup() const;
 
     void releaseBuffers();
     void createBuffers();
index 19e7897..6e1c5f4 100644 (file)
@@ -1,3 +1,18 @@
+2012-10-15  George Staikos  <staikos@webkit.org>
+
+        [BlackBerry] Adapt to Platform API changes in string handling
+        https://bugs.webkit.org/show_bug.cgi?id=99248
+
+        Reviewed by Yong Li.
+
+        Convert usage of WebString, char* and std::string to BlackBerry::Platform::String.
+
+        * DumpRenderTree/blackberry/DumpRenderTree.cpp:
+        (BlackBerry::WebKit::DumpRenderTree::runTest):
+        * DumpRenderTree/blackberry/WorkQueueItemBlackBerry.cpp:
+        (LoadHTMLStringItem::invoke):
+        (ScriptItem::invoke):
+
 2012-10-15  Kangil Han  <kangil.han@samsung.com>
 
         [EFL][EWebLauncher] Add encoding detector option.
index fa57c46..00321ac 100644 (file)
@@ -193,7 +193,7 @@ void DumpRenderTree::runTest(const String& url)
     FILE* current = fopen(m_currentTestFile.utf8().data(), "w");
     fwrite(m_currentTest->utf8().data(), 1, m_currentTest->utf8().length(), current);
     fclose(current);
-    m_page->load(url.utf8().data(), 0, false);
+    m_page->load(url, BlackBerry::Platform::String::emptyString(), false);
 }
 
 void DumpRenderTree::doneDrt()
index a948fcb..394e408 100644 (file)
@@ -61,7 +61,7 @@ bool LoadHTMLStringItem::invoke() const
     JSStringGetUTF8CString(m_content.get(), content.get(), contentSize);
     JSStringGetUTF8CString(m_baseURL.get(), baseURL.get(), baseURLSize);
     JSStringGetUTF8CString(m_unreachableURL.get(), unreachableURL.get(), unreachableURLSize);
-    BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->loadString(content.get(), baseURL.get(), "text/html", unreachableURLSize ? unreachableURL.get() : 0);
+    BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->loadString(content.get(), baseURL.get(), "text/html", unreachableURLSize ? unreachableURL.get() : "");
     return true;
 }
 
@@ -74,11 +74,11 @@ bool ReloadItem::invoke() const
 bool ScriptItem::invoke() const
 {
     BlackBerry::WebKit::JavaScriptDataType type;
-    BlackBerry::WebKit::WebString result;
+    BlackBerry::Platform::String result;
     size_t scriptArrSize = JSStringGetMaximumUTF8CStringSize(m_script.get());
     OwnArrayPtr<char> script = adoptArrayPtr(new char[scriptArrSize]);
     JSStringGetUTF8CString(m_script.get(), script.get(), scriptArrSize);
-    BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->executeJavaScript(script.get(), type, result);
+    BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->executeJavaScript(BlackBerry::Platform::String::fromRawData(script.get(), scriptArrSize), type, result);
     return true;
 }