diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebKit2/PluginProcess/PluginControllerProxy.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebKit2/PluginProcess/PluginControllerProxy.cpp')
-rw-r--r-- | Source/WebKit2/PluginProcess/PluginControllerProxy.cpp | 113 |
1 files changed, 76 insertions, 37 deletions
diff --git a/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp b/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp index 467b3952a..da9db224e 100644 --- a/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp +++ b/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp @@ -41,12 +41,13 @@ #include "WebCoreArgumentCoders.h" #include "WebProcessConnection.h" #include <WebCore/GraphicsContext.h> +#include <WebCore/HTTPHeaderMap.h> #include <WebCore/IdentifierRep.h> #include <WebCore/NotImplemented.h> -#include <wtf/TemporaryChange.h> +#include <wtf/SetForScope.h> #include <wtf/text/WTFString.h> -#if PLATFORM(MAC) +#if PLATFORM(COCOA) #include "LayerHostingContext.h" #endif @@ -59,21 +60,23 @@ PluginControllerProxy::PluginControllerProxy(WebProcessConnection* connection, c , m_pluginInstanceID(creationParameters.pluginInstanceID) , m_userAgent(creationParameters.userAgent) , m_isPrivateBrowsingEnabled(creationParameters.isPrivateBrowsingEnabled) -#if USE(ACCELERATED_COMPOSITING) + , m_isMuted(creationParameters.isMuted) , m_isAcceleratedCompositingEnabled(creationParameters.isAcceleratedCompositingEnabled) -#endif , m_isInitializing(false) + , m_isVisible(false) + , m_isWindowVisible(false) , m_paintTimer(RunLoop::main(), this, &PluginControllerProxy::paint) , m_pluginDestructionProtectCount(0) , m_pluginDestroyTimer(RunLoop::main(), this, &PluginControllerProxy::destroy) , m_waitingForDidUpdate(false) , m_pluginCanceledManualStreamLoad(false) -#if PLATFORM(MAC) +#if PLATFORM(COCOA) , m_isComplexTextInputEnabled(false) #endif , m_contentsScaleFactor(creationParameters.contentsScaleFactor) , m_windowNPObject(0) , m_pluginElementNPObject(0) + , m_visiblityActivity("Plugin is visible.") { } @@ -94,9 +97,9 @@ void PluginControllerProxy::setInitializationReply(PassRefPtr<Messages::WebProce m_initializationReply = reply; } -PassRefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply> PluginControllerProxy::takeInitializationReply() +RefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply> PluginControllerProxy::takeInitializationReply() { - return m_initializationReply.release(); + return m_initializationReply; } bool PluginControllerProxy::initialize(const PluginCreationParameters& creationParameters) @@ -104,9 +107,9 @@ bool PluginControllerProxy::initialize(const PluginCreationParameters& creationP ASSERT(!m_plugin); ASSERT(!m_isInitializing); - m_isInitializing = true; // Cannot use TemporaryChange here, because this object can be deleted before the function returns. + m_isInitializing = true; // Cannot use SetForScope here, because this object can be deleted before the function returns. - m_plugin = NetscapePlugin::create(PluginProcess::shared().netscapePluginModule()); + m_plugin = NetscapePlugin::create(PluginProcess::singleton().netscapePluginModule()); if (!m_plugin) { // This will delete the plug-in controller proxy object. m_connection->removePluginControllerProxy(this, 0); @@ -123,7 +126,7 @@ bool PluginControllerProxy::initialize(const PluginCreationParameters& creationP // used as an identifier so it's OK to just get a weak reference. Plugin* plugin = m_plugin.get(); - m_plugin = 0; + m_plugin = nullptr; // This will delete the plug-in controller proxy object. m_connection->removePluginControllerProxy(this, plugin); @@ -153,7 +156,7 @@ void PluginControllerProxy::destroy() Plugin* plugin = m_plugin.get(); m_plugin->destroyPlugin(); - m_plugin = 0; + m_plugin = nullptr; platformDestroy(); @@ -182,16 +185,16 @@ void PluginControllerProxy::paint() // Create a graphics context. auto graphicsContext = m_backingStore->createGraphicsContext(); -#if PLATFORM(MAC) +#if PLATFORM(COCOA) // FIXME: We should really call applyDeviceScaleFactor instead of scale, but that ends up calling into WKSI // which we currently don't have initiated in the plug-in process. - graphicsContext->scale(FloatSize(m_contentsScaleFactor, m_contentsScaleFactor)); + graphicsContext->scale(m_contentsScaleFactor); #endif if (m_plugin->isTransparent()) graphicsContext->clearRect(dirtyRect); - m_plugin->paint(graphicsContext.get(), dirtyRect); + m_plugin->paint(*graphicsContext, dirtyRect); m_connection->connection()->send(Messages::PluginProxy::Update(dirtyRect), m_pluginInstanceID); } @@ -217,13 +220,6 @@ void PluginControllerProxy::startPaintTimer() m_waitingForDidUpdate = true; } -bool PluginControllerProxy::isPluginVisible() -{ - // FIXME: Implement this. - notImplemented(); - return false; -} - void PluginControllerProxy::invalidate(const IntRect& rect) { IntRect dirtyRect = rect; @@ -245,6 +241,11 @@ void PluginControllerProxy::loadURL(uint64_t requestID, const String& method, co m_connection->connection()->send(Messages::PluginProxy::LoadURL(requestID, method, urlString, target, headerFields, httpBody, allowPopups), m_pluginInstanceID); } +void PluginControllerProxy::continueStreamLoad(uint64_t streamID) +{ + m_connection->connection()->send(Messages::PluginProxy::ContinueStreamLoad(streamID), m_pluginInstanceID); +} + void PluginControllerProxy::cancelStreamLoad(uint64_t streamID) { m_connection->connection()->send(Messages::PluginProxy::CancelStreamLoad(streamID), m_pluginInstanceID); @@ -308,6 +309,11 @@ bool PluginControllerProxy::evaluate(NPObject* npObject, const String& scriptStr return true; } +void PluginControllerProxy::setPluginIsPlayingAudio(bool pluginIsPlayingAudio) +{ + m_connection->connection()->send(Messages::PluginProxy::SetPluginIsPlayingAudio(pluginIsPlayingAudio), m_pluginInstanceID); +} + void PluginControllerProxy::setStatusbarText(const String& statusbarText) { m_connection->connection()->send(Messages::PluginProxy::SetStatusbarText(statusbarText), m_pluginInstanceID); @@ -324,12 +330,6 @@ void PluginControllerProxy::pluginProcessCrashed() ASSERT_NOT_REACHED(); } -void PluginControllerProxy::willSendEventToPlugin() -{ - // This is only used when running plugins in the web process. - ASSERT_NOT_REACHED(); -} - void PluginControllerProxy::didInitializePlugin() { // This should only be called on the plugin in the web process. @@ -431,8 +431,36 @@ void PluginControllerProxy::geometryDidChange(const IntSize& pluginSize, const I void PluginControllerProxy::visibilityDidChange(bool isVisible) { + m_isVisible = isVisible; + ASSERT(m_plugin); m_plugin->visibilityDidChange(isVisible); + + updateVisibilityActivity(); +} + +void PluginControllerProxy::windowFocusChanged(bool hasFocus) +{ + ASSERT(m_plugin); + m_plugin->windowFocusChanged(hasFocus); +} + +void PluginControllerProxy::windowVisibilityChanged(bool isVisible) +{ + m_isWindowVisible = isVisible; + + ASSERT(m_plugin); + m_plugin->windowVisibilityChanged(isVisible); + + updateVisibilityActivity(); +} + +void PluginControllerProxy::updateVisibilityActivity() +{ + if (m_isVisible && m_isWindowVisible) + m_visiblityActivity.start(); + else + m_visiblityActivity.stop(); } void PluginControllerProxy::didEvaluateJavaScript(uint64_t requestID, const String& result) @@ -440,6 +468,11 @@ void PluginControllerProxy::didEvaluateJavaScript(uint64_t requestID, const Stri m_plugin->didEvaluateJavaScript(requestID, result); } +void PluginControllerProxy::streamWillSendRequest(uint64_t streamID, const String& requestURLString, const String& redirectResponseURLString, uint32_t redirectResponseStatusCode) +{ + m_plugin->streamWillSendRequest(streamID, URL(ParsedURLString, requestURLString), URL(ParsedURLString, redirectResponseURLString), redirectResponseStatusCode); +} + void PluginControllerProxy::streamDidReceiveResponse(uint64_t streamID, const String& responseURLString, uint32_t streamLength, uint32_t lastModifiedTime, const String& mimeType, const String& headers) { m_plugin->streamDidReceiveResponse(streamID, URL(ParsedURLString, responseURLString), streamLength, lastModifiedTime, mimeType, headers, String()); @@ -491,17 +524,9 @@ void PluginControllerProxy::manualStreamDidFail(bool wasCancelled) m_plugin->manualStreamDidFail(wasCancelled); } - -void PluginControllerProxy::handleMouseEvent(const WebMouseEvent& mouseEvent, PassRefPtr<Messages::PluginControllerProxy::HandleMouseEvent::DelayedReply> reply) -{ - // Always let the web process think that we've handled this mouse event, even before passing it along to the plug-in. - // This is a workaround for - // <rdar://problem/9299901> UI process thinks the page is unresponsive when a plug-in is showing a context menu. - // The web process sends a synchronous HandleMouseEvent message and the plug-in process spawns a nested - // run loop when showing the context menu, so eventually the unresponsiveness timer kicks in in the UI process. - // FIXME: We should come up with a better way to do this. - reply->send(true); +void PluginControllerProxy::handleMouseEvent(const WebMouseEvent& mouseEvent) +{ m_plugin->handleMouseEvent(mouseEvent); } @@ -540,6 +565,11 @@ void PluginControllerProxy::handlesPageScaleFactor(bool& isHandled) isHandled = m_plugin->handlesPageScaleFactor(); } +void PluginControllerProxy::requiresUnifiedScaleFactor(bool& required) +{ + required = m_plugin->requiresUnifiedScaleFactor(); +} + void PluginControllerProxy::paintEntirePlugin() { if (m_pluginSize.isEmpty()) @@ -602,6 +632,15 @@ void PluginControllerProxy::privateBrowsingStateChanged(bool isPrivateBrowsingEn m_plugin->privateBrowsingStateChanged(isPrivateBrowsingEnabled); } +void PluginControllerProxy::mutedStateChanged(bool isMuted) +{ + if (m_isMuted == isMuted) + return; + + m_isMuted = isMuted; + m_plugin->mutedStateChanged(isMuted); +} + void PluginControllerProxy::getFormValue(bool& returnValue, String& formValue) { returnValue = m_plugin->getFormValue(formValue); |