diff options
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/webkit_glue.gypi | 2 | ||||
-rw-r--r-- | webkit/plugins/ppapi/plugin_module.cc | 102 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppapi_plugin_instance.cc | 46 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppapi_plugin_instance.h | 7 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_console_impl.cc | 87 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_console_impl.h | 23 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_url_request_info_impl.cc | 3 |
7 files changed, 81 insertions, 189 deletions
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index 1112558..cb126a6 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -225,8 +225,6 @@ '../plugins/ppapi/ppb_buffer_impl.h', '../plugins/ppapi/ppb_char_set_impl.cc', '../plugins/ppapi/ppb_char_set_impl.h', - '../plugins/ppapi/ppb_console_impl.cc', - '../plugins/ppapi/ppb_console_impl.h', '../plugins/ppapi/ppb_context_3d_impl.cc', '../plugins/ppapi/ppb_context_3d_impl.h', '../plugins/ppapi/ppb_crypto_impl.cc', diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index aa20704..efb8859 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -86,7 +86,6 @@ #include "webkit/plugins/ppapi/common.h" #include "webkit/plugins/ppapi/ppapi_interface_factory.h" #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" -#include "webkit/plugins/ppapi/ppb_console_impl.h" #include "webkit/plugins/ppapi/ppb_crypto_impl.h" #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" #include "webkit/plugins/ppapi/ppb_flash_clipboard_impl.h" @@ -228,42 +227,36 @@ const void* GetInterface(const char* name) { if (custom_interface) return custom_interface; + // TODO(brettw) put these in a hash map for better performance. + #define UNPROXIED_IFACE(api_name, iface_str, iface_struct) \ + if (strcmp(name, iface_str) == 0) \ + return ::ppapi::thunk::Get##iface_struct##_Thunk(); + #define PROXIED_IFACE(api_name, iface_str, iface_struct) \ + UNPROXIED_IFACE(api_name, iface_str, iface_struct) + + #include "ppapi/thunk/interfaces_ppb_public_stable.h" + #include "ppapi/thunk/interfaces_ppb_public_dev.h" + #include "ppapi/thunk/interfaces_ppb_private.h" + + #undef UNPROXIED_API + #undef PROXIED_IFACE + // Please keep alphabetized by interface macro name with "special" stuff at // the bottom. - if (strcmp(name, PPB_AUDIO_CONFIG_INTERFACE_1_0) == 0) - return ::ppapi::thunk::GetPPB_AudioConfig_Thunk(); - if (strcmp(name, PPB_AUDIO_INTERFACE_1_0) == 0) - return ::ppapi::thunk::GetPPB_Audio_Thunk(); if (strcmp(name, PPB_AUDIO_TRUSTED_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_AudioTrusted_Thunk(); - if (strcmp(name, PPB_BROKER_TRUSTED_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_Broker_Thunk(); - if (strcmp(name, PPB_BUFFER_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_Buffer_Thunk(); if (strcmp(name, PPB_BUFFER_TRUSTED_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_BufferTrusted_Thunk(); - if (strcmp(name, PPB_CHAR_SET_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_CharSet_Thunk(); - if (strcmp(name, PPB_CONSOLE_DEV_INTERFACE) == 0) - return PPB_Console_Impl::GetInterface(); + if (strcmp(name, PPB_CONTEXT_3D_TRUSTED_DEV_INTERFACE) == 0) + return ::ppapi::thunk::GetPPB_Context3DTrusted_Thunk(); if (strcmp(name, PPB_CORE_INTERFACE) == 0) return &core_interface; if (strcmp(name, PPB_CRYPTO_DEV_INTERFACE) == 0) return PPB_Crypto_Impl::GetInterface(); - if (strcmp(name, PPB_CURSOR_CONTROL_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_CursorControl_Thunk(); if (strcmp(name, PPB_DIRECTORYREADER_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_DirectoryReader_Thunk(); - if (strcmp(name, PPB_FILECHOOSER_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_FileChooser_Thunk(); - if (strcmp(name, PPB_FILEIO_INTERFACE_1_0) == 0) - return ::ppapi::thunk::GetPPB_FileIO_Thunk(); + return ::ppapi::thunk::GetPPB_DirectoryReader_Dev_Thunk(); if (strcmp(name, PPB_FILEIOTRUSTED_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_FileIOTrusted_Thunk(); - if (strcmp(name, PPB_FILEREF_INTERFACE_1_0) == 0) - return ::ppapi::thunk::GetPPB_FileRef_Thunk(); - if (strcmp(name, PPB_FILESYSTEM_INTERFACE_1_0) == 0) - return ::ppapi::thunk::GetPPB_FileSystem_Thunk(); if (strcmp(name, PPB_FIND_DEV_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_Find_Thunk(); if (strcmp(name, PPB_FLASH_INTERFACE) == 0) @@ -278,36 +271,24 @@ const void* GetInterface(const char* name) { return ::ppapi::thunk::GetPPB_Flash_Menu_Thunk(); if (strcmp(name, PPB_FLASH_TCPSOCKET_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_Flash_TCPSocket_Thunk(); - if (strcmp(name, PPB_FONT_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_Font_Thunk(); if (strcmp(name, PPB_FULLSCREEN_DEV_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_Fullscreen_Thunk(); if (strcmp(name, PPB_GPU_BLACKLIST_INTERFACE) == 0) return PPB_GpuBlacklist_Private_Impl::GetInterface(); - if (strcmp(name, PPB_GRAPHICS_2D_INTERFACE_1_0) == 0) - return ::ppapi::thunk::GetPPB_Graphics2D_Thunk(); - if (strcmp(name, PPB_IMAGEDATA_INTERFACE_1_0) == 0) - return ::ppapi::thunk::GetPPB_ImageData_Thunk(); + if (strcmp(name, PPB_GRAPHICS_3D_TRUSTED_INTERFACE) == 0) + return ::ppapi::thunk::GetPPB_Graphics3DTrusted_Thunk(); if (strcmp(name, PPB_IMAGEDATA_TRUSTED_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_ImageDataTrusted_Thunk(); if (strcmp(name, PPB_INPUT_EVENT_INTERFACE_1_0) == 0) return ::ppapi::thunk::GetPPB_InputEvent_Thunk(); - if (strcmp(name, PPB_INSTANCE_INTERFACE_1_0) == 0) - return ::ppapi::thunk::GetPPB_Instance_1_0_Thunk(); if (strcmp(name, PPB_INSTANCE_PRIVATE_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_Instance_Private_Thunk(); - if (strcmp(name, PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0) == 0) - return ::ppapi::thunk::GetPPB_KeyboardInputEvent_Thunk(); + if (strcmp(name, PPB_LAYER_COMPOSITOR_DEV_INTERFACE) == 0) + return ::ppapi::thunk::GetPPB_LayerCompositor_Thunk(); if (strcmp(name, PPB_MEMORY_DEV_INTERFACE) == 0) return PPB_Memory_Impl::GetInterface(); - if (strcmp(name, PPB_MESSAGING_INTERFACE_1_0) == 0) - return ::ppapi::thunk::GetPPB_Messaging_Thunk(); - if (strcmp(name, PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0) == 0) - return ::ppapi::thunk::GetPPB_MouseInputEvent_1_0_Thunk(); - if (strcmp(name, PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1) == 0) - return ::ppapi::thunk::GetPPB_MouseInputEvent_1_1_Thunk(); - if (strcmp(name, PPB_MOUSELOCK_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_MouseLock_Thunk(); + if (strcmp(name, PPB_OPENGLES2_INTERFACE) == 0) + return PPB_OpenGLES_Impl::GetInterface(); if (strcmp(name, PPB_PROXY_PRIVATE_INTERFACE) == 0) return PPB_Proxy_Impl::GetInterface(); if (strcmp(name, PPB_QUERY_POLICY_DEV_INTERFACE_0_1) == 0) @@ -320,52 +301,21 @@ const void* GetInterface(const char* name) { return ::ppapi::thunk::GetPPB_Scrollbar_Thunk(); if (strcmp(name, PPB_UMA_PRIVATE_INTERFACE) == 0) return PPB_UMA_Private_Impl::GetInterface(); - if (strcmp(name, PPB_URLLOADER_INTERFACE_1_0) == 0) - return ::ppapi::thunk::GetPPB_URLLoader_Thunk(); if (strcmp(name, PPB_URLLOADERTRUSTED_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_URLLoaderTrusted_Thunk(); - if (strcmp(name, PPB_URLREQUESTINFO_INTERFACE_1_0) == 0) - return ::ppapi::thunk::GetPPB_URLRequestInfo_Thunk(); - if (strcmp(name, PPB_URLRESPONSEINFO_INTERFACE_1_0) == 0) - return ::ppapi::thunk::GetPPB_URLResponseInfo_Thunk(); if (strcmp(name, PPB_URLUTIL_DEV_INTERFACE) == 0) return PPB_URLUtil_Impl::GetInterface(); if (strcmp(name, PPB_VAR_DEPRECATED_INTERFACE) == 0) return PPB_Var_Impl::GetVarDeprecatedInterface(); if (strcmp(name, PPB_VAR_INTERFACE_1_0) == 0) return PPB_Var_Impl::GetVarInterface(); - if (strcmp(name, PPB_VIDEODECODER_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_VideoDecoder_Thunk(); - if (strcmp(name, PPB_VIDEO_CAPTURE_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_VideoCapture_Thunk(); if (strcmp(name, PPB_VIDEOLAYER_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_VideoLayer_Thunk(); - if (strcmp(name, PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0) == 0) - return ::ppapi::thunk::GetPPB_WheelInputEvent_Thunk(); + return ::ppapi::thunk::GetPPB_VideoLayer_Dev_Thunk(); if (strcmp(name, PPB_WIDGET_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_Widget_Thunk(); + return ::ppapi::thunk::GetPPB_Widget_Dev_Thunk(); if (strcmp(name, PPB_ZOOM_DEV_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_Zoom_Thunk(); -#ifdef ENABLE_GPU - if (strcmp(name, PPB_GRAPHICS_3D_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_Graphics3D_Thunk(); - if (strcmp(name, PPB_GRAPHICS_3D_TRUSTED_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_Graphics3DTrusted_Thunk(); - if (strcmp(name, PPB_CONTEXT_3D_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_Context3D_Thunk(); - if (strcmp(name, PPB_CONTEXT_3D_TRUSTED_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_Context3DTrusted_Thunk(); - if (strcmp(name, PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_GLESChromiumTextureMapping_Thunk(); - if (strcmp(name, PPB_OPENGLES2_INTERFACE) == 0) - return PPB_OpenGLES_Impl::GetInterface(); - if (strcmp(name, PPB_SURFACE_3D_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_Surface3D_Thunk(); - if (strcmp(name, PPB_LAYER_COMPOSITOR_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_LayerCompositor_Thunk(); -#endif // ENABLE_GPU - #ifdef ENABLE_FLAPPER_HACKS if (strcmp(name, PPB_FLASH_NETCONNECTOR_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_Flash_NetConnector_Thunk(); @@ -373,7 +323,7 @@ const void* GetInterface(const char* name) { #if defined(ENABLE_P2P_APIS) if (strcmp(name, PPB_TRANSPORT_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_Transport_Thunk(); + return ::ppapi::thunk::GetPPB_Transport_Dev_Thunk(); #endif // Only support the testing interface when the command line switch is diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index b18df2c..df52f19 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -9,6 +9,7 @@ #include "base/message_loop.h" #include "base/metrics/histogram.h" #include "base/utf_string_conversions.h" +#include "ppapi/c/dev/ppb_console_dev.h" #include "ppapi/c/dev/ppb_find_dev.h" #include "ppapi/c/dev/ppb_fullscreen_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" @@ -38,6 +39,7 @@ #include "printing/units.h" #include "skia/ext/platform_canvas.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" @@ -104,6 +106,7 @@ using ppapi::thunk::PPB_Surface3D_API; using ppapi::Var; using WebKit::WebBindings; using WebKit::WebCanvas; +using WebKit::WebConsoleMessage; using WebKit::WebCursorInfo; using WebKit::WebDocument; using WebKit::WebFrame; @@ -1442,6 +1445,49 @@ PP_Var PluginInstance::ExecuteScript(PP_Instance instance, return ret; } +void PluginInstance::Log(PP_Instance instance, + int log_level, + PP_Var value) { + // TODO(brettw) get the plugin name and use it as the source. + LogWithSource(instance, log_level, PP_MakeUndefined(), value); +} + +void PluginInstance::LogWithSource(PP_Instance instance, + int log_level, + PP_Var source, + PP_Var value) { + // Convert the log level, defaulting to error. + WebConsoleMessage::Level web_level; + switch (log_level) { + case PP_LOGLEVEL_TIP: + web_level = WebConsoleMessage::LevelTip; + break; + case PP_LOGLEVEL_LOG: + web_level = WebConsoleMessage::LevelLog; + break; + case PP_LOGLEVEL_WARNING: + web_level = WebConsoleMessage::LevelWarning; + break; + case PP_LOGLEVEL_ERROR: + default: + web_level = WebConsoleMessage::LevelError; + break; + } + + // Format is the "<source>: <value>". The source defaults to the module name + // if the source isn't a string or is empty. + std::string message; + if (source.type == PP_VARTYPE_STRING) + message = Var::PPVarToLogString(source); + if (message.empty()) + message = module()->name(); + message.append(": "); + message.append(Var::PPVarToLogString(value)); + + container()->element().document().frame()->addMessageToConsole( + WebConsoleMessage(web_level, WebString(UTF8ToUTF16(message)))); +} + PP_Bool PluginInstance::IsFullscreen(PP_Instance instance) { return PP_FromBool(fullscreen_); } diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h index 48f9019..643828a 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.h +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h @@ -264,6 +264,13 @@ class PluginInstance : public base::RefCounted<PluginInstance>, virtual PP_Var ExecuteScript(PP_Instance instance, PP_Var script, PP_Var* exception) OVERRIDE; + virtual void Log(PP_Instance instance, + int log_level, + PP_Var value) OVERRIDE; + virtual void LogWithSource(PP_Instance instance, + int log_level, + PP_Var source, + PP_Var value) OVERRIDE; virtual PP_Bool IsFullscreen(PP_Instance instance) OVERRIDE; virtual PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) OVERRIDE; diff --git a/webkit/plugins/ppapi/ppb_console_impl.cc b/webkit/plugins/ppapi/ppb_console_impl.cc deleted file mode 100644 index 1b08ebf..0000000 --- a/webkit/plugins/ppapi/ppb_console_impl.cc +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "webkit/plugins/ppapi/ppb_console_impl.h" - -#include "base/string_util.h" -#include "base/utf_string_conversions.h" -#include "ppapi/c/dev/ppb_console_dev.h" -#include "ppapi/shared_impl/var.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" -#include "webkit/plugins/ppapi/plugin_module.h" -#include "webkit/plugins/ppapi/ppapi_plugin_instance.h" -#include "webkit/plugins/ppapi/resource_tracker.h" - -using ppapi::Var; -using WebKit::WebConsoleMessage; -using WebKit::WebString; - -namespace webkit { -namespace ppapi { - -namespace { - -void LogWithSource(PP_Instance instance_id, - PP_LogLevel_Dev level, - PP_Var source, - PP_Var value) { - PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); - if (!instance) - return; - - // Convert the log level, defaulting to error. - WebConsoleMessage::Level web_level; - switch (level) { - case PP_LOGLEVEL_TIP: - web_level = WebConsoleMessage::LevelTip; - break; - case PP_LOGLEVEL_LOG: - web_level = WebConsoleMessage::LevelLog; - break; - case PP_LOGLEVEL_WARNING: - web_level = WebConsoleMessage::LevelWarning; - break; - case PP_LOGLEVEL_ERROR: - default: - web_level = WebConsoleMessage::LevelError; - break; - } - - // Format is the "<source>: <value>". The source defaults to the module name - // if the source isn't a string or is empty. - std::string message; - if (source.type == PP_VARTYPE_STRING) - message = Var::PPVarToLogString(source); - if (message.empty()) - message = instance->module()->name(); - message.append(": "); - message.append(Var::PPVarToLogString(value)); - - instance->container()->element().document().frame()->addMessageToConsole( - WebConsoleMessage(web_level, WebString(UTF8ToUTF16(message)))); -} - -void Log(PP_Instance instance, PP_LogLevel_Dev level, PP_Var value) { - LogWithSource(instance, level, PP_MakeUndefined(), value); -} - -const PPB_Console_Dev ppb_console = { - &Log, - &LogWithSource -}; - -} // namespace - -// static -const struct PPB_Console_Dev* PPB_Console_Impl::GetInterface() { - return &ppb_console; -} - -} // namespace ppapi -} // namespace webkit - diff --git a/webkit/plugins/ppapi/ppb_console_impl.h b/webkit/plugins/ppapi/ppb_console_impl.h deleted file mode 100644 index 2d47587..0000000 --- a/webkit/plugins/ppapi/ppb_console_impl.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_PLUGINS_PPAPI_PPB_CONSOLE_IMPL_H_ -#define WEBKIT_PLUGINS_PPAPI_PPB_CONSOLE_IMPL_H_ - -struct PPB_Console_Dev; - -namespace webkit { -namespace ppapi { - -class PPB_Console_Impl { - public: - // Returns a pointer to the interface implementing PPB_Console_Dev that is - // exposed to the plugin. - static const PPB_Console_Dev* GetInterface(); -}; - -} // namespace ppapi -} // namespace webkit - -#endif // WEBKIT_PLUGINS_PPAPI_PPB_CONSOLE_IMPL_H_ diff --git a/webkit/plugins/ppapi/ppb_url_request_info_impl.cc b/webkit/plugins/ppapi/ppb_url_request_info_impl.cc index 0ebffb7..358c533 100644 --- a/webkit/plugins/ppapi/ppb_url_request_info_impl.cc +++ b/webkit/plugins/ppapi/ppb_url_request_info_impl.cc @@ -129,7 +129,8 @@ bool PPB_URLRequestInfo_Impl::ToWebURLRequest(WebFrame* frame, return false; dest->initialize(); - dest->setURL(frame->document().completeURL(WebString::fromUTF8(data().url))); + dest->setURL(frame->document().completeURL(WebString::fromUTF8( + data().url))); dest->setDownloadToFile(data().stream_to_file); dest->setReportUploadProgress(data().record_upload_progress); |