diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-26 20:40:26 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-26 20:40:26 +0000 |
commit | e1c14cebfdc0eb1b54b84c3806d7cf5c8a526e10 (patch) | |
tree | 9c1ec8bf6111c35fb03aa26e78d1f4c6a7d21597 /webkit | |
parent | c258dab32ac918a4884d3a01378ac299c478cd55 (diff) | |
download | chromium_src-e1c14cebfdc0eb1b54b84c3806d7cf5c8a526e10.zip chromium_src-e1c14cebfdc0eb1b54b84c3806d7cf5c8a526e10.tar.gz chromium_src-e1c14cebfdc0eb1b54b84c3806d7cf5c8a526e10.tar.bz2 |
Remove dependencies on base/glue from these 2 port files.
Review URL: http://codereview.chromium.org/12460
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6046 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/chromium_bridge_impl.cc | 12 | ||||
-rw-r--r-- | webkit/port/bindings/v8/np_v8object.cpp | 17 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_np_utils.cpp | 18 | ||||
-rw-r--r-- | webkit/port/platform/chromium/ChromiumBridge.h | 3 |
4 files changed, 22 insertions, 28 deletions
diff --git a/webkit/glue/chromium_bridge_impl.cc b/webkit/glue/chromium_bridge_impl.cc index 1115d3d..b8810ca 100644 --- a/webkit/glue/chromium_bridge_impl.cc +++ b/webkit/glue/chromium_bridge_impl.cc @@ -39,6 +39,7 @@ #endif #include "webkit/glue/chrome_client_impl.h" #include "webkit/glue/glue_util.h" +#include "webkit/glue/plugins/plugin_instance.h" #include "webkit/glue/scoped_clipboard_writer_glue.h" #include "webkit/glue/webcursor.h" #include "webkit/glue/webkit_glue.h" @@ -328,6 +329,17 @@ NPObject* ChromiumBridge::pluginScriptableObject(Widget* widget) { return static_cast<WebPluginContainer*>(widget)->GetPluginScriptableObject(); } +bool ChromiumBridge::popupsAllowed(NPP npp) { + bool popups_allowed = false; + if (npp) { + NPAPI::PluginInstance* plugin_instance = + reinterpret_cast<NPAPI::PluginInstance*>(npp->ndata); + if (plugin_instance) + popups_allowed = plugin_instance->popups_allowed(); + } + return popups_allowed; +} + // Protocol ------------------------------------------------------------------- String ChromiumBridge::uiResourceProtocol() { diff --git a/webkit/port/bindings/v8/np_v8object.cpp b/webkit/port/bindings/v8/np_v8object.cpp index 9bce40d..7856fec 100644 --- a/webkit/port/bindings/v8/np_v8object.cpp +++ b/webkit/port/bindings/v8/np_v8object.cpp @@ -32,6 +32,7 @@ #include <sstream> #include <v8.h> #include "np_v8object.h" +#include "ChromiumBridge.h" #include "Frame.h" #include "bindings/npruntime.h" #include "npruntime_priv.h" @@ -42,10 +43,6 @@ #include "v8_proxy.h" #include "DOMWindow.h" -#ifdef OS_WIN -#include "webkit/glue/plugins/plugin_instance.h" -#endif // OS_WIN - using WebCore::V8ClassIndex; using WebCore::V8Proxy; @@ -246,17 +243,7 @@ bool NPN_InvokeDefault(NPP npp, NPObject *npobj, const NPVariant *args, bool NPN_Evaluate(NPP npp, NPObject *npobj, NPString *npscript, NPVariant *result) { - bool popups_allowed = false; - -#ifdef OS_WIN - if (npp) { - NPAPI::PluginInstance* plugin_instance = - reinterpret_cast<NPAPI::PluginInstance*>(npp->ndata); - if (plugin_instance) - popups_allowed = plugin_instance->popups_allowed(); - } -#endif // OS_WIN - + bool popups_allowed = WebCore::ChromiumBridge::popupsAllowed(npp); return NPN_EvaluateHelper(npp, popups_allowed, npobj, npscript, result); } diff --git a/webkit/port/bindings/v8/v8_np_utils.cpp b/webkit/port/bindings/v8/v8_np_utils.cpp index 74f5bd6..c178999 100644 --- a/webkit/port/bindings/v8/v8_np_utils.cpp +++ b/webkit/port/bindings/v8/v8_np_utils.cpp @@ -33,10 +33,9 @@ #include "DOMWindow.h" #include "Frame.h" +#include "PlatformString.h" #undef LOG -#include "base/scoped_ptr.h" -#include "base/string_util.h" #include "npruntime_priv.h" #include "np_v8object.h" #include "v8_npobject.h" @@ -69,15 +68,9 @@ void ConvertV8ObjectToNPVariant(v8::Local<v8::Value> object, NPObject *owner, VOID_TO_NPVARIANT(*result); } else if (object->IsString()) { - v8::Handle<v8::String> str = object->ToString(); - uint16_t* buf = new uint16_t[str->Length() + 1]; - str->Write(buf); - std::string utf8; - UTF16ToUTF8(reinterpret_cast<char16*>(buf), str->Length(), &utf8); - char* utf8_chars = strdup(utf8.c_str()); + v8::String::Utf8Value utf8(object); + char* utf8_chars = strdup(*utf8); STRINGN_TO_NPVARIANT(utf8_chars, utf8.length(), *result); - delete[] buf; - } else if (object->IsObject()) { WebCore::DOMWindow* window = WebCore::V8Proxy::retrieveWindow(); NPObject* npobject = NPN_CreateScriptObject( @@ -137,7 +130,6 @@ NPIdentifier GetStringIdentifier(v8::Handle<v8::String> str) { return NPN_GetStringIdentifier(stack_buf); } - scoped_array<char> heap_buf(new char[buf_len]); - str->WriteAscii(heap_buf.get()); - return NPN_GetStringIdentifier(heap_buf.get()); + v8::String::AsciiValue ascii(str); + return NPN_GetStringIdentifier(*ascii); } diff --git a/webkit/port/platform/chromium/ChromiumBridge.h b/webkit/port/platform/chromium/ChromiumBridge.h index 4e4e5b1..1c8b034 100644 --- a/webkit/port/platform/chromium/ChromiumBridge.h +++ b/webkit/port/platform/chromium/ChromiumBridge.h @@ -39,6 +39,8 @@ class NativeImageSkia; typedef struct NPObject NPObject; +typedef struct _NPP NPP_t;
+typedef NPP_t* NPP; #if PLATFORM(WIN_OS) typedef struct HFONT__* HFONT; @@ -104,6 +106,7 @@ namespace WebCore { // Plugin ------------------------------------------------------------- static bool plugins(bool refresh, Vector<PluginInfo*>* plugins); static NPObject* pluginScriptableObject(Widget* widget); + static bool popupsAllowed(NPP npp); // Protocol ----------------------------------------------------------- static String uiResourceProtocol(); |