diff options
author | dglazkov@google.com <dglazkov@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-23 20:47:43 +0000 |
---|---|---|
committer | dglazkov@google.com <dglazkov@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-23 20:47:43 +0000 |
commit | f41825fa3c1efc2e1bb0ff3036591fb47a125722 (patch) | |
tree | 4c0c19bcd1da2f0f67144ef93de2a08440cd9f77 | |
parent | 4112c5261fcc4187e82fe04212662e6782e7e903 (diff) | |
download | chromium_src-f41825fa3c1efc2e1bb0ff3036591fb47a125722.zip chromium_src-f41825fa3c1efc2e1bb0ff3036591fb47a125722.tar.gz chromium_src-f41825fa3c1efc2e1bb0ff3036591fb47a125722.tar.bz2 |
Move webkit/port/bridge contents to their proper places in WebKit, Mac build.
Review URL: http://codereview.chromium.org/16244
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7436 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/port/bridge/KJSBridge.cpp | 138 | ||||
-rw-r--r-- | webkit/port/bridge/chromium/PluginsChromium.cpp | 184 | ||||
-rw-r--r-- | webkit/webkit.xcodeproj/project.pbxproj | 24 |
3 files changed, 4 insertions, 342 deletions
diff --git a/webkit/port/bridge/KJSBridge.cpp b/webkit/port/bridge/KJSBridge.cpp deleted file mode 100644 index ed6aeb7..0000000 --- a/webkit/port/bridge/KJSBridge.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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 "bindings/npruntime.h" -#include "npruntime_impl.h" -#include "npruntime_priv.h" - -// This file is a dumping ground for KJS-related fixups that we need. It -// should ideally be eliminated in favor of less lameness. - -// KJS should only expose functions declared in npruntime.h (NPN_*) -// and npruntime_priv.h (which is an extension of npruntime.h), and -// not exposing _NPN_* functions declared in npruntime_impl.h. -// KJSBridge implements NPN_* functions by wrapping around _NPN_* functions. -// -// Following styles in JavaScriptCore/bindings/npruntime.cpp -void NPN_ReleaseVariantValue(NPVariant *variant) { - _NPN_ReleaseVariantValue(variant); -} - -NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name) { - return _NPN_GetStringIdentifier(name); -} - -void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, - NPIdentifier *identifiers) { - _NPN_GetStringIdentifiers(names, nameCount, identifiers); -} - -NPIdentifier NPN_GetIntIdentifier(int32_t intid) { - return _NPN_GetIntIdentifier(intid); -} - -bool NPN_IdentifierIsString(NPIdentifier identifier) { - return _NPN_IdentifierIsString(identifier); -} - -NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier) { - return _NPN_UTF8FromIdentifier(identifier); -} - -int32_t NPN_IntFromIdentifier(NPIdentifier identifier) { - return _NPN_IntFromIdentifier(identifier); -} - -NPObject *NPN_CreateObject(NPP npp, NPClass *aClass) { - return _NPN_CreateObject(npp, aClass); -} - -NPObject *NPN_RetainObject(NPObject *obj) { - return _NPN_RetainObject(obj); -} - -void NPN_ReleaseObject(NPObject *obj) { - _NPN_ReleaseObject(obj); -} - -void NPN_DeallocateObject(NPObject *obj) { - _NPN_DeallocateObject(obj); -} - -bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName, - const NPVariant *args, uint32_t argCount, NPVariant *result) { - return _NPN_Invoke(npp, npobj, methodName, args, argCount, result); -} - -bool NPN_InvokeDefault(NPP npp, NPObject *npobj, const NPVariant *args, - uint32_t argCount, NPVariant *result) { - return _NPN_InvokeDefault(npp, npobj, args, argCount, result); -} - -bool NPN_Evaluate(NPP npp, NPObject *npobj, NPString *script, NPVariant *result) { - return _NPN_Evaluate(npp, npobj, script, result); -} - -bool NPN_EvaluateHelper(NPP npp, bool popups_allowed, NPObject* npobj, - NPString* script, NPVariant *result) { - return _NPN_Evaluate(npp, npobj, script, result); -} - -bool NPN_GetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName, - NPVariant *result) { - return _NPN_GetProperty(npp, npobj, propertyName, result); -} - -bool NPN_SetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName, - const NPVariant *value) { - return _NPN_SetProperty(npp, npobj, propertyName, value); -} - -bool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName) { - return _NPN_RemoveProperty(npp, npobj, propertyName); -} - -bool NPN_HasProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName) { - return _NPN_HasProperty(npp, npobj, propertyName); -} - -bool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName) { - return _NPN_HasMethod(npp, npobj, methodName); -} - -void NPN_SetException(NPObject *obj, const NPUTF8 *message) { - _NPN_SetException(obj, message); -} - -bool NPN_Enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier, - uint32_t *count) { - return _NPN_Enumerate(npp, npobj, identifier, count); -} diff --git a/webkit/port/bridge/chromium/PluginsChromium.cpp b/webkit/port/bridge/chromium/PluginsChromium.cpp deleted file mode 100644 index d73e9476..0000000 --- a/webkit/port/bridge/chromium/PluginsChromium.cpp +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) 2008, Google 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT -// OWNER OR 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. - -// These functions are used by the javascript access to the -// netscape.plugins object. See PluginInfoStore.h. -// They are also used by WebViewImpl to check if a plugin exists for a given -// MIME type. - -#include "config.h" - -#include "ChromiumBridge.h" -#include "PluginData.h" -#include "PluginInfoStore.h" - -namespace WebCore { - -class PluginCache { -public: - PluginCache() : m_loaded(false) { } - - ~PluginCache() - { - clear(); - } - - void load(bool refresh) - { - if (m_loaded) { - if (!refresh) - return; - clear(); - } else { - m_loaded = true; - } - ChromiumBridge::plugins(refresh, &m_plugins); - } - - void clear() - { - for (size_t i = 0; i < m_plugins.size(); ++i) - deleteAllValues(m_plugins[i]->mimes); - deleteAllValues(m_plugins); - m_plugins.clear(); - } - - // Returns a PluginInfo pointer. Caller is responsible for - // deleting contents of the PluginInfo. - PluginInfo* createPluginInfoForPluginAtIndex(unsigned int index) - { - load(false); - - WebCore::PluginInfo* rv = new WebCore::PluginInfo(); - const WebCore::PluginInfo* plugin = m_plugins[index]; - rv->name = plugin->name; - rv->desc = plugin->desc; - rv->file = plugin->file; - for (size_t j = 0; j < plugin->mimes.size(); ++j) { - WebCore::MimeClassInfo* newMime = new WebCore::MimeClassInfo(); - const WebCore::MimeClassInfo* mimeType = plugin->mimes[j]; - newMime->type = mimeType->type; - newMime->desc = mimeType->desc; - newMime->suffixes = mimeType->suffixes; - newMime->plugin = rv; - rv->mimes.append(newMime); - } - - return rv; - } - - unsigned pluginCount() - { - load(false); - - return m_plugins.size(); - } - - bool supportsMIMEType(const WebCore::String &mime_type) - { - load(false); - - for (size_t i = 0; i < m_plugins.size(); ++i) { - for (size_t j = 0; j < m_plugins[i]->mimes.size(); ++j) { - if (ChromiumBridge::matchesMIMEType( - m_plugins[i]->mimes[j]->type, mime_type)) { - // Don't allow wildcard matches here as this will result in - // plugins being instantiated in cases where they should - // not. For e.g. clicking on a link which causes a file to - // be downloaded, special mime types like text/xml, etc. In - // any case the webkit codepaths which invoke this function - // don't expect wildcard plugin matches. - if (m_plugins[i]->mimes[j]->type == "*") - continue; - return true; - } - } - } - - return false; - } - - String getPluginMimeTypeFromExtension(const String& extension) - { -#if !defined(__linux__) - // TODO(port): unstub once we have plugin support for Linux - - load(false); - - for (size_t i = 0; i < m_plugins.size(); ++i) { - PluginInfo* plugin = m_plugins[i]; - for (size_t j = 0; j < plugin->mimes.size(); ++j) { - MimeClassInfo* mime = plugin->mimes[j]; - Vector<String> extensions; - mime->suffixes.split(",", extensions); - for (size_t k = 0; k < extensions.size(); ++k) { - if (extension == extensions[k]) - return mime->type; - } - } - } -#endif - return String(); - } - -private: - bool m_loaded; - Vector<PluginInfo*> m_plugins; -}; - -// We cache the plugins ourselves, since if we're getting them from the another -// process GetPlugins() will be expensive. -static PluginCache pluginCache; - -PluginInfo* PluginInfoStore::createPluginInfoForPluginAtIndex(unsigned int index) -{ - return pluginCache.createPluginInfoForPluginAtIndex(index); -} - -unsigned PluginInfoStore::pluginCount() const -{ - return pluginCache.pluginCount(); -} - -bool PluginInfoStore::supportsMIMEType(const WebCore::String &mime_type) -{ - return pluginCache.supportsMIMEType(mime_type); -} - -void refreshPlugins(bool) -{ - pluginCache.load(true); -} - -String getPluginMimeTypeFromExtension(const String& extension) -{ - return pluginCache.getPluginMimeTypeFromExtension(extension); -} - -} // namespace WebCore diff --git a/webkit/webkit.xcodeproj/project.pbxproj b/webkit/webkit.xcodeproj/project.pbxproj index 8ad45d3..9e1ec46 100644 --- a/webkit/webkit.xcodeproj/project.pbxproj +++ b/webkit/webkit.xcodeproj/project.pbxproj @@ -63,6 +63,7 @@ 41A362510F003B3000778012 /* DragControllerChromium.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41A3624B0F003B3000778012 /* DragControllerChromium.cpp */; }; 41A362520F003B3000778012 /* EventHandlerChromium.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41A3624C0F003B3000778012 /* EventHandlerChromium.cpp */; }; 41A362530F003B3000778012 /* FrameChromium.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41A3624D0F003B3000778012 /* FrameChromium.cpp */; }; + 41A362D70F01695600778012 /* PluginsChromium.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41A362D60F01695600778012 /* PluginsChromium.cpp */; }; 41AF32C60EE5E6ED00BF6361 /* ScriptInstance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41AF32C40EE5E6ED00BF6361 /* ScriptInstance.cpp */; }; 41F1D4630EF70D1600DA8753 /* FontFastPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F1D4620EF70D1600DA8753 /* FontFastPath.cpp */; }; 4D1637CC0EBFA49E008F024E /* SQLiteAuthorizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4D1637C30EBFA49E008F024E /* SQLiteAuthorizer.cpp */; }; @@ -483,7 +484,6 @@ 938180480EF3392100993F02 /* BackForwardList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 938180460EF3392100993F02 /* BackForwardList.cpp */; }; 938180500EF3394A00993F02 /* back_forward_list_client_impl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9381804E0EF3394A00993F02 /* back_forward_list_client_impl.cc */; }; 938181480EF6D29000993F02 /* PluginData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 938181460EF6D29000993F02 /* PluginData.cpp */; }; - 93AF4BAB0EF6D4FB0073C62D /* PluginsChromium.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93AF4BAA0EF6D4FB0073C62D /* PluginsChromium.cpp */; }; 93AF4CE00EFAEDF80073C62D /* PlatformScreenMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93AF4CDF0EFAEDF80073C62D /* PlatformScreenMac.mm */; }; 93AF4D050EFAF0090073C62D /* ScrollView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93AF4D040EFAF0090073C62D /* ScrollView.cpp */; }; 93AF52490F001CAB0073C62D /* media_player_private_impl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 93AF52480F001CAB0073C62D /* media_player_private_impl.cc */; }; @@ -1489,6 +1489,7 @@ 41A3624C0F003B3000778012 /* EventHandlerChromium.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EventHandlerChromium.cpp; path = chromium/EventHandlerChromium.cpp; sourceTree = "<group>"; }; 41A3624D0F003B3000778012 /* FrameChromium.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FrameChromium.cpp; path = chromium/FrameChromium.cpp; sourceTree = "<group>"; }; 41A3624E0F003B3000778012 /* FrameChromium.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FrameChromium.h; path = chromium/FrameChromium.h; sourceTree = "<group>"; }; + 41A362D60F01695600778012 /* PluginsChromium.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginsChromium.cpp; path = ../third_party/WebKit/WebCore/plugins/chromium/PluginsChromium.cpp; sourceTree = SOURCE_ROOT; }; 41AF32C40EE5E6ED00BF6361 /* ScriptInstance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptInstance.cpp; sourceTree = "<group>"; }; 41AF32C50EE5E6ED00BF6361 /* ScriptInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptInstance.h; sourceTree = "<group>"; }; 41F1D4620EF70D1600DA8753 /* FontFastPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontFastPath.cpp; sourceTree = "<group>"; }; @@ -3995,7 +3996,6 @@ 9381804F0EF3394A00993F02 /* back_forward_list_client_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = back_forward_list_client_impl.h; sourceTree = "<group>"; }; 938181460EF6D29000993F02 /* PluginData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginData.cpp; sourceTree = "<group>"; }; 938181470EF6D29000993F02 /* PluginData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginData.h; sourceTree = "<group>"; }; - 93AF4BAA0EF6D4FB0073C62D /* PluginsChromium.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginsChromium.cpp; path = chromium/PluginsChromium.cpp; sourceTree = "<group>"; }; 93AF4CDF0EFAEDF80073C62D /* PlatformScreenMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PlatformScreenMac.mm; path = mac/PlatformScreenMac.mm; sourceTree = "<group>"; }; 93AF4D040EFAF0090073C62D /* ScrollView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollView.cpp; sourceTree = "<group>"; }; 93AF52480F001CAB0073C62D /* media_player_private_impl.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = media_player_private_impl.cc; sourceTree = "<group>"; }; @@ -6710,7 +6710,6 @@ 7B9375960D919010008B9587 /* port */ = { isa = PBXGroup; children = ( - 7B9375970D91902E008B9587 /* bridge */, E4A970880E3614F200E8EF3B /* page */, 822B1BE60DC778FF005C9A96 /* platform */, 938181210EF6D25700993F02 /* plugins */, @@ -6718,14 +6717,6 @@ path = port; sourceTree = "<group>"; }; - 7B9375970D91902E008B9587 /* bridge */ = { - isa = PBXGroup; - children = ( - 93AF4BA90EF6D4E30073C62D /* chromium */, - ); - path = bridge; - sourceTree = "<group>"; - }; 7B964AAB0E7EE4A0006D1A11 /* Projects */ = { isa = PBXGroup; children = ( @@ -7663,20 +7654,13 @@ 938181420EF6D26400993F02 /* chromium */ = { isa = PBXGroup; children = ( + 41A362D60F01695600778012 /* PluginsChromium.cpp */, 41A361D80F001E3800778012 /* PluginDataChromium.cpp */, ); name = chromium; path = ../../../../webkit/port; sourceTree = "<group>"; }; - 93AF4BA90EF6D4E30073C62D /* chromium */ = { - isa = PBXGroup; - children = ( - 93AF4BAA0EF6D4FB0073C62D /* PluginsChromium.cpp */, - ); - name = chromium; - sourceTree = "<group>"; - }; 93AF4CDE0EFAEDC20073C62D /* mac */ = { isa = PBXGroup; children = ( @@ -8925,6 +8909,7 @@ 938181480EF6D29000993F02 /* PluginData.cpp in Sources */, 41A361D90F001E3800778012 /* PluginDataChromium.cpp in Sources */, E45624930E268E87005E4685 /* PluginDocument.cpp in Sources */, + 41A362D70F01695600778012 /* PluginsChromium.cpp in Sources */, E45625570E268E87005E4685 /* PointerEventsHitRules.cpp in Sources */, 93AF529B0F002F680073C62D /* PopupMenuChromium.cpp in Sources */, E45623D80E268E87005E4685 /* Position.cpp in Sources */, @@ -9443,7 +9428,6 @@ 7B2B0A630E3143EC00D4C6B7 /* JPEGImageDecoder.cpp in Sources */, 4D1641090EC29C84008F024E /* Location.cpp in Sources */, 93AF4CE00EFAEDF80073C62D /* PlatformScreenMac.mm in Sources */, - 93AF4BAB0EF6D4FB0073C62D /* PluginsChromium.cpp in Sources */, 7B2B0A650E3143EC00D4C6B7 /* PNGImageDecoder.cpp in Sources */, E40060DB0EA69E0B0055B38E /* ScriptController.cpp in Sources */, 4DB7F55D0E9BD66300C66CE0 /* V8XMLHttpRequestCustom.cpp in Sources */, |