Commit d4ffb762 authored by weinig@apple.com's avatar weinig@apple.com

Unify plug-in information dictionaries

<rdar://problem/13852080>
https://bugs.webkit.org/show_bug.cgi?id=115891

Reviewed by Anders Carlsson.

This unifies the plug-in information dictionaries vended by WKContextCopyPlugInInfoForBundleIdentifier
and WKContextGetInfoForInstalledPlugIns with those from the WKPageLoaderClient and WKPageUIClient.

All the old keys will continue to work, but have been deprecated in favor of new keys defined in 
WKPluginInformation.h

* Shared/API/c/WKPluginInformation.cpp: Added.
* Shared/API/c/WKPluginInformation.h: Added.
Export new keys as SPI.

* Shared/Plugins/Netscape/PluginInformation.h: Added.
* Shared/Plugins/Netscape/PluginInformation.cpp: Added.
(WebKit::pluginInformationBundleIdentifierKey):
(WebKit::pluginInformationBundleVersionKey):
(WebKit::pluginInformationPathKey):
(WebKit::pluginInformationDisplayNameKey):
(WebKit::pluginInformationDefaultLoadPolicyKey):
(WebKit::pluginInformationUpdatePastLastBlockedVersionIsKnownAvailableKey):
(WebKit::pluginInformationHasSandboxProfileKey):
(WebKit::pluginInformationFrameURLKey):
(WebKit::pluginInformationMIMETypeKey):
(WebKit::pluginInformationPageURLKey):
(WebKit::pluginInformationPluginspageAttributeURLKey):
(WebKit::pluginInformationPluginURLKey):
Add new keys.

(WebKit::pluginModuleInformation):
(WebKit::createPluginInformationDictionary):
Add creation functions to simplify multiple sites.

* Shared/Plugins/Netscape/mac/PluginInformationMac.mm: Added.
(WebKit::platformPluginModuleInformation):
Add platform specific data to the dictionary.

* UIProcess/API/C/WKPage.cpp:
(WKPageGetPluginInformationBundleIdentifierKey):
(WKPageGetPluginInformationBundleVersionKey):
(WKPageGetPluginInformationDisplayNameKey):
(WKPageGetPluginInformationFrameURLKey):
(WKPageGetPluginInformationMIMETypeKey):
(WKPageGetPluginInformationPageURLKey):
(WKPageGetPluginInformationPluginspageAttributeURLKey):
(WKPageGetPluginInformationPluginURLKey):
* UIProcess/API/C/WKPage.h:
Deprecate the old keys.

* UIProcess/API/C/mac/WKContextPrivateMac.h:
* UIProcess/API/C/mac/WKContextPrivateMac.mm:
(WKContextCopyPlugInInfoForBundleIdentifier):
(WKContextGetInfoForInstalledPlugIns):
Simplify by using the new createPluginInformationDictionary functions.

(WKPlugInInfoPathKey):
(WKPlugInInfoBundleIdentifierKey):
(WKPlugInInfoVersionKey):
(WKPlugInInfoLoadPolicyKey):
(WKPlugInInfoUpdatePastLastBlockedVersionIsKnownAvailableKey):
(WKPlugInInfoIsSandboxedKey):
Deprecate the old keys.

* UIProcess/WebLoaderClient.cpp:
(WebKit::WebLoaderClient::didFailToInitializePlugin):
(WebKit::WebLoaderClient::didBlockInsecurePluginVersion):
(WebKit::WebLoaderClient::pluginLoadPolicy):
* UIProcess/WebLoaderClient.h:
* UIProcess/WebUIClient.cpp:
(WebKit::WebUIClient::unavailablePluginButtonClicked):
* UIProcess/WebUIClient.h:
Optimize for the most recent callback type which takes a dictionary,
and pull out the necessary bits from it for deprecated callbacks as necessary.

* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::findPlugin):
(WebKit::WebPageProxy::unavailablePluginButtonClicked):
(WebKit::WebPageProxy::didFailToInitializePlugin):
(WebKit::WebPageProxy::didBlockInsecurePluginVersion):
Use createPluginInformationDictionary() consistently, to get consistent results for callbacks.

