diff options
Diffstat (limited to 'WebKit/android/WebCoreSupport')
19 files changed, 454 insertions, 103 deletions
diff --git a/WebKit/android/WebCoreSupport/CachedFramePlatformDataAndroid.cpp b/WebKit/android/WebCoreSupport/CachedFramePlatformDataAndroid.cpp new file mode 100644 index 0000000..30f374f --- /dev/null +++ b/WebKit/android/WebCoreSupport/CachedFramePlatformDataAndroid.cpp @@ -0,0 +1,66 @@ +/* + * Copyright 2009, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "CachedFramePlatformDataAndroid.h" +#include "Settings.h" + +namespace android { + +CachedFramePlatformDataAndroid::CachedFramePlatformDataAndroid(WebCore::Settings* settings) +{ +#ifdef ANDROID_META_SUPPORT + m_viewport_width = settings->viewportWidth(); + m_viewport_height = settings->viewportHeight(); + m_viewport_initial_scale = settings->viewportInitialScale(); + m_viewport_minimum_scale = settings->viewportMinimumScale(); + m_viewport_maximum_scale = settings->viewportMaximumScale(); + m_viewport_target_densitydpi = settings->viewportTargetDensityDpi(); + m_viewport_user_scalable = settings->viewportUserScalable(); + m_format_detection_address = settings->formatDetectionAddress(); + m_format_detection_email = settings->formatDetectionEmail(); + m_format_detection_telephone = settings->formatDetectionTelephone(); +#endif + +} + +#ifdef ANDROID_META_SUPPORT +void CachedFramePlatformDataAndroid::restoreMetadata(WebCore::Settings* settings) +{ + settings->setViewportWidth(m_viewport_width); + settings->setViewportHeight(m_viewport_height); + settings->setViewportInitialScale(m_viewport_initial_scale); + settings->setViewportMinimumScale(m_viewport_minimum_scale); + settings->setViewportMaximumScale(m_viewport_maximum_scale); + settings->setViewportTargetDensityDpi(m_viewport_target_densitydpi); + settings->setViewportUserScalable(m_viewport_user_scalable); + settings->setFormatDetectionAddress(m_format_detection_address); + settings->setFormatDetectionEmail(m_format_detection_email); + settings->setFormatDetectionTelephone(m_format_detection_telephone); +} +#endif + +} diff --git a/WebKit/android/WebCoreSupport/CachedFramePlatformDataAndroid.h b/WebKit/android/WebCoreSupport/CachedFramePlatformDataAndroid.h new file mode 100644 index 0000000..ac22d05 --- /dev/null +++ b/WebKit/android/WebCoreSupport/CachedFramePlatformDataAndroid.h @@ -0,0 +1,63 @@ +/* + * Copyright 2009, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CachedFramePlatformDatatAndroid_h +#define CachedFramePlatformDatatAndroid_h + +#include "CachedFramePlatformData.h" + +namespace WebCore { + class Settings; +} + +namespace android { + +class CachedFramePlatformDataAndroid : public WebCore::CachedFramePlatformData { +public: + CachedFramePlatformDataAndroid(WebCore::Settings* settings); + +#ifdef ANDROID_META_SUPPORT + void restoreMetadata(WebCore::Settings* settings); +#endif + +private: +#ifdef ANDROID_META_SUPPORT + // meta data of the frame + int m_viewport_width; + int m_viewport_height; + int m_viewport_initial_scale; + int m_viewport_minimum_scale; + int m_viewport_maximum_scale; + int m_viewport_target_densitydpi; + bool m_viewport_user_scalable : 1; + bool m_format_detection_address : 1; + bool m_format_detection_email : 1; + bool m_format_detection_telephone : 1; +#endif +}; + +} + +#endif
\ No newline at end of file diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp index 1c17ffe..fa70670 100644 --- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp @@ -13,7 +13,7 @@ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -85,10 +85,19 @@ float ChromeClientAndroid::scaleFactor() return m_webFrame->density(); } +#ifdef ANDROID_USER_GESTURE +void ChromeClientAndroid::focus(bool userGesture) { +#else void ChromeClientAndroid::focus() { + // The old behavior was to always allow javascript to focus a window. If we + // turn off ANDROID_USER_GESTURE, go back to the old behavior by forcing + // userGesture to be true. + bool userGesture = true; +#endif ASSERT(m_webFrame); // Ask the application to focus this WebView. - m_webFrame->requestFocus(); + if (userGesture) + m_webFrame->requestFocus(); } void ChromeClientAndroid::unfocus() { notImplemented(); } @@ -165,7 +174,7 @@ void ChromeClientAndroid::closeWindowSoon() // This will prevent javascript cross-scripting during unload page->setGroupName(String()); // Stop loading but do not send the unload event - mainFrame->loader()->stopLoading(false); + mainFrame->loader()->stopLoading(UnloadEventPolicyNone); // Cancel all pending loaders mainFrame->loader()->stopAllLoaders(); // Remove all event listeners so that no javascript can execute as a result @@ -241,9 +250,7 @@ IntRect ChromeClientAndroid::windowToScreen(const IntRect&) const { return IntRect(); } -// new to change 38068 (Nov 6, 2008) -// in place of view()->containingWindow(), webkit now uses view()->hostWindow()->platformWindow() -PlatformWidget ChromeClientAndroid::platformWindow() const { +PlatformPageClient ChromeClientAndroid::platformPageClient() const { Page* page = m_webFrame->page(); Frame* mainFrame = page->mainFrame(); FrameView* view = mainFrame->view(); @@ -266,6 +273,11 @@ void ChromeClientAndroid::formStateDidChange(const Node*) notImplemented(); } +void ChromeClientAndroid::scrollbarsModeDidChange() const +{ + notImplemented(); +} + void ChromeClientAndroid::mouseDidMoveOverElement(const HitTestResult&, unsigned int) {} void ChromeClientAndroid::setToolTip(const String&, TextDirection) {} void ChromeClientAndroid::print(Frame*) {} @@ -368,7 +380,14 @@ void ChromeClientAndroid::onMainFrameLoadStarted() m_geolocationPermissions->resetTemporaryPermissionStates(); } -void ChromeClientAndroid::runOpenPanel(Frame*, PassRefPtr<FileChooser>) { notImplemented(); } +void ChromeClientAndroid::runOpenPanel(Frame* frame, + PassRefPtr<FileChooser> chooser) +{ + android::WebViewCore* core = android::WebViewCore::getWebViewCore( + frame->view()); + core->openFileChooser(chooser); +} + bool ChromeClientAndroid::setCursor(PlatformCursorHandle) { notImplemented(); diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h index 9976326..3129d1f 100644 --- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h +++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h @@ -13,7 +13,7 @@ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -29,8 +29,8 @@ #include "ChromeClient.h" #include "GeolocationPermissions.h" -#include "Threading.h" #include "Timer.h" +#include <wtf/Threading.h> namespace WebCore { class Geolocation; @@ -53,7 +53,11 @@ namespace android { virtual float scaleFactor(); +#ifdef ANDROID_USER_GESTURE + virtual void focus(bool userGesture); +#else virtual void focus(); +#endif virtual void unfocus(); virtual bool canTakeFocus(FocusDirection); @@ -104,11 +108,12 @@ namespace android { virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); virtual IntPoint screenToWindow(const IntPoint&) const; virtual IntRect windowToScreen(const IntRect&) const; - virtual PlatformWidget platformWindow() const; + virtual PlatformPageClient platformPageClient() const; virtual void contentsSizeChanged(Frame*, const IntSize&) const; virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const; // End methods used by HostWindow. + virtual void scrollbarsModeDidChange() const; virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned int); virtual void setToolTip(const String&, TextDirection); diff --git a/WebKit/android/WebCoreSupport/ContextMenuClientAndroid.cpp b/WebKit/android/WebCoreSupport/ContextMenuClientAndroid.cpp index e6ad0a6..3dc4b00 100644 --- a/WebKit/android/WebCoreSupport/ContextMenuClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/ContextMenuClientAndroid.cpp @@ -13,7 +13,7 @@ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR diff --git a/WebKit/android/WebCoreSupport/ContextMenuClientAndroid.h b/WebKit/android/WebCoreSupport/ContextMenuClientAndroid.h index ab4e445..4563829 100644 --- a/WebKit/android/WebCoreSupport/ContextMenuClientAndroid.h +++ b/WebKit/android/WebCoreSupport/ContextMenuClientAndroid.h @@ -13,7 +13,7 @@ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR diff --git a/WebKit/android/WebCoreSupport/DragClientAndroid.cpp b/WebKit/android/WebCoreSupport/DragClientAndroid.cpp index 64406e7..f64b80c 100644 --- a/WebKit/android/WebCoreSupport/DragClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/DragClientAndroid.cpp @@ -13,7 +13,7 @@ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -22,6 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + #define LOG_TAG "WebCore" #include "config.h" diff --git a/WebKit/android/WebCoreSupport/DragClientAndroid.h b/WebKit/android/WebCoreSupport/DragClientAndroid.h index 5f0548f..020e1f1 100644 --- a/WebKit/android/WebCoreSupport/DragClientAndroid.h +++ b/WebKit/android/WebCoreSupport/DragClientAndroid.h @@ -13,7 +13,7 @@ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR diff --git a/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp b/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp index d2e45ff..c07ea71 100644 --- a/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp @@ -13,7 +13,7 @@ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -22,6 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + #define LOG_TAG "WebCore" #include "config.h" diff --git a/WebKit/android/WebCoreSupport/EditorClientAndroid.h b/WebKit/android/WebCoreSupport/EditorClientAndroid.h index 3569f10..614926a 100644 --- a/WebKit/android/WebCoreSupport/EditorClientAndroid.h +++ b/WebKit/android/WebCoreSupport/EditorClientAndroid.h @@ -13,7 +13,7 @@ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp index c567c66..ae3d582 100644 --- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp @@ -13,7 +13,7 @@ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -22,12 +22,15 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + #define LOG_TAG "WebCore" #include "config.h" #include "android_graphics.h" #include "CString.h" +#include "CachedFrame.h" +#include "CachedFramePlatformDataAndroid.h" #include "DocumentLoader.h" #include "DOMImplementation.h" #include "Frame.h" @@ -343,7 +346,7 @@ void FrameLoaderClientAndroid::dispatchDidFailProvisionalLoad(const ResourceErro // load with the replacement data. // use KURL(const char*) as KURL(const String& url) can trigger ASSERT for // invalidate URL string. - loadDataIntoFrame(m_frame, KURL(data), error.failingURL(), s); + loadDataIntoFrame(m_frame, KURL(ParsedURLString, data), error.failingURL(), s); // Delete the asset. delete a; @@ -432,7 +435,7 @@ void FrameLoaderClientAndroid::dispatchDecidePolicyForMIMEType(FramePolicyFuncti if (!func) return; if (request.isNull()) { - (m_frame->loader()->*func)(PolicyIgnore); + (m_frame->loader()->policyChecker()->*func)(PolicyIgnore); return; } // Default to Use (display internally). @@ -463,7 +466,7 @@ void FrameLoaderClientAndroid::dispatchDecidePolicyForMIMEType(FramePolicyFuncti WebCore::DocumentLoader* docLoader = m_frame->loader()->activeDocumentLoader(); if (docLoader->response().httpStatusCode() == 204) action = PolicyIgnore; - (m_frame->loader()->*func)(action); + (m_frame->loader()->policyChecker()->*func)(action); } void FrameLoaderClientAndroid::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction func, @@ -475,7 +478,7 @@ void FrameLoaderClientAndroid::dispatchDecidePolicyForNewWindowAction(FramePolic return; if (request.isNull()) { - (m_frame->loader()->*func)(PolicyIgnore); + (m_frame->loader()->policyChecker()->*func)(PolicyIgnore); return; } @@ -486,9 +489,9 @@ void FrameLoaderClientAndroid::dispatchDecidePolicyForNewWindowAction(FramePolic // found by the frame tree. Instead of creating a new frame, return the // current frame in dispatchCreatePage. if (canHandleRequest(request)) - (m_frame->loader()->*func)(PolicyUse); + (m_frame->loader()->policyChecker()->*func)(PolicyUse); else - (m_frame->loader()->*func)(PolicyIgnore); + (m_frame->loader()->policyChecker()->*func)(PolicyIgnore); } void FrameLoaderClientAndroid::cancelPolicyCheck() { @@ -507,7 +510,7 @@ void FrameLoaderClientAndroid::dispatchDecidePolicyForNavigationAction(FramePoli if (!func) return; if (request.isNull()) { - (m_frame->loader()->*func)(PolicyIgnore); + (m_frame->loader()->policyChecker()->*func)(PolicyIgnore); return; } @@ -520,14 +523,14 @@ void FrameLoaderClientAndroid::dispatchDecidePolicyForNavigationAction(FramePoli m_webFrame->decidePolicyForFormResubmission(func); return; } else { - (m_frame->loader()->*func)(PolicyUse); + (m_frame->loader()->policyChecker()->*func)(PolicyUse); } } void FrameLoaderClientAndroid::dispatchWillSubmitForm(FramePolicyFunction func, PassRefPtr<FormState>) { ASSERT(m_frame); ASSERT(func); - (m_frame->loader()->*func)(PolicyUse); + (m_frame->loader()->policyChecker()->*func)(PolicyUse); } void FrameLoaderClientAndroid::dispatchDidLoadMainResource(DocumentLoader*) { @@ -619,7 +622,7 @@ void FrameLoaderClientAndroid::updateGlobalHistory() { && docLoader->response().httpStatusCode() < 400) { m_webFrame->updateVisitedHistory(docLoader->urlForHistory(), false); if (!docLoader->serverRedirectSourceForHistory().isNull()) - m_webFrame->updateVisitedHistory(KURL(docLoader->serverRedirectDestinationForHistory()), false); + m_webFrame->updateVisitedHistory(KURL(ParsedURLString, docLoader->serverRedirectDestinationForHistory()), false); } } @@ -635,6 +638,16 @@ bool FrameLoaderClientAndroid::shouldGoToHistoryItem(HistoryItem* item) const { return item != NULL; } +void FrameLoaderClientAndroid::didDisplayInsecureContent() +{ + notImplemented(); +} + +void FrameLoaderClientAndroid::didRunInsecureContent(SecurityOrigin*) +{ + notImplemented(); +} + void FrameLoaderClientAndroid::committedLoad(DocumentLoader* loader, const char* data, int length) { ASSERT(m_frame); String encoding = loader->overrideEncoding(); @@ -724,12 +737,11 @@ void FrameLoaderClientAndroid::frameLoadCompleted() { } void FrameLoaderClientAndroid::saveViewStateToItem(HistoryItem* item) { -#ifdef ANDROID_HISTORY_CLIENT ASSERT(m_frame); ASSERT(item); // We should have added a bridge when the child item was added to its // parent. - WebHistoryItem* bridge = item->bridge(); + AndroidWebHistoryBridge* bridge = item->bridge(); ASSERT(bridge); // store the current scale (only) for the top frame if (!m_frame->tree()->parent()) { @@ -739,41 +751,38 @@ void FrameLoaderClientAndroid::saveViewStateToItem(HistoryItem* item) { } WebCore::notifyHistoryItemChanged(item); -#endif } void FrameLoaderClientAndroid::restoreViewState() { -#ifdef ANDROID_HISTORY_CLIENT WebViewCore* webViewCore = WebViewCore::getWebViewCore(m_frame->view()); - HistoryItem* item = m_frame->loader()->currentHistoryItem(); + HistoryItem* item = m_frame->loader()->history()->currentItem(); + AndroidWebHistoryBridge* bridge = item->bridge(); // restore the scale (only) for the top frame if (!m_frame->tree()->parent()) { - int scale = item->bridge()->scale(); + int scale = bridge->scale(); webViewCore->restoreScale(scale); - int screenWidthScale = item->bridge()->screenWidthScale(); + int screenWidthScale = bridge->screenWidthScale(); if (screenWidthScale != scale) webViewCore->restoreScreenWidthScale(screenWidthScale); } -#endif } -#ifdef ANDROID_HISTORY_CLIENT -void FrameLoaderClientAndroid::dispatchDidAddHistoryItem(HistoryItem* item) const { +void FrameLoaderClientAndroid::dispatchDidAddBackForwardItem(HistoryItem* item) const { ASSERT(m_frame); m_webFrame->addHistoryItem(item); } -void FrameLoaderClientAndroid::dispatchDidRemoveHistoryItem(HistoryItem* item, int index) const { +void FrameLoaderClientAndroid::dispatchDidRemoveBackForwardItem(HistoryItem* item) const { ASSERT(m_frame); - m_webFrame->removeHistoryItem(index); + m_webFrame->removeHistoryItem(0); } -void FrameLoaderClientAndroid::dispatchDidChangeHistoryIndex( - BackForwardList* list) const { +void FrameLoaderClientAndroid::dispatchDidChangeBackForwardIndex() const { ASSERT(m_frame); + BackForwardList* list = m_frame->page()->backForwardList(); + ASSERT(list); m_webFrame->updateHistoryIndex(list->backListCount()); } -#endif void FrameLoaderClientAndroid::provisionalLoadStarted() { ASSERT(m_frame); @@ -806,12 +815,17 @@ String FrameLoaderClientAndroid::userAgent(const KURL& u) { return m_webFrame->userAgentForURL(&u); } -void FrameLoaderClientAndroid::savePlatformDataToCachedFrame(WebCore::CachedFrame*) { - notImplemented(); +void FrameLoaderClientAndroid::savePlatformDataToCachedFrame(WebCore::CachedFrame* cachedFrame) { + CachedFramePlatformDataAndroid* platformData = new CachedFramePlatformDataAndroid(m_frame->settings()); + cachedFrame->setCachedFramePlatformData(platformData); } -void FrameLoaderClientAndroid::transitionToCommittedFromCachedFrame(WebCore::CachedFrame*) { - notImplemented(); +void FrameLoaderClientAndroid::transitionToCommittedFromCachedFrame(WebCore::CachedFrame* cachedFrame) { + CachedFramePlatformDataAndroid* platformData = reinterpret_cast<CachedFramePlatformDataAndroid*>(cachedFrame->cachedFramePlatformData()); +#ifdef ANDROID_META_SUPPORT + platformData->restoreMetadata(m_frame->settings()); +#endif + m_webFrame->transitionToCommitted(m_frame); } void FrameLoaderClientAndroid::transitionToCommittedForNewPage() { @@ -823,32 +837,28 @@ void FrameLoaderClientAndroid::transitionToCommittedForNewPage() { m_frame->settings()->resetMetadataSettings(); #endif - if (m_frame->settings() && !m_frame->settings()->usesPageCache()) { - m_webFrame->transitionToCommitted(m_frame); - return; - } - - // Remember the old WebFrameView - WebFrameView* webFrameView = static_cast<WebFrameView*> ( - m_frame->view()->platformWidget()); - Retain(webFrameView); - - // Remove the old FrameView - m_frame->setView(NULL); - - // Create a new FrameView and associate it with the saved webFrameView - RefPtr<FrameView> view = FrameView::create(m_frame); - webFrameView->setView(view.get()); - - Release(webFrameView); - - // Give the new FrameView to the Frame - m_frame->setView(view); - - if (m_frame->ownerRenderer()) - m_frame->ownerRenderer()->setWidget(view.get()); - - m_frame->view()->initScrollbars(); + // Save the old WebViewCore before creating a new FrameView. There is one + // WebViewCore per page. Each frame, including the main frame and sub frame, + // has a 1:1 FrameView and WebFrameView. + WebViewCore* webViewCore = WebViewCore::getWebViewCore(m_frame->view()); + Retain(webViewCore); + + // Save the old WebFrameView's bounds and apply them to the new WebFrameView + WebFrameView* oldFrameView = static_cast<WebFrameView*> (m_frame->view()->platformWidget()); + IntRect bounds = oldFrameView->getBounds(); + IntRect windowBounds = oldFrameView->getWindowBounds(); + // we only support opaque, white background for now + m_frame->createView(bounds.size(), Color::white, false, IntSize(), false); + // Create a new WebFrameView for the new FrameView + WebFrameView* newFrameView = new WebFrameView(m_frame->view(), webViewCore); + newFrameView->setLocation(bounds.x(), bounds.y()); + newFrameView->setSize(bounds.width(), bounds.height()); + newFrameView->setWindowBounds(windowBounds.x(), windowBounds.y(), windowBounds.width(), windowBounds.height()); + // newFrameView attaches itself to FrameView which Retains the reference, so + // call Release for newFrameView + Release(newFrameView); + // WebFrameView Retains webViewCore, so call Release for webViewCore + Release(webViewCore); m_webFrame->transitionToCommitted(m_frame); } @@ -860,8 +870,7 @@ bool FrameLoaderClientAndroid::canCachePage() const { void FrameLoaderClientAndroid::download(ResourceHandle* handle, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&) { // Get the C++ side of the load listener and tell it to handle the download - WebCoreResourceLoader* loader = handle->getInternal()->m_loader; - loader->downloadFile(); + handle->getInternal()->m_loader->downloadFile(); } WTF::PassRefPtr<WebCore::Frame> FrameLoaderClientAndroid::createFrame(const KURL& url, const String& name, @@ -970,7 +979,7 @@ WTF::PassRefPtr<Widget> FrameLoaderClientAndroid::createPlugin( s = s.replace("VIDEO_ID", videoId); delete a; loadDataIntoFrame(frame.get(), - KURL("file:///android_asset/webkit/"), String(), s); + KURL(ParsedURLString, "file:///android_asset/webkit/"), String(), s); // Transfer ownership to a local refptr. WTF::RefPtr<Widget> widget(frame->view()); return widget.release(); @@ -1088,7 +1097,7 @@ void FrameLoaderClientAndroid::didAddIconForPageUrl(const String& pageUrl) { // may register for icon notifications again since the icon data may have // to be read from disk. registerForIconNotification(false); - KURL u(pageUrl); + KURL u(ParsedURLString, pageUrl); if (equalIgnoringFragmentIdentifier(u, m_frame->loader()->url())) { dispatchDidReceiveIcon(); } diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h index 176c8be..86551f3 100644 --- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h +++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h @@ -13,7 +13,7 @@ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -126,11 +126,13 @@ namespace android { virtual void updateGlobalHistoryRedirectLinks(); virtual bool shouldGoToHistoryItem(HistoryItem*) const; -#ifdef ANDROID_HISTORY_CLIENT - virtual void dispatchDidAddHistoryItem(HistoryItem*) const; - virtual void dispatchDidRemoveHistoryItem(HistoryItem*, int) const; - virtual void dispatchDidChangeHistoryIndex(BackForwardList*) const; -#endif + + virtual void didDisplayInsecureContent(); + virtual void didRunInsecureContent(SecurityOrigin*); + + virtual void dispatchDidAddBackForwardItem(HistoryItem*) const; + virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const; + virtual void dispatchDidChangeBackForwardIndex() const; virtual ResourceError cancelledError(const ResourceRequest&); virtual ResourceError blockedError(const ResourceRequest&); diff --git a/WebKit/android/WebCoreSupport/GeolocationPermissions.cpp b/WebKit/android/WebCoreSupport/GeolocationPermissions.cpp index 62df3c0..aeee017 100755 --- a/WebKit/android/WebCoreSupport/GeolocationPermissions.cpp +++ b/WebKit/android/WebCoreSupport/GeolocationPermissions.cpp @@ -13,7 +13,7 @@ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -42,8 +42,9 @@ namespace android { GeolocationPermissions::PermissionsMap GeolocationPermissions::s_permanentPermissions; GeolocationPermissions::GeolocationPermissionsVector GeolocationPermissions::s_instances; bool GeolocationPermissions::s_alwaysDeny = false; -String GeolocationPermissions::s_databasePath; bool GeolocationPermissions::s_permanentPermissionsLoaded = false; +bool GeolocationPermissions::s_permanentPermissionsModified = false; +String GeolocationPermissions::s_databasePath; static const char* databaseName = "/GeolocationPermissions.db"; @@ -158,6 +159,7 @@ void GeolocationPermissions::recordPermissionState(String origin, bool allow, bo { if (remember) { s_permanentPermissions.set(m_originInProgress, allow); + s_permanentPermissionsModified = true; } else { // It's possible that another tab recorded a permanent permission for // this origin while our request was in progress, but we record it @@ -253,8 +255,10 @@ void GeolocationPermissions::clear(String origin) { maybeLoadPermanentPermissions(); PermissionsMap::iterator iter = s_permanentPermissions.find(origin); - if (iter != s_permanentPermissions.end()) + if (iter != s_permanentPermissions.end()) { s_permanentPermissions.remove(iter); + s_permanentPermissionsModified = true; + } } void GeolocationPermissions::allow(String origin) @@ -262,12 +266,14 @@ void GeolocationPermissions::allow(String origin) maybeLoadPermanentPermissions(); // We replace any existing permanent permission. s_permanentPermissions.set(origin, true); + s_permanentPermissionsModified = true; } void GeolocationPermissions::clearAll() { maybeLoadPermanentPermissions(); s_permanentPermissions.clear(); + s_permanentPermissionsModified = true; } void GeolocationPermissions::maybeLoadPermanentPermissions() @@ -302,11 +308,10 @@ void GeolocationPermissions::maybeLoadPermanentPermissions() void GeolocationPermissions::maybeStorePermanentPermissions() { - // Protect against the case where we haven't yet loaded permissions, as - // saving in this case would overwrite the stored permissions with the empty - // set. This is safe as the permissions are always loaded before they are - // modified. - if (!s_permanentPermissionsLoaded) + // If the permanent permissions haven't been modified, there's no need to + // save them to the DB. (If we haven't even loaded them, writing them now + // would overwrite the stored permissions with the empty set.) + if (!s_permanentPermissionsModified) return; SQLiteDatabase database; @@ -334,6 +339,8 @@ void GeolocationPermissions::maybeStorePermanentPermissions() transaction.commit(); database.close(); + + s_permanentPermissionsModified = false; } void GeolocationPermissions::setDatabasePath(String path) diff --git a/WebKit/android/WebCoreSupport/GeolocationPermissions.h b/WebKit/android/WebCoreSupport/GeolocationPermissions.h index d6b8296..33434b9 100755 --- a/WebKit/android/WebCoreSupport/GeolocationPermissions.h +++ b/WebKit/android/WebCoreSupport/GeolocationPermissions.h @@ -13,7 +13,7 @@ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -30,11 +30,11 @@ // We must include this before before HashMap.h, as it provides specalizations // for String hash types instantiated there. #include "StringHash.h" -#include "HashMap.h" -#include "HashSet.h" #include "Timer.h" -#include "Vector.h" -#include "wtf/RefCounted.h" +#include <wtf/HashMap.h> +#include <wtf/HashSet.h> +#include <wtf/RefCounted.h> +#include <wtf/Vector.h> namespace WebCore { class Frame; @@ -45,7 +45,13 @@ namespace android { class WebViewCore; - // The GeolocationPermissions class manages permissions for the browser. + // The GeolocationPermissions class manages Geolocation permissions for the + // browser. Permissions are managed on a per-origin basis, as required by + // the Geolocation spec - http://dev.w3.org/geo/api/spec-source.html. An + // origin specifies the scheme, host and port of particular frame. An + // origin is represented here as a string, using the output of + // WebCore::SecurityOrigin::toString. + // // Each instance handles permissions for a given main frame. The class // enforces the following policy. // - Non-remembered permissions last for the dureation of the main frame. @@ -69,8 +75,10 @@ namespace android { // the same origin as the requesting frame. void queryPermissionState(WebCore::Frame* frame); - // Provides this object the given permission state from the user. The - // new permission state is recorded and will trigger callbacks to + // Provides this object with a permission state set by the user. The + // permission is specified by 'allow' and applied to 'origin'. If + // 'remember' is set, the permission state is remembered permanently. + // The new permission state is recorded and will trigger callbacks to // geolocation objects as described above. If any other permission // requests are queued, the next is started. void providePermissionState(WebCore::String origin, bool allow, bool remember); @@ -82,12 +90,21 @@ namespace android { // Static methods for use from Java. These are used to interact with the // browser settings menu and to update the permanent permissions when // system settings are changed. + // Gets the list of all origins for which permanent permissions are + // recorded. typedef HashSet<WebCore::String> OriginSet; static OriginSet getOrigins(); + // Gets whether the specified origin is allowed. static bool getAllowed(WebCore::String origin); + // Clears the permission state for the specified origin. static void clear(WebCore::String origin); + // Sets the permission state for the specified origin to allowed. static void allow(WebCore::String origin); + // Clears the permission state for all origins. static void clearAll(); + // Sets whether the GeolocationPermissions object should always deny + // permission requests, irrespective of previously recorded permission + // states. static void setAlwaysDeny(bool deny); static void setDatabasePath(WebCore::String path); @@ -96,7 +113,8 @@ namespace android { static void maybeStorePermanentPermissions(); private: - // Records the permission state for the specified origin. + // Records the permission state for the specified origin and whether + // this should be remembered. void recordPermissionState(WebCore::String origin, bool allow, bool remember); // Used to make an asynchronous callback to the Geolocation objects. @@ -141,6 +159,7 @@ namespace android { static bool s_alwaysDeny; static bool s_permanentPermissionsLoaded; + static bool s_permanentPermissionsModified; static WebCore::String s_databasePath; }; diff --git a/WebKit/android/WebCoreSupport/InspectorClientAndroid.h b/WebKit/android/WebCoreSupport/InspectorClientAndroid.h index 54d15cb..c8d2fcd 100644 --- a/WebKit/android/WebCoreSupport/InspectorClientAndroid.h +++ b/WebKit/android/WebCoreSupport/InspectorClientAndroid.h @@ -13,7 +13,7 @@ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR diff --git a/WebKit/android/WebCoreSupport/KeyGeneratorClient.h b/WebKit/android/WebCoreSupport/KeyGeneratorClient.h new file mode 100644 index 0000000..1bcd8e8 --- /dev/null +++ b/WebKit/android/WebCoreSupport/KeyGeneratorClient.h @@ -0,0 +1,46 @@ +/* + * Copyright 2009, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef KEY_GENERATOR_CLIENT_H +#define KEY_GENERATOR_CLIENT_H + +#include "KURL.h" +#include "PlatformString.h" + +#include <wtf/Vector.h> + +using namespace WebCore; + +namespace android { + +class KeyGeneratorClient { +public: + virtual ~KeyGeneratorClient() { } + virtual WTF::Vector<String> getSupportedKeyStrengthList() = 0; + virtual String getSignedPublicKeyAndChallengeString(unsigned index, + const String& challenge, const KURL& url) = 0; + }; +} +#endif diff --git a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp index 5ca6e83..00e973e 100644 --- a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp +++ b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp @@ -13,7 +13,7 @@ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -30,6 +30,7 @@ #include "GraphicsContext.h" #include "MediaPlayerPrivateAndroid.h" #include "SkiaUtils.h" +#include "TimeRanges.h" #include "WebCoreJni.h" #include "WebViewCore.h" #include "jni_utility.h" @@ -112,6 +113,12 @@ IntSize MediaPlayerPrivate::naturalSize() const return m_naturalSize; } +bool MediaPlayerPrivate::hasAudio() const +{ + // TODO + return false; +} + bool MediaPlayerPrivate::hasVideo() const { return false; @@ -182,9 +189,9 @@ float MediaPlayerPrivate::maxTimeSeekable() const return 0; } -float MediaPlayerPrivate::maxTimeBuffered() const +PassRefPtr<TimeRanges> MediaPlayerPrivate::buffered() const { - return 0; + return TimeRanges::create(); } int MediaPlayerPrivate::dataRate() const @@ -350,6 +357,8 @@ void MediaPlayerPrivate::onPrepared(int duration, int width, int height) { } void MediaPlayerPrivate::onEnded() { + m_currentTime = duration(); + m_player->timeChanged(); m_paused = true; m_currentTime = 0; m_networkState = MediaPlayer::Idle; diff --git a/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/WebKit/android/WebCoreSupport/PlatformBridge.cpp new file mode 100644 index 0000000..e4fe4ce --- /dev/null +++ b/WebKit/android/WebCoreSupport/PlatformBridge.cpp @@ -0,0 +1,54 @@ +/* + * Copyright 2009, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "PlatformBridge.h" + +#include "JavaSharedClient.h" +#include "KeyGeneratorClient.h" + +using namespace android; + +namespace WebCore { + +WTF::Vector<String> PlatformBridge::getSupportedKeyStrengthList() +{ + KeyGeneratorClient* client = JavaSharedClient::GetKeyGeneratorClient(); + if (!client) + return Vector<String>(); + + return client->getSupportedKeyStrengthList(); +} + +String PlatformBridge::getSignedPublicKeyAndChallengeString(unsigned index, const String& challenge, const KURL& url) +{ + KeyGeneratorClient* client = JavaSharedClient::GetKeyGeneratorClient(); + if (!client) + return String(); + + return client->getSignedPublicKeyAndChallengeString(index, challenge, url); +} + +}
\ No newline at end of file diff --git a/WebKit/android/WebCoreSupport/ResourceLoaderAndroid.cpp b/WebKit/android/WebCoreSupport/ResourceLoaderAndroid.cpp new file mode 100644 index 0000000..2b2ad95 --- /dev/null +++ b/WebKit/android/WebCoreSupport/ResourceLoaderAndroid.cpp @@ -0,0 +1,50 @@ +/* + * Copyright 2009, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <config.h> + +#include <ResourceLoaderAndroid.h> + +#include "FrameLoaderClientAndroid.h" +#include "WebCoreFrameBridge.h" +#include "WebCoreResourceLoader.h" + +using namespace android; + +namespace WebCore { + +PassRefPtr<ResourceLoaderAndroid> ResourceLoaderAndroid::start( + ResourceHandle* handle, const ResourceRequest& request, FrameLoaderClient* client, bool isMainResource, bool isSync) +{ + FrameLoaderClientAndroid* clientAndroid = static_cast<FrameLoaderClientAndroid*> (client); + return clientAndroid->webFrame()->startLoadingResource(handle, request, isMainResource, isSync); +} + +bool ResourceLoaderAndroid::willLoadFromCache(const WebCore::KURL& url, int64_t identifier) +{ + return WebCoreResourceLoader::willLoadFromCache(url, identifier); +} + +} |
