forked from WebKit/WebKit-http
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keep track of plug-in snapshots clicked by user
https://bugs.webkit.org/show_bug.cgi?id=103206 <rdar://problem/12746483> Reviewed by Anders Carlsson. Source/WebCore: * html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement): Initially the hash is unknown. Set to 0. Move the check for whether to snapshot the plugin into the new function subframeLoaderWillLoadPlugIn. (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): Rename setPendingClickEvent to userDidClickSnapshot. In addition to holding onto the click event used to activate the plug-in, the function now also tells the plug-in client to add the origin hash as an auto-start origin. (WebCore::HTMLPlugInImageElement::subframeLoaderWillLoadPlugIn): Calculate the hash based on the provided URL, which is the URL the plug-in will load. Extend the check that used to be in the constructor to see if the plug-in should not automatically load, including checking the plug-in size and whether the hash is an auto-start origin. * html/HTMLPlugInImageElement.h: Rename setPendingClickEvent to userDidClickSnapshot and add a variable for the origin hash. * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::requestPlugin): When the loader is about to load the plug-in, pass the URL to the element, so that it can calculate the hash. * page/Page.cpp: (WebCore::Page::Page): Take the plugInClient from the page clients. (WebCore::Page::~Page): If the client exists, tell it that the page is being destroyed. (WebCore::Page::PageClients::PageClients): Initialize this optional client to null. * page/Page.h: Add PlugInClient to page clients. (PageClients): Add PlugInClient variable. (WebCore::Page::plugInClient): * page/PlugInClient.h: Added. * rendering/RenderSnapshottedPlugIn.cpp: (WebCore::RenderSnapshottedPlugIn::handleEvent): Call the renamed function userDidClickSnapshot(). (WebCore::RenderSnapshottedPlugIn::layout): Move the check of the plug-in size to subframeLoaderWillLoadPlugIn. Add PlugInClient.h. * GNUmakefile.list.am: * Target.pri: * WebCore.vcproj/WebCore.vcproj: * WebCore.xcodeproj/project.pbxproj: Source/WebKit2: Create a new provider class for the web context that maintains a mapping of the plug-in origins allowed to auto-start for a specific page origin. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): Create and set WebPlugInClient. Implement WebCore::PlugInClient. * WebProcess/WebCoreSupport/WebPlugInClient.cpp: Added. (WebKit::WebPlugInClient::WebPlugInClient): (WebKit::WebPlugInClient::~WebPlugInClient): (WebKit::WebPlugInClient::pageDestroyed): (WebKit::WebPlugInClient::isAutoStartOrigin): Forward to WebProcess. (WebKit::WebPlugInClient::addAutoStartOrigin): Forward to WebProcess. * WebProcess/WebCoreSupport/WebPlugInClient.h: Added. * WebProcess/WebProcess.cpp: Maintains a copy of the hash set. (WebKit::WebProcess::isPlugInAutoStartOrigin): Look for the hash in the set. (WebKit::WebProcess::addPlugInAutoStartOrigin): Tell the UI process to add the hash for the page. (WebKit::WebProcess::didAddPlugInAutoStartOrigin): Add the hash to the cached set. * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: Add DidAddPlugInAutoStartOrigin. Add the auto-start provider. * UIProcess/WebContext.cpp: (WebKit::WebContext::WebContext): Initialize the provider. (WebKit::WebContext::addPlugInAutoStartOriginHash): Forward to the provider. * UIProcess/WebContext.h: * UIProcess/WebContext.messages.in: Add AddPlugInAutoStartOriginHash. The provider class maintains a map of page domains to hashes, and a set of all the hashes. The latter will be used to initialize new web processes without having to crawl through the whole map. * UIProcess/Plugins/PlugInAutoStartProvider.cpp: Added. (WebKit::PlugInAutoStartProvider::PlugInAutoStartProvider): (WebKit::PlugInAutoStartProvider::addAutoStartOrigin): Add the origin to the map and set. Tell all processes to add the origin to their local copies. * UIProcess/Plugins/PlugInAutoStartProvider.h: Added. Add PlugInAutoStartProvider and WebPlugInClient. * CMakeLists.txt: * GNUmakefile.list.am: * Target.pri: * WebKit2.xcodeproj/project.pbxproj: * win/WebKit2.vcproj: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@137230 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
30 changed files
with
531 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (C) 2012 Apple Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. 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 APPLE INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 PlugInClient_h | ||
#define PlugInClient_h | ||
|
||
#include <wtf/Forward.h> | ||
|
||
namespace WebCore { | ||
|
||
class PlugInClient { | ||
public: | ||
virtual void pageDestroyed() = 0; | ||
virtual bool isAutoStartOrigin(unsigned plugInOriginHash) = 0; | ||
virtual void addAutoStartOrigin(const String& pageOrigin, unsigned plugInOriginHash) = 0; | ||
|
||
protected: | ||
virtual ~PlugInClient() { } | ||
}; | ||
|
||
} | ||
#endif // PlugInClient_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.