summaryrefslogtreecommitdiffstats
path: root/WebKit/android/WebCoreSupport
diff options
context:
space:
mode:
authorPatrick Scott <phanna@android.com>2010-04-02 09:43:08 -0400
committerPatrick Scott <phanna@android.com>2010-04-02 09:43:08 -0400
commit9dbbb4da177ba7592aaf8d18fbd85a9525bbb5f7 (patch)
tree1f9fd47ce61dbbb0f553838c3556d7c092460562 /WebKit/android/WebCoreSupport
parent4535cd9bbf6839dfeab97e7d826d401b523fedec (diff)
downloadexternal_webkit-9dbbb4da177ba7592aaf8d18fbd85a9525bbb5f7.zip
external_webkit-9dbbb4da177ba7592aaf8d18fbd85a9525bbb5f7.tar.gz
external_webkit-9dbbb4da177ba7592aaf8d18fbd85a9525bbb5f7.tar.bz2
On demand plugins are now per-page, not per-object.
Traverse the frame tree and enable all plugins currently on the page. Remember the setting for any future plugins that are created. Reset the setting in makeRepresentation as that seems to be called for all new documents. Bug: 2564543 Change-Id: I558f068992719ee0236ba40f76b918b10cfe0ed9
Diffstat (limited to 'WebKit/android/WebCoreSupport')
-rw-r--r--WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp34
-rw-r--r--WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h3
2 files changed, 33 insertions, 4 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,