* WebKit2.xcodeproj/project.pbxproj:
Add new files.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149904 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6fde036c
2013-05-09 Sam Weinig <sam@webkit.org>
Unify plug-in information dictionaries
<rdar://problem/13852080>
https://bugs.webkit.org/show_bug.cgi?id=115891
Reviewed by Anders Carlsson.
This unifies the plug-in information dictionaries vended by WKContextCopyPlugInInfoForBundleIdentifier
and WKContextGetInfoForInstalledPlugIns with those from the WKPageLoaderClient and WKPageUIClient.
All the old keys will continue to work, but have been deprecated in favor of new keys defined in
WKPluginInformation.h
* Shared/API/c/WKPluginInformation.cpp: Added.
* Shared/API/c/WKPluginInformation.h: Added.
Export new keys as SPI.
* Shared/Plugins/Netscape/PluginInformation.h: Added.
* Shared/Plugins/Netscape/PluginInformation.cpp: Added.
(WebKit::pluginInformationBundleIdentifierKey):
(WebKit::pluginInformationBundleVersionKey):
(WebKit::pluginInformationPathKey):
(WebKit::pluginInformationDisplayNameKey):
(WebKit::pluginInformationDefaultLoadPolicyKey):
(WebKit::pluginInformationUpdatePastLastBlockedVersionIsKnownAvailableKey):
(WebKit::pluginInformationHasSandboxProfileKey):
(WebKit::pluginInformationFrameURLKey):
(WebKit::pluginInformationMIMETypeKey):
(WebKit::pluginInformationPageURLKey):
(WebKit::pluginInformationPluginspageAttributeURLKey):
(WebKit::pluginInformationPluginURLKey):
Add new keys.
(WebKit::pluginModuleInformation):
(WebKit::createPluginInformationDictionary):
Add creation functions to simplify multiple sites.
* Shared/Plugins/Netscape/mac/PluginInformationMac.mm: Added.
(WebKit::platformPluginModuleInformation):
Add platform specific data to the dictionary.
* UIProcess/API/C/WKPage.cpp:
(WKPageGetPluginInformationBundleIdentifierKey):
(WKPageGetPluginInformationBundleVersionKey):
(WKPageGetPluginInformationDisplayNameKey):
(WKPageGetPluginInformationFrameURLKey):
(WKPageGetPluginInformationMIMETypeKey):
(WKPageGetPluginInformationPageURLKey):
(WKPageGetPluginInformationPluginspageAttributeURLKey):
(WKPageGetPluginInformationPluginURLKey):
* UIProcess/API/C/WKPage.h:
Deprecate the old keys.
* UIProcess/API/C/mac/WKContextPrivateMac.h:
* UIProcess/API/C/mac/WKContextPrivateMac.mm:
(WKContextCopyPlugInInfoForBundleIdentifier):
(WKContextGetInfoForInstalledPlugIns):
Simplify by using the new createPluginInformationDictionary functions.
(WKPlugInInfoPathKey):
(WKPlugInInfoBundleIdentifierKey):
(WKPlugInInfoVersionKey):
(WKPlugInInfoLoadPolicyKey):
(WKPlugInInfoUpdatePastLastBlockedVersionIsKnownAvailableKey):
(WKPlugInInfoIsSandboxedKey):
Deprecate the old keys.
* UIProcess/WebLoaderClient.cpp:
(WebKit::WebLoaderClient::didFailToInitializePlugin):
(WebKit::WebLoaderClient::didBlockInsecurePluginVersion):
(WebKit::WebLoaderClient::pluginLoadPolicy):
* UIProcess/WebLoaderClient.h:
* UIProcess/WebUIClient.cpp:
(WebKit::WebUIClient::unavailablePluginButtonClicked):
* UIProcess/WebUIClient.h:
Optimize for the most recent callback type which takes a dictionary,
and pull out the necessary bits from it for deprecated callbacks as necessary.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::findPlugin):
(WebKit::WebPageProxy::unavailablePluginButtonClicked):
(WebKit::WebPageProxy::didFailToInitializePlugin):
(WebKit::WebPageProxy::didBlockInsecurePluginVersion):
Use createPluginInformationDictionary() consistently, to get consistent results for callbacks.
* WebKit2.xcodeproj/project.pbxproj:
Add new files.
2013-05-10 Brian J. Burg <burg@cs.washington.edu>
Web Inspector: implement runOpenPanel callback for WebKit2 inspector
......
/*
* Copyright (C) 2013 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.
*/
#include "config.h"
#include "WKPluginInformation.h"
#include "PluginInformation.h"
#include "WKSharedAPICast.h"
#include "WebString.h"
using namespace WebKit;
WKStringRef WKPluginInformationBundleIdentifierKey()
{
static WebString* key = WebString::create(pluginInformationBundleIdentifierKey()).leakRef();
return toAPI(key);
}
WKStringRef WKPluginInformationBundleVersionKey()
{
static WebString* key = WebString::create(pluginInformationBundleVersionKey()).leakRef();
return toAPI(key);
}
WKStringRef WKPluginInformationPathKey()
{
static WebString* key = WebString::create(pluginInformationPathKey()).leakRef();
return toAPI(key);
}
WKStringRef WKPluginInformationDisplayNameKey()
{
static WebString* key = WebString::create(pluginInformationDisplayNameKey()).leakRef();
return toAPI(key);
}
WKStringRef WKPluginInformationDefaultLoadPolicyKey()
{
static WebString* key = WebString::create(pluginInformationDefaultLoadPolicyKey()).leakRef();
return toAPI(key);
}
WKStringRef WKPluginInformationUpdatePastLastBlockedVersionIsKnownAvailableKey()
{
static WebString* key = WebString::create(pluginInformationUpdatePastLastBlockedVersionIsKnownAvailableKey()).leakRef();
return toAPI(key);
}
WKStringRef WKPluginInformationHasSandboxProfileKey()
{
static WebString* key = WebString::create(pluginInformationHasSandboxProfileKey()).leakRef();
return toAPI(key);
}
WKStringRef WKPluginInformationFrameURLKey()
{
static WebString* key = WebString::create(pluginInformationFrameURLKey()).leakRef();
return toAPI(key);
}
WKStringRef WKPluginInformationMIMETypeKey()
{
static WebString* key = WebString::create(pluginInformationMIMETypeKey()).leakRef();
return toAPI(key);
}
WKStringRef WKPluginInformationPageURLKey()
{
static WebString* key = WebString::create(pluginInformationPageURLKey()).leakRef();
return toAPI(key);
}
WKStringRef WKPluginInformationPluginspageAttributeURLKey()
{
static WebString* key = WebString::create(pluginInformationPluginspageAttributeURLKey()).leakRef();
return toAPI(key);
}
WKStringRef WKPluginInformationPluginURLKey()
{
static WebString* key = WebString::create(pluginInformationPluginURLKey()).leakRef();
return toAPI(key);
}
/*
* Copyright (C) 2013 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 WKPluginInformation_h
#define WKPluginInformation_h
#include <WebKit2/WKBase.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Plug-in module information keys */
/* Value type: WKStringRef */
WK_EXPORT WKStringRef WKPluginInformationBundleIdentifierKey();
/* Value type: WKStringRef */
WK_EXPORT WKStringRef WKPluginInformationBundleVersionKey();
/* Value type: WKStringRef */
WK_EXPORT WKStringRef WKPluginInformationPathKey();
/* Value type: WKStringRef */
WK_EXPORT WKStringRef WKPluginInformationDisplayNameKey();
/* Value type: WKUInt64Ref */
WK_EXPORT WKStringRef WKPluginInformationDefaultLoadPolicyKey();
/* Value type: WKBooleanRef */
WK_EXPORT WKStringRef WKPluginInformationUpdatePastLastBlockedVersionIsKnownAvailableKey();
/* Value type: WKBooleanRef */
WK_EXPORT WKStringRef WKPluginInformationHasSandboxProfileKey();
/* Plug-in load specific information keys */
/* Value type: WKURLRef */
WK_EXPORT WKStringRef WKPluginInformationFrameURLKey();
/* Value type: WKStringRef */
WK_EXPORT WKStringRef WKPluginInformationMIMETypeKey();
/* Value type: WKURLRef */
WK_EXPORT WKStringRef WKPluginInformationPageURLKey();
/* Value type: WKURLRef */
WK_EXPORT WKStringRef WKPluginInformationPluginspageAttributeURLKey();
/* Value type: WKURLRef */
WK_EXPORT WKStringRef WKPluginInformationPluginURLKey();
#ifdef __cplusplus
}
#endif
#endif /* WKPluginInformation_h */
/*
* Copyright (C) 2013 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.
*/
#include "config.h"
#include "PluginInformation.h"
#include "PluginInfoStore.h"
#include "PluginModuleInfo.h"
#include "WKAPICast.h"
#include "WebNumber.h"
#include "WebString.h"
#include "WebURL.h"
#include <wtf/text/WTFString.h>
namespace WebKit {
String pluginInformationBundleIdentifierKey()
{
return ASCIILiteral("PluginInformationBundleIdentifier");
}
String pluginInformationBundleVersionKey()
{
return ASCIILiteral("PluginInformationBundleVersion");
}
String pluginInformationPathKey()
{
return ASCIILiteral("PluginInformationPath");
}
String pluginInformationDisplayNameKey()
{
return ASCIILiteral("PluginInformationDisplayName");
}
String pluginInformationDefaultLoadPolicyKey()
{
return ASCIILiteral("PluginInformationDefaultLoadPolicy");
}
String pluginInformationUpdatePastLastBlockedVersionIsKnownAvailableKey()
{
return ASCIILiteral("PluginInformationUpdatePastLastBlockedVersionIsKnownAvailable");
}
String pluginInformationHasSandboxProfileKey()
{
return ASCIILiteral("PluginInformationHasSandboxProfile");
}
String pluginInformationFrameURLKey()
{
return ASCIILiteral("PluginInformationFrameURL");
}
String pluginInformationMIMETypeKey()
{
return ASCIILiteral("PluginInformationMIMEType");
}
String pluginInformationPageURLKey()
{
return ASCIILiteral("PluginInformationPageURL");
}
String pluginInformationPluginspageAttributeURLKey()
{
return ASCIILiteral("PluginInformationPluginspageAttributeURL");
}
String pluginInformationPluginURLKey()
{
return ASCIILiteral("PluginInformationPluginURL");
}
void getPluginModuleInformation(const PluginModuleInfo& plugin, ImmutableDictionary::MapType& map)
{
map.set(pluginInformationPathKey(), WebString::create(plugin.path));
map.set(pluginInformationDisplayNameKey(), WebString::create(plugin.info.name));
map.set(pluginInformationDefaultLoadPolicyKey(), WebUInt64::create(toWKPluginLoadPolicy(PluginInfoStore::policyForPlugin(plugin))));
getPlatformPluginModuleInformation(plugin, map);
}
PassRefPtr<ImmutableDictionary> createPluginInformationDictionary(const PluginModuleInfo& plugin)
{
ImmutableDictionary::MapType map;
getPluginModuleInformation(plugin, map);
return ImmutableDictionary::adopt(map);
}
PassRefPtr<ImmutableDictionary> createPluginInformationDictionary(const PluginModuleInfo& plugin, const String& frameURLString, const String& mimeType, const String& pageURLString, const String& pluginspageAttributeURLString, const String& pluginURLString)
{
ImmutableDictionary::MapType map;
getPluginModuleInformation(plugin, map);
if (!frameURLString.isEmpty())
map.set(pluginInformationFrameURLKey(), WebURL::create(frameURLString));
if (!mimeType.isEmpty())
map.set(pluginInformationMIMETypeKey(), WebString::create(mimeType));
if (!pageURLString.isEmpty())
map.set(pluginInformationPageURLKey(), WebURL::create(pageURLString));
if (!pluginspageAttributeURLString.isEmpty())
map.set(pluginInformationPluginspageAttributeURLKey(), WebURL::create(pluginspageAttributeURLString));
if (!pluginURLString.isEmpty())
map.set(pluginInformationPluginURLKey(), WebURL::create(pluginURLString));
return ImmutableDictionary::adopt(map);
}
PassRefPtr<ImmutableDictionary> createPluginInformationDictionary(const String& mimeType, const String& frameURLString, const String& pageURLString)
{
ImmutableDictionary::MapType map;
if (!frameURLString.isEmpty())
map.set(pluginInformationFrameURLKey(), WebURL::create(frameURLString));
if (!mimeType.isEmpty())
map.set(pluginInformationMIMETypeKey(), WebString::create(mimeType));
if (!pageURLString.isEmpty())
map.set(pluginInformationPageURLKey(), WebURL::create(pageURLString));
return ImmutableDictionary::adopt(map);
}
#if !PLATFORM(MAC)
void getPlatformPluginModuleInformation(const PluginModuleInfo&, ImmutableDictionary::MapType&)
{
}
#endif
} // namespace WebKit
/*
* Copyright (C) 2013 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 PluginInformation_h
#define PluginInformation_h
#include "ImmutableDictionary.h"
#include <wtf/Forward.h>
namespace WebKit {
struct PluginModuleInfo;
// Plug-in module information keys
String pluginInformationBundleIdentifierKey();
String pluginInformationBundleVersionKey();
String pluginInformationPathKey();
String pluginInformationDisplayNameKey();
String pluginInformationDefaultLoadPolicyKey();
String pluginInformationUpdatePastLastBlockedVersionIsKnownAvailableKey();
String pluginInformationHasSandboxProfileKey();
// Plug-in load specific information keys
String pluginInformationFrameURLKey();
String pluginInformationMIMETypeKey();
String pluginInformationPageURLKey();
String pluginInformationPluginspageAttributeURLKey();
String pluginInformationPluginURLKey();
PassRefPtr<ImmutableDictionary> createPluginInformationDictionary(const PluginModuleInfo&);
PassRefPtr<ImmutableDictionary> createPluginInformationDictionary(const PluginModuleInfo&, const String& frameURLString, const String& mimeType, const String& pageURLString, const String& pluginspageAttributeURLString, const String& pluginURLString);
PassRefPtr<ImmutableDictionary> createPluginInformationDictionary(const String& mimeType, const String& frameURLString, const String& pageURLString);
void getPluginModuleInformation(const PluginModuleInfo&, ImmutableDictionary::MapType&);
void getPlatformPluginModuleInformation(const PluginModuleInfo&, ImmutableDictionary::MapType&);
} // namespace WebKit
#endif // PluginInformation_h
/*
* Copyright (C) 2013 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.
*/
#import "config.h"
#import "PluginInformation.h"
#import "PluginModuleInfo.h"
#import "PluginSandboxProfile.h"
#import "StringUtilities.h"
#import "WebNumber.h"
#import "WebString.h"
#import <WebKitSystemInterface.h>
namespace WebKit {
void getPlatformPluginModuleInformation(const PluginModuleInfo& plugin, ImmutableDictionary::MapType& map)
{
map.set(pluginInformationBundleIdentifierKey(), WebString::create(plugin.bundleIdentifier));
map.set(pluginInformationBundleVersionKey(), WebString::create(plugin.versionString));
map.set(pluginInformationUpdatePastLastBlockedVersionIsKnownAvailableKey(), WebBoolean::create(WKIsPluginUpdateAvailable(nsStringFromWebCoreString(plugin.bundleIdentifier))));
map.set(pluginInformationHasSandboxProfileKey(), WebBoolean::create(pluginHasSandboxProfile(plugin.bundleIdentifier)));
}
} // namespace WebKit
......@@ -29,6 +29,7 @@
#include "PrintInfo.h"
#include "WKAPICast.h"
#include "WKPluginInformation.h"
#include "WebBackForwardList.h"
#include "WebData.h"
#include "WebPageProxy.h"
......@@ -826,6 +827,28 @@ void WKPageSetMayStartMediaWhenInWindow(WKPageRef pageRef, bool mayStartMedia)
toImpl(pageRef)->setMayStartMediaWhenInWindow(mayStartMedia);
}
void WKPageSetOverridePrivateBrowsingEnabled(WKPageRef pageRef, bool enabled)
{
toImpl(pageRef)->setOverridePrivateBrowsingEnabled(enabled);
}
bool WKPageGetOverridePrivateBrowsingEnabled(WKPageRef pageRef)
{
return toImpl(pageRef)->overridePrivateBrowsingEnabled();
}
void WKPageSelectContextMenuItem(WKPageRef page, WKContextMenuItemRef item)
{
#if ENABLE(CONTEXT_MENUS)
toImpl(page)->contextMenuItemSelected(*(toImpl(item)->data()));
#endif
}
// -- DEPRECATED --
void WKPageSetInvalidMessageFunction(WKPageInvalidMessageFunction)
{
// FIXME: Remove this function when doing so won't break WebKit nightlies.
......@@ -833,65 +856,43 @@ void WKPageSetInvalidMessageFunction(WKPageInvalidMessageFunction)
WKStringRef WKPageGetPluginInformationBundleIdentifierKey()
{
static WebString* key = WebString::create(WebPageProxy::pluginInformationBundleIdentifierKey()).leakRef();
return toAPI(key);
return WKPluginInformationBundleIdentifierKey();
}
WKStringRef WKPageGetPluginInformationBundleVersionKey()
{
static WebString* key = WebString::create(WebPageProxy::pluginInformationBundleVersionKey()).leakRef();
return toAPI(key);
return WKPluginInformationBundleVersionKey();
}
WKStringRef WKPageGetPluginInformationDisplayNameKey()
{
static WebString* key = WebString::create(WebPageProxy::pluginInformationDisplayNameKey()).leakRef();
return toAPI(key);
return WKPluginInformationBundleVersionKey();
}
WKStringRef WKPageGetPluginInformationFrameURLKey()
{
static WebString* key = WebString::create(WebPageProxy::pluginInformationFrameURLKey()).leakRef();
return toAPI(key);
return WKPluginInformationFrameURLKey();
}
WKStringRef WKPageGetPluginInformationMIMETypeKey()
{
static WebString* key = WebString::create(WebPageProxy::pluginInformationMIMETypeKey()).leakRef();
return toAPI(key);
return WKPluginInformationMIMETypeKey();
}
WKStringRef WKPageGetPluginInformationPageURLKey()
{
static WebString* key = WebString::create(WebPageProxy::pluginInformationPageURLKey()).leakRef();
return toAPI(key);
return WKPluginInformationPageURLKey();
}
WKStringRef WKPageGetPluginInformationPluginspageAttributeURLKey()
{