summaryrefslogtreecommitdiffstats
path: root/WebKit/android
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android')
-rw-r--r--WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp34
-rw-r--r--WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h3
-rw-r--r--WebKit/android/jni/WebCoreResourceLoader.cpp16
-rw-r--r--WebKit/android/nav/FindCanvas.cpp2
4 files changed, 44 insertions, 11 deletions
diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
index 424617b..9112afe 100644
--- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
@@ -56,6 +56,8 @@
#include "PluginWidget.h"
#include "ProgressTracker.h"
#include "RenderPart.h"
+#include "RenderView.h"
+#include "RenderWidget.h"
#include "ResourceError.h"
#include "ResourceHandle.h"
#include "ResourceHandleInternal.h"
@@ -84,7 +86,8 @@ FrameLoaderClientAndroid::FrameLoaderClientAndroid(WebFrame* webframe)
: m_frame(NULL)
, m_webFrame(webframe)
, m_manualLoader(NULL)
- , m_hasSentResponseToPlugin(false) {
+ , m_hasSentResponseToPlugin(false)
+ , m_onDemandPluginsEnabled(false) {
Retain(m_webFrame);
}
@@ -108,6 +111,7 @@ bool FrameLoaderClientAndroid::hasWebView() const {
}
void FrameLoaderClientAndroid::makeRepresentation(DocumentLoader*) {
+ m_onDemandPluginsEnabled = false;
// don't use representation
verifiedOk();
}
@@ -1071,6 +1075,29 @@ public:
if (event->type() != eventNames().clickEvent)
return;
+ Frame* frame = m_parent->page()->mainFrame();
+ while (frame) {
+ RenderView* view = frame->contentRenderer();
+ const HashSet<RenderWidget*> widgets = view->widgets();
+ HashSet<RenderWidget*>::const_iterator it = widgets.begin();
+ HashSet<RenderWidget*>::const_iterator end = widgets.end();
+ for (; it != end; ++it) {
+ Widget* widget = (*it)->widget();
+ // PluginWidget is used only with PluginToggleWidget
+ if (widget->isPluginWidget()) {
+ PluginToggleWidget* ptw =
+ static_cast<PluginToggleWidget*>(widget);
+ ptw->swapPlugin(*it);
+ }
+ }
+ frame = frame->tree()->traverseNext();
+ }
+ }
+
+ void swapPlugin(RenderWidget* renderer) {
+ typedef FrameLoaderClientAndroid FLCA;
+ FLCA* client = static_cast<FLCA*>(m_parent->loader()->client());
+ client->enableOnDemandPlugins();
WTF::PassRefPtr<PluginView> prpWidget =
PluginView::create(m_parent.get(),
m_size,
@@ -1081,8 +1108,6 @@ public:
m_mimeType,
m_loadManually);
RefPtr<Widget> myProtector(this);
- RenderWidget* renderer =
- static_cast<RenderWidget*>(m_element->renderer());
prpWidget->focusPluginElement();
renderer->setWidget(prpWidget);
}
@@ -1121,7 +1146,8 @@ WTF::PassRefPtr<Widget> FrameLoaderClientAndroid::createPlugin(
Settings* settings = m_frame->settings();
// Do the placeholder if plugins are on-demand and there is a plugin for the
// given mime type.
- if (settings && settings->arePluginsOnDemand() && plugin) {
+ if (settings && settings->arePluginsOnDemand() && plugin &&
+ !m_onDemandPluginsEnabled) {
return adoptRef(new PluginToggleWidget(m_frame, size, element, url,
names, values, mimeType, loadManually));
}
diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h
index 2fb552c..3b754b8 100644
--- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h
+++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h
@@ -208,12 +208,15 @@ namespace android {
// FIXME: this doesn't really go here, but it's better than Frame
CacheBuilder& getCacheBuilder() { return m_cacheBuilder; }
+
+ void enableOnDemandPlugins() { m_onDemandPluginsEnabled = true; }
private:
CacheBuilder m_cacheBuilder;
Frame* m_frame;
WebFrame* m_webFrame;
PluginManualLoader* m_manualLoader;
bool m_hasSentResponseToPlugin;
+ bool m_onDemandPluginsEnabled;
enum ResourceErrors {
InternalErrorCancelled = -99,
diff --git a/WebKit/android/jni/WebCoreResourceLoader.cpp b/WebKit/android/jni/WebCoreResourceLoader.cpp
index cf32c09..297ecb0 100644
--- a/WebKit/android/jni/WebCoreResourceLoader.cpp
+++ b/WebKit/android/jni/WebCoreResourceLoader.cpp
@@ -253,6 +253,16 @@ jstring WebCoreResourceLoader::RedirectedToUrl(JNIEnv* env, jobject obj,
WebCore::ResourceRequest r = handle->request();
WebCore::KURL url(WebCore::KURL(WebCore::ParsedURLString, to_string(env, baseUrl)),
to_string(env, redirectTo));
+ WebCore::ResourceResponse* response = (WebCore::ResourceResponse*)nativeResponse;
+ // If the url fails to resolve the relative path, return null.
+ if (url.protocol().isEmpty()) {
+ delete response;
+ return NULL;
+ } else {
+ // Ensure the protocol is lowercase.
+ url.setProtocol(url.protocol().lower());
+ }
+ // Set the url after updating the protocol.
r.setURL(url);
if (r.httpMethod() == "POST") {
r.setHTTPMethod("GET");
@@ -260,12 +270,6 @@ jstring WebCoreResourceLoader::RedirectedToUrl(JNIEnv* env, jobject obj,
r.setHTTPBody(0);
r.setHTTPContentType("");
}
- WebCore::ResourceResponse* response = (WebCore::ResourceResponse*)nativeResponse;
- // If the url fails to resolve the relative path, return null.
- if (url.protocol().isEmpty()) {
- delete response;
- return NULL;
- }
handle->client()->willSendRequest(handle, r, *response);
delete response;
WebCore::String s = url.string();
diff --git a/WebKit/android/nav/FindCanvas.cpp b/WebKit/android/nav/FindCanvas.cpp
index 1d84822..d8e908b 100644
--- a/WebKit/android/nav/FindCanvas.cpp
+++ b/WebKit/android/nav/FindCanvas.cpp
@@ -631,7 +631,7 @@ void FindOnPage::drawMatch(const SkRegion& region, SkCanvas* canvas,
void FindOnPage::findNext(bool forward)
{
- if (!m_matches || !m_matches->size())
+ if (!m_matches || !m_matches->size() || !m_hasCurrentLocation)
return;
if (forward) {
m_findIndex++;