Source/WebCore:
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Apr 2016 22:28:33 +0000 (22:28 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Apr 2016 22:28:33 +0000 (22:28 +0000)
commit5fc00a07938fdd27a777488b7eadb987acd9967e
tree3139abcabd479b75ba3e457c11db04cb640843af
parent07e04d67ead3d457ce95ae58c22beafb2fb06d8e
Source/WebCore:
Declare a virtual function in PluginStrategy to be implemented by subclasses.
https://bugs.webkit.org/show_bug.cgi?id=156540

Patch by Tina Liu <iting_liu@apple.com> on 2016-04-18
Reviewed by Anders Carlsson.

* plugins/PluginStrategy.h:

Source/WebKit/mac:
Overrode a virtual function of WebCore::PluginStrategy
https://bugs.webkit.org/show_bug.cgi?id=156540

Patch by Tina Liu <iting_liu@apple.com> on 2016-04-18
Reviewed by Anders Carlsson.

* WebCoreSupport/WebPlatformStrategies.h:
* WebCoreSupport/WebPlatformStrategies.mm:
(WebPlatformStrategies::setPrivateBrowsingPluginLoadClientPolicy):

Source/WebKit2:
Implement functions to set plug-in load policies for private browsing mode
https://bugs.webkit.org/show_bug.cgi?id=156540

Patch by Tina Liu <iting_liu@apple.com> on 2016-04-18
Reviewed by Anders Carlsson.

This patch implements API and wrappers for clients to set policies to use when using
private browsing. WebPlatformStrategies would return which policies to use depending
on whether the page is in private browsing mode.

* Shared/WebProcessCreationParameters.h:
Add a hash map for plug-in load policies for private browsing.
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):

* UIProcess/API/C/mac/WKContextPrivateMac.h:
* UIProcess/API/C/mac/WKContextPrivateMac.mm:
(WKContextSetPrivateBrowsingPluginLoadClientPolicy):
Add a wrapper.

* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::createNewWebProcess):
Set the WebProcessCreationParameters's pluginLoadClientPoliciesForPrivateBrowsing.
(WebKit::WebProcessPool::setPluginLoadClientPolicyForBrowsingMode):
A helper function that sets plug-in policies to the corresponding instance variable:
m_pluginLoadClientPolicies for general browsing and m_pluginLoadClientPoliciesForPrivateBrowsing
for private browsing. The logic is extracted from the original setPluginLoadClientPolicy.
While we are here, get rid of the .contains() lookup as .get() will just return a
constructed object if the key is not found.
(WebKit::WebProcessPool::setPluginLoadClientPolicy):
Switch to use the helper function to set policies.
(WebKit::WebProcessPool::setPrivateBrowsingPluginLoadClientPolicy):
Ditto. Also send a message to the WebProcess for setting policies for private browsing.
(WebKit::WebProcessPool::clearPluginClientPolicies):
Clear plug-ins' private browsing policies.

* WebProcess/WebCoreSupport/WebPlatformStrategies.h:
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::setPluginLoadClientPolicyForBrowsingMode):
Ditto as WebProcessPool::setPluginLoadClientPolicyForBrowsingMode.
(WebKit::WebPlatformStrategies::setPluginLoadClientPolicy):
Switch to use setPluginLoadClientPolicyForBrowsingMode to set policies.
(WebKit::WebPlatformStrategies::setPrivateBrowsingPluginLoadClientPolicy):
Use setPluginLoadClientPolicyForBrowsingMode to set policies for private browsing.
(WebKit::WebPlatformStrategies::clearPluginClientPolicies):
Clear plug-ins' private browsing policies.
(WebKit::WebPlatformStrategies::longestMatchedWildcardHostForHost):
Add an argument for private browsing. Read from the corresponding ivar.
(WebKit::WebPlatformStrategies::replaceHostWithMatchedWildcardHost):
Ditto.
(WebKit::WebPlatformStrategies::pluginLoadClientPolicyForHost): Deleted.
Renamed this function as pluginLoadClientPolicyForHostForBrowsingMode.
(WebKit::WebPlatformStrategies::pluginLoadClientPolicyForHostForBrowsingMode):
Ditto.
(WebKit::WebPlatformStrategies::populatePluginCache):
Get the plug-in load policies for a specific host based on the page's session status. If the page
is using ephemeral session, use the private browsing policies.

* WebProcess/WebProcess.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
Switch to call the helper function setPluginLoadClientPolicyFromCreationParameters.
(WebKit::WebProcess::setPluginLoadClientPolicies):
Logic moved from initializeWebProcess. Call PluginStrategy::setPluginLoadClientPolicy or
PluginStrategy::setPrivateBrowsingPluginLoadClientPolicy depending on the input argument.
(WebKit::WebProcess::setPrivateBrowsingPluginLoadClientPolicy):
Add a wrapper to call PluginStrategy::setPrivateBrowsingPluginLoadClientPolicy.

* WebProcess/WebProcess.messages.in:
Declare an entry for setPrivateBrowsingPluginLoadClientPolicy.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199691 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/plugins/PluginStrategy.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h
Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebProcessCreationParameters.cpp
Source/WebKit2/Shared/WebProcessCreationParameters.h
Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.h
Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.mm
Source/WebKit2/UIProcess/WebProcessPool.cpp
Source/WebKit2/UIProcess/WebProcessPool.h
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/WebProcess/WebProcess.h
Source/WebKit2/WebProcess/WebProcess.messages.in