diff options
19 files changed, 381 insertions, 145 deletions
diff --git a/ppapi/api/private/ppb_flash_file.idl b/ppapi/api/private/finish_writing_these/ppb_flash_file.idl index 6ad1a8a..6ad1a8a 100644 --- a/ppapi/api/private/ppb_flash_file.idl +++ b/ppapi/api/private/finish_writing_these/ppb_flash_file.idl diff --git a/ppapi/api/private/ppb_flash_menu.idl b/ppapi/api/private/finish_writing_these/ppb_flash_menu.idl index df6aa44..df6aa44 100644 --- a/ppapi/api/private/ppb_flash_menu.idl +++ b/ppapi/api/private/finish_writing_these/ppb_flash_menu.idl diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/finish_writing_these/ppb_nacl_private.idl index 2642a8e..2642a8e 100644 --- a/ppapi/api/private/ppb_nacl_private.idl +++ b/ppapi/api/private/finish_writing_these/ppb_nacl_private.idl diff --git a/ppapi/api/private/ppb_pdf.idl b/ppapi/api/private/finish_writing_these/ppb_pdf.idl index 3a6094f..3a6094f 100644 --- a/ppapi/api/private/ppb_pdf.idl +++ b/ppapi/api/private/finish_writing_these/ppb_pdf.idl diff --git a/ppapi/api/private/ppb_proxy_private.idl b/ppapi/api/private/finish_writing_these/ppb_proxy_private.idl index b455636..b455636 100644 --- a/ppapi/api/private/ppb_proxy_private.idl +++ b/ppapi/api/private/finish_writing_these/ppb_proxy_private.idl diff --git a/ppapi/api/private/ppb_file_ref_private.idl b/ppapi/api/private/ppb_file_ref_private.idl index 7ce053a..0b0da72 100644 --- a/ppapi/api/private/ppb_file_ref_private.idl +++ b/ppapi/api/private/ppb_file_ref_private.idl @@ -3,7 +3,10 @@ * found in the LICENSE file. */ -/* This file contains PPB_FileRefPrivate interface. */ +/* This file contains the <code>PPB_FileRefPrivate</code> interface. */ +label Chrome { + M15 = 0.1 +}; /* PPB_FileRefPrivate interface */ interface PPB_FileRefPrivate { diff --git a/ppapi/api/private/ppb_flash.idl b/ppapi/api/private/ppb_flash.idl index 55a3862..81960a7 100644 --- a/ppapi/api/private/ppb_flash.idl +++ b/ppapi/api/private/ppb_flash.idl @@ -3,11 +3,21 @@ * found in the LICENSE file. */ -/* This file contains PPB_Flash interface. */ +/** + * This file contains the <code>PPB_Flash</code> interface. + */ + +label Chrome { + M17 = 12.0 +}; -/* PPB_Flash interface. */ -interface PPB_Flash_0_7 { - /* Sets or clears the rendering hint that the given plugin instance is always +/** + * The <code>PPB_Flash</code> interface contains pointers to various functions + * that are only needed to support Pepper Flash. + */ +interface PPB_Flash { + /** + * Sets or clears the rendering hint that the given plugin instance is always * on top of page content. Somewhat more optimized painting can be used in * this case. */ @@ -15,6 +25,14 @@ interface PPB_Flash_0_7 { [in] PP_Instance instance, [in] PP_Bool on_top); + /** + * Draws the given pre-laid-out text. It is almost equivalent to Windows' + * ExtTextOut with the addition of the transformation (a 3x3 matrix given the + * transform to apply before drawing). It also adds the allow_subpixel_aa + * flag which when true, will use subpixel antialiasing if enabled in the + * system settings. For this to work properly, the graphics layer that the + * text is being drawn into must be opaque. + */ PP_Bool DrawGlyphs( [in] PP_Instance instance, [in] PP_Resource pp_image_data, @@ -23,27 +41,30 @@ interface PPB_Flash_0_7 { [in] PP_Point position, [in] PP_Rect clip, [in] float_t[3][3] transformation, + [in] PP_Bool allow_subpixel_aa, [in] uint32_t glyph_count, [in, size_is(glyph_count)] uint16_t[] glyph_indices, [in, size_is(glyph_count)] PP_Point[] glyph_advances); - /* Retrieves the proxy that will be used for the given URL. The result will + /** + * Retrieves the proxy that will be used for the given URL. The result will * be a string in PAC format, or an undefined var on error. */ PP_Var GetProxyForURL( [in] PP_Instance instance, [in] str_t url); - /* Navigate to URL. May open a new tab if target is not "_self". Return true - * if success. This differs from javascript:window.open() in that it bypasses - * the popup blocker, even when this is not called from an event handler. + /** + * Navigate to the URL given by the given URLRequestInfo. (This supports GETs, + * POSTs, and javascript: URLs.) May open a new tab if target is not "_self". */ - PP_Bool NavigateToURL( - [in] PP_Instance instance, - [in] str_t url, - [in] str_t target); + int32_t Navigate( + [in] PP_Resource request_info, + [in] str_t target, + [in] PP_Bool from_user_action); - /* Runs a nested message loop. The plugin will be reentered from this call. + /** + * Runs a nested message loop. The plugin will be reentered from this call. * This function is used in places where Flash would normally enter a nested * message loop (e.g., when displaying context menus), but Pepper provides * only an asynchronous call. After performing that asynchronous call, call @@ -57,4 +78,59 @@ interface PPB_Flash_0_7 { */ void QuitMessageLoop( [in] PP_Instance instance); + + /** + * Retrieves the local time zone offset from GM time for the given UTC time. + */ + double_t GetLocalTimeZoneOffset( + [in] PP_Instance instance, + [in] PP_Time t); + + /** + * Gets a (string) with "command-line" options for Flash; used to pass + * run-time debugging parameters, etc. + */ + PP_Var GetCommandLineArgs( + [in] PP_Module module); + + /** + * Loads the given font in a more priviledged process on Windows. Call this if + * Windows is giving errors for font calls. See + * content/renderer/font_cache_dispatcher_win.cc + * + * The parameter is a pointer to a LOGFONTW structure. + * + * On non-Windows platforms, this function does nothing. + */ + void PreloadFontWin( + [in] mem_t logfontw); +}; + +#inline c +/** + * The old version of the interface, which cannot be generated from IDL. + * TODO(viettrungluu): Remove this when enough time has passed. crbug.com/104184 + */ +#define PPB_FLASH_INTERFACE_11_0 "PPB_Flash;11" +struct PPB_Flash_11 { + void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top); + PP_Bool (*DrawGlyphs)(PP_Instance instance, + PP_Resource pp_image_data, + const struct PP_FontDescription_Dev* font_desc, + uint32_t color, + struct PP_Point position, + struct PP_Rect clip, + const float transformation[3][3], + uint32_t glyph_count, + const uint16_t glyph_indices[], + const struct PP_Point glyph_advances[]); + struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url); + int32_t (*Navigate)(PP_Resource request_info, + const char* target, + bool from_user_action); + void (*RunMessageLoop)(PP_Instance instance); + void (*QuitMessageLoop)(PP_Instance instance); + double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t); + struct PP_Var (*GetCommandLineArgs)(PP_Module module); }; +#endinl diff --git a/ppapi/c/private/ppb_file_ref_private.h b/ppapi/c/private/ppb_file_ref_private.h index ea1dabe..43c1cfe 100644 --- a/ppapi/c/private/ppb_file_ref_private.h +++ b/ppapi/c/private/ppb_file_ref_private.h @@ -3,11 +3,15 @@ * found in the LICENSE file. */ +/* From private/ppb_file_ref_private.idl modified Mon Dec 12 14:04:17 2011. */ + #ifndef PPAPI_C_PRIVATE_PPB_FILE_REF_PRIVATE_H_ #define PPAPI_C_PRIVATE_PPB_FILE_REF_PRIVATE_H_ +#include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_var.h" #define PPB_FILEREFPRIVATE_INTERFACE_0_1 "PPB_FileRefPrivate;0.1" @@ -15,8 +19,7 @@ /** * @file - * This file contains the <code>PPB_FileRefPrivate</code> interface. - */ + * This file contains the <code>PPB_FileRefPrivate</code> interface. */ /** @@ -40,3 +43,4 @@ struct PPB_FileRefPrivate { */ #endif /* PPAPI_C_PRIVATE_PPB_FILE_REF_PRIVATE_H_ */ + diff --git a/ppapi/c/private/ppb_flash.h b/ppapi/c/private/ppb_flash.h index d0bff42..9d33247 100644 --- a/ppapi/c/private/ppb_flash.h +++ b/ppapi/c/private/ppb_flash.h @@ -1,90 +1,142 @@ -/* 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 PPAPI_C_PRIVATE_PPB_FLASH_H_ -#define PPAPI_C_PRIVATE_PPB_FLASH_H_ - -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_module.h" -#include "ppapi/c/pp_point.h" -#include "ppapi/c/pp_rect.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_time.h" -#include "ppapi/c/pp_var.h" - -#define PPB_FLASH_INTERFACE "PPB_Flash;11" - -/** - * @file - * This file contains the <code>PPB_Flash</code> interface. - */ - - -/** - * @addtogroup Interfaces - * @{ - */ -/** - * The <code>PPB_Flash</code> interface contains pointers to various functions - * that are only needed to support Pepper Flash. - */ -struct PPB_Flash { - /** - * Sets or clears the rendering hint that the given plugin instance is always - * on top of page content. Somewhat more optimized painting can be used in - * this case. - */ - void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top); - PP_Bool (*DrawGlyphs)(PP_Instance instance, - PP_Resource pp_image_data, - const struct PP_FontDescription_Dev* font_desc, - uint32_t color, - struct PP_Point position, - struct PP_Rect clip, - const float transformation[3][3], - uint32_t glyph_count, - const uint16_t glyph_indices[], - const struct PP_Point glyph_advances[]); - /** - * Retrieves the proxy that will be used for the given URL. The result will - * be a string in PAC format, or an undefined var on error. - */ - struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url); - /** - * Navigate to the URL given by the given URLRequestInfo. (This supports GETs, - * POSTs, and javascript: URLs.) May open a new tab if target is not "_self". - */ - int32_t (*Navigate)(PP_Resource request_info, - const char* target, - bool from_user_action); - /** - * Runs a nested message loop. The plugin will be reentered from this call. - * This function is used in places where Flash would normally enter a nested - * message loop (e.g., when displaying context menus), but Pepper provides - * only an asynchronous call. After performing that asynchronous call, call - * |RunMessageLoop()|. In the callback, call |QuitMessageLoop()|. - */ - void (*RunMessageLoop)(PP_Instance instance); - /** - * Posts a quit message for the outermost nested message loop. Use this to - * exit and return back to the caller after you call RunMessageLoop. - */ - void (*QuitMessageLoop)(PP_Instance instance); - /** - * Retrieves the local time zone offset from GM time for the given UTC time. - */ - double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t); - /** - * Gets a (string) with "command-line" options for Flash; used to pass - * run-time debugging parameters, etc. - */ - struct PP_Var (*GetCommandLineArgs)(PP_Module module); -}; -/** - * @} - */ - -#endif /* PPAPI_C_PRIVATE_PPB_FLASH_H_ */ +/* 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.
+ */
+
+/* From private/ppb_flash.idl modified Wed Dec 14 13:56:17 2011. */
+
+#ifndef PPAPI_C_PRIVATE_PPB_FLASH_H_
+#define PPAPI_C_PRIVATE_PPB_FLASH_H_
+
+#include "ppapi/c/dev/ppb_font_dev.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_module.h"
+#include "ppapi/c/pp_point.h"
+#include "ppapi/c/pp_rect.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_size.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/pp_time.h"
+#include "ppapi/c/pp_var.h"
+
+#define PPB_FLASH_INTERFACE_12_0 "PPB_Flash;12.0"
+#define PPB_FLASH_INTERFACE PPB_FLASH_INTERFACE_12_0
+
+/**
+ * @file
+ * This file contains the <code>PPB_Flash</code> interface.
+ */
+
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+/**
+ * The <code>PPB_Flash</code> interface contains pointers to various functions
+ * that are only needed to support Pepper Flash.
+ */
+struct PPB_Flash {
+ /**
+ * Sets or clears the rendering hint that the given plugin instance is always
+ * on top of page content. Somewhat more optimized painting can be used in
+ * this case.
+ */
+ void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top);
+ /**
+ * Draws the given pre-laid-out text. It is almost equivalent to Windows'
+ * ExtTextOut with the addition of the transformation (a 3x3 matrix given the
+ * transform to apply before drawing). It also adds the allow_subpixel_aa
+ * flag which when true, will use subpixel antialiasing if enabled in the
+ * system settings. For this to work properly, the graphics layer that the
+ * text is being drawn into must be opaque.
+ */
+ PP_Bool (*DrawGlyphs)(PP_Instance instance,
+ PP_Resource pp_image_data,
+ const struct PP_FontDescription_Dev* font_desc,
+ uint32_t color,
+ const struct PP_Point* position,
+ const struct PP_Rect* clip,
+ const float transformation[3][3],
+ PP_Bool allow_subpixel_aa,
+ uint32_t glyph_count,
+ const uint16_t glyph_indices[],
+ const struct PP_Point glyph_advances[]);
+ /**
+ * Retrieves the proxy that will be used for the given URL. The result will
+ * be a string in PAC format, or an undefined var on error.
+ */
+ struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url);
+ /**
+ * Navigate to the URL given by the given URLRequestInfo. (This supports GETs,
+ * POSTs, and javascript: URLs.) May open a new tab if target is not "_self".
+ */
+ int32_t (*Navigate)(PP_Resource request_info,
+ const char* target,
+ PP_Bool from_user_action);
+ /**
+ * Runs a nested message loop. The plugin will be reentered from this call.
+ * This function is used in places where Flash would normally enter a nested
+ * message loop (e.g., when displaying context menus), but Pepper provides
+ * only an asynchronous call. After performing that asynchronous call, call
+ * |RunMessageLoop()|. In the callback, call |QuitMessageLoop()|.
+ */
+ void (*RunMessageLoop)(PP_Instance instance);
+ /* Posts a quit message for the outermost nested message loop. Use this to
+ * exit and return back to the caller after you call RunMessageLoop.
+ */
+ void (*QuitMessageLoop)(PP_Instance instance);
+ /**
+ * Retrieves the local time zone offset from GM time for the given UTC time.
+ */
+ double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t);
+ /**
+ * Gets a (string) with "command-line" options for Flash; used to pass
+ * run-time debugging parameters, etc.
+ */
+ struct PP_Var (*GetCommandLineArgs)(PP_Module module);
+ /**
+ * Loads the given font in a more priviledged process on Windows. Call this if
+ * Windows is giving errors for font calls. See
+ * content/renderer/font_cache_dispatcher_win.cc
+ *
+ * The parameter is a pointer to a LOGFONTW structure.
+ *
+ * On non-Windows platforms, this function does nothing.
+ */
+ void (*PreloadFontWin)(const void* logfontw);
+};
+/**
+ * @}
+ */
+
+/**
+ * The old version of the interface, which cannot be generated from IDL.
+ * TODO(viettrungluu): Remove this when enough time has passed. crbug.com/104184
+ */
+#define PPB_FLASH_INTERFACE_11_0 "PPB_Flash;11"
+struct PPB_Flash_11 {
+ void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top);
+ PP_Bool (*DrawGlyphs)(PP_Instance instance,
+ PP_Resource pp_image_data,
+ const struct PP_FontDescription_Dev* font_desc,
+ uint32_t color,
+ struct PP_Point position,
+ struct PP_Rect clip,
+ const float transformation[3][3],
+ uint32_t glyph_count,
+ const uint16_t glyph_indices[],
+ const struct PP_Point glyph_advances[]);
+ struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url);
+ int32_t (*Navigate)(PP_Resource request_info,
+ const char* target,
+ bool from_user_action);
+ void (*RunMessageLoop)(PP_Instance instance);
+ void (*QuitMessageLoop)(PP_Instance instance);
+ double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t);
+ struct PP_Var (*GetCommandLineArgs)(PP_Module module);
+};
+#endif /* PPAPI_C_PRIVATE_PPB_FLASH_H_ */
+
diff --git a/ppapi/generators/idl_parser.py b/ppapi/generators/idl_parser.py index 0b309e2..43fb967 100644 --- a/ppapi/generators/idl_parser.py +++ b/ppapi/generators/idl_parser.py @@ -1002,7 +1002,7 @@ def TestNamespaceFiles(filter): InfoOut.Log("Passed namespace test.") return errs -default_dirs = ['.', 'trusted', 'dev'] +default_dirs = ['.', 'trusted', 'dev', 'private'] def ParseFiles(filenames): parser = IDLParser() filenodes = [] diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc index 2d5b90b..9cd3e07 100644 --- a/ppapi/proxy/interface_list.cc +++ b/ppapi/proxy/interface_list.cc @@ -248,8 +248,10 @@ const void* InterfaceList::GetInterfaceForPPP(const std::string& name) const { void InterfaceList::AddFlashInterfaces() { AddProxy(API_ID_PPB_FLASH, &ProxyFactory<PPB_Flash_Proxy>); - AddPPB(PPB_FLASH_INTERFACE, API_ID_PPB_FLASH, - PPB_Flash_Proxy::GetInterface()); + AddPPB(PPB_FLASH_INTERFACE_11_0, API_ID_PPB_FLASH, + PPB_Flash_Proxy::GetInterface11()); + AddPPB(PPB_FLASH_INTERFACE_12_0, API_ID_PPB_FLASH, + PPB_Flash_Proxy::GetInterface12()); AddProxy(API_ID_PPB_FLASH_CLIPBOARD, &ProxyFactory<PPB_Flash_Clipboard_Proxy>); diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 67d0166..c424d7d 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -663,7 +663,7 @@ IPC_SYNC_MESSAGE_ROUTED4_1(PpapiHostMsg_PPBFlash_Navigate, PP_Instance /* instance */, ppapi::PPB_URLRequestInfo_Data /* request_data */, std::string /* target */, - bool /* from_user_action */, + PP_Bool /* from_user_action */, int32_t /* result */) IPC_SYNC_MESSAGE_ROUTED1_0(PpapiHostMsg_PPBFlash_RunMessageLoop, PP_Instance /* instance */) diff --git a/ppapi/proxy/ppapi_param_traits.cc b/ppapi/proxy/ppapi_param_traits.cc index ca03910..23d2b72 100644 --- a/ppapi/proxy/ppapi_param_traits.cc +++ b/ppapi/proxy/ppapi_param_traits.cc @@ -212,6 +212,7 @@ void ParamTraits<ppapi::proxy::PPBFlash_DrawGlyphs_Params>::Write( ParamTraits<float>::Write(m, p.transformation[2][0]); ParamTraits<float>::Write(m, p.transformation[2][1]); ParamTraits<float>::Write(m, p.transformation[2][2]); + ParamTraits<PP_Bool>::Write(m, p.allow_subpixel_aa); ParamTraits<std::vector<uint16_t> >::Write(m, p.glyph_indices); ParamTraits<std::vector<PP_Point> >::Write(m, p.glyph_advances); } @@ -238,6 +239,7 @@ bool ParamTraits<ppapi::proxy::PPBFlash_DrawGlyphs_Params>::Read( ParamTraits<float>::Read(m, iter, &r->transformation[2][0]) && ParamTraits<float>::Read(m, iter, &r->transformation[2][1]) && ParamTraits<float>::Read(m, iter, &r->transformation[2][2]) && + ParamTraits<PP_Bool>::Read(m, iter, &r->allow_subpixel_aa) && ParamTraits<std::vector<uint16_t> >::Read(m, iter, &r->glyph_indices) && ParamTraits<std::vector<PP_Point> >::Read(m, iter, &r->glyph_advances) && r->glyph_indices.size() == r->glyph_advances.size(); diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc index 2dcd68b..ae12cd0 100644 --- a/ppapi/proxy/ppb_flash_proxy.cc +++ b/ppapi/proxy/ppb_flash_proxy.cc @@ -43,9 +43,10 @@ PP_Bool DrawGlyphs(PP_Instance instance, PP_Resource pp_image_data, const PP_FontDescription_Dev* font_desc, uint32_t color, - PP_Point position, - PP_Rect clip, + const PP_Point* position, + const PP_Rect* clip, const float transformation[3][3], + PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const PP_Point glyph_advances[]) { @@ -67,12 +68,13 @@ PP_Bool DrawGlyphs(PP_Instance instance, params.image_data = image_data->host_resource(); params.font_desc.SetFromPPFontDescription(dispatcher, *font_desc, true); params.color = color; - params.position = position; - params.clip = clip; + params.position = *position; + params.clip = *clip; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) params.transformation[i][j] = transformation[i][j]; } + params.allow_subpixel_aa = allow_subpixel_aa; params.glyph_indices.insert(params.glyph_indices.begin(), &glyph_indices[0], @@ -87,6 +89,22 @@ PP_Bool DrawGlyphs(PP_Instance instance, return result; } +PP_Bool DrawGlyphs11(PP_Instance instance, + PP_Resource pp_image_data, + const PP_FontDescription_Dev* font_desc, + uint32_t color, + PP_Point position, + PP_Rect clip, + const float transformation[3][3], + uint32_t glyph_count, + const uint16_t glyph_indices[], + const PP_Point glyph_advances[]) { + // Backwards-compatible version. + return DrawGlyphs(instance, pp_image_data, font_desc, color, &position, + &clip, transformation, PP_TRUE, glyph_count, glyph_indices, + glyph_advances); +} + PP_Var GetProxyForURL(PP_Instance instance, const char* url) { PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); if (!dispatcher) @@ -100,7 +118,7 @@ PP_Var GetProxyForURL(PP_Instance instance, const char* url) { int32_t Navigate(PP_Resource request_id, const char* target, - bool from_user_action) { + PP_Bool from_user_action) { thunk::EnterResource<thunk::PPB_URLRequestInfo_API> enter(request_id, true); if (enter.failed()) return PP_ERROR_BADRESOURCE; @@ -118,6 +136,13 @@ int32_t Navigate(PP_Resource request_id, return result; } +int32_t Navigate11(PP_Resource request_id, + const char* target, + bool from_user_action) { + // Backwards-compatible version. + return Navigate(request_id, target, PP_FromBool(from_user_action)); +} + void RunMessageLoop(PP_Instance instance) { PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); if (!dispatcher) @@ -158,20 +183,32 @@ PP_Var GetCommandLineArgs(PP_Module /*pp_module*/) { return StringVar::StringToPPVar(args); } -const PPB_Flash flash_interface = { +void PreLoadFontInWindows(const void* logfontw) { + // TODO(brettw) implement this. +} + +const PPB_Flash_11 flash_interface_11 = { &SetInstanceAlwaysOnTop, - &DrawGlyphs, + &DrawGlyphs11, &GetProxyForURL, - &Navigate, + &Navigate11, &RunMessageLoop, &QuitMessageLoop, &GetLocalTimeZoneOffset, &GetCommandLineArgs }; -InterfaceProxy* CreateFlashProxy(Dispatcher* dispatcher) { - return new PPB_Flash_Proxy(dispatcher); -} +const PPB_Flash flash_interface_12 = { + &SetInstanceAlwaysOnTop, + &DrawGlyphs, + &GetProxyForURL, + &Navigate, + &RunMessageLoop, + &QuitMessageLoop, + &GetLocalTimeZoneOffset, + &GetCommandLineArgs, + &PreLoadFontInWindows +}; } // namespace @@ -187,8 +224,13 @@ PPB_Flash_Proxy::~PPB_Flash_Proxy() { } // static -const PPB_Flash* PPB_Flash_Proxy::GetInterface() { - return &flash_interface; +const PPB_Flash_11* PPB_Flash_Proxy::GetInterface11() { + return &flash_interface_11; +} + +// static +const PPB_Flash* PPB_Flash_Proxy::GetInterface12() { + return &flash_interface_12; } bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) { @@ -238,8 +280,9 @@ void PPB_Flash_Proxy::OnMsgDrawGlyphs(const PPBFlash_DrawGlyphs_Params& params, *result = ppb_flash_impl_->DrawGlyphs( 0, // Unused instance param. params.image_data.host_resource(), &font_desc, - params.color, params.position, params.clip, + params.color, ¶ms.position, ¶ms.clip, const_cast<float(*)[3]>(params.transformation), + params.allow_subpixel_aa, static_cast<uint32_t>(params.glyph_indices.size()), const_cast<uint16_t*>(¶ms.glyph_indices[0]), const_cast<PP_Point*>(¶ms.glyph_advances[0])); @@ -255,7 +298,7 @@ void PPB_Flash_Proxy::OnMsgGetProxyForURL(PP_Instance instance, void PPB_Flash_Proxy::OnMsgNavigate(PP_Instance instance, const PPB_URLRequestInfo_Data& data, const std::string& target, - bool from_user_action, + PP_Bool from_user_action, int32_t* result) { DCHECK(!dispatcher()->IsPlugin()); diff --git a/ppapi/proxy/ppb_flash_proxy.h b/ppapi/proxy/ppb_flash_proxy.h index 8151d23..1939b22 100644 --- a/ppapi/proxy/ppb_flash_proxy.h +++ b/ppapi/proxy/ppb_flash_proxy.h @@ -9,6 +9,7 @@ #include <vector> #include "ipc/ipc_platform_file.h" +#include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_module.h" #include "ppapi/c/pp_time.h" @@ -16,6 +17,7 @@ #include "ppapi/shared_impl/host_resource.h" struct PPB_Flash; +struct PPB_Flash_11; namespace ppapi { @@ -31,7 +33,9 @@ class PPB_Flash_Proxy : public InterfaceProxy { explicit PPB_Flash_Proxy(Dispatcher* dispatcher); virtual ~PPB_Flash_Proxy(); - static const PPB_Flash* GetInterface(); + // Returns the corresponding version of the Flash interface pointer. + static const PPB_Flash_11* GetInterface11(); + static const PPB_Flash* GetInterface12(); // InterfaceProxy implementation. virtual bool OnMessageReceived(const IPC::Message& msg); @@ -48,7 +52,7 @@ class PPB_Flash_Proxy : public InterfaceProxy { void OnMsgNavigate(PP_Instance instance, const PPB_URLRequestInfo_Data& data, const std::string& target, - bool from_user_action, + PP_Bool from_user_action, int32_t* result); void OnMsgRunMessageLoop(PP_Instance instance); void OnMsgQuitMessageLoop(PP_Instance instance); diff --git a/ppapi/proxy/serialized_structs.h b/ppapi/proxy/serialized_structs.h index ea85757..4007c3b 100644 --- a/ppapi/proxy/serialized_structs.h +++ b/ppapi/proxy/serialized_structs.h @@ -81,6 +81,7 @@ struct PPBFlash_DrawGlyphs_Params { PP_Point position; PP_Rect clip; float transformation[3][3]; + PP_Bool allow_subpixel_aa; std::vector<uint16_t> glyph_indices; std::vector<PP_Point> glyph_advances; }; diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index 1b723a6..d86c222 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -286,8 +286,10 @@ const void* GetInterface(const char* name) { return &core_interface; if (strcmp(name, PPB_FILECHOOSER_TRUSTED_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_FileChooser_Trusted_Thunk(); - if (strcmp(name, PPB_FLASH_INTERFACE) == 0) - return PPB_Flash_Impl::GetInterface(); + if (strcmp(name, PPB_FLASH_INTERFACE_11_0) == 0) + return PPB_Flash_Impl::GetInterface11(); + if (strcmp(name, PPB_FLASH_INTERFACE_12_0) == 0) + return PPB_Flash_Impl::GetInterface12(); if (strcmp(name, PPB_FLASH_CLIPBOARD_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_Flash_Clipboard_Thunk(); if (strcmp(name, PPB_FLASH_CLIPBOARD_INTERFACE_3_LEGACY) == 0) diff --git a/webkit/plugins/ppapi/ppb_flash_impl.cc b/webkit/plugins/ppapi/ppb_flash_impl.cc index a9e244d..0314a6b 100644 --- a/webkit/plugins/ppapi/ppb_flash_impl.cc +++ b/webkit/plugins/ppapi/ppb_flash_impl.cc @@ -55,9 +55,10 @@ PP_Bool DrawGlyphs(PP_Instance, PP_Resource pp_image_data, const PP_FontDescription_Dev* font_desc, uint32_t color, - PP_Point position, - PP_Rect clip, + const PP_Point* position, + const PP_Rect* clip, const float transformation[3][3], + PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const PP_Point glyph_advances[]) { @@ -91,9 +92,9 @@ PP_Bool DrawGlyphs(PP_Instance, canvas->save(); // Clip is applied in pixels before the transform. - SkRect clip_rect = { clip.point.x, clip.point.y, - clip.point.x + clip.size.width, - clip.point.y + clip.size.height }; + SkRect clip_rect = { clip->point.x, clip->point.y, + clip->point.x + clip->size.width, + clip->point.y + clip->size.height }; canvas->clipRect(clip_rect); // -- Do not return early below this. The canvas needs restoring and the @@ -120,11 +121,13 @@ PP_Bool DrawGlyphs(PP_Instance, paint.setHinting(SkPaint::kFull_Hinting); paint.setTextSize(SkIntToScalar(font_desc->size)); paint.setTypeface(typeface); // Takes a ref and manages lifetime. - paint.setSubpixelText(true); - paint.setLCDRenderText(true); + if (allow_subpixel_aa) { + paint.setSubpixelText(true); + paint.setLCDRenderText(true); + } - SkScalar x = SkIntToScalar(position.x); - SkScalar y = SkIntToScalar(position.y); + SkScalar x = SkIntToScalar(position->x); + SkScalar y = SkIntToScalar(position->y); // Build up the skia advances. if (glyph_count == 0) @@ -144,6 +147,21 @@ PP_Bool DrawGlyphs(PP_Instance, return PP_TRUE; } +PP_Bool DrawGlyphs11(PP_Instance instance, + PP_Resource pp_image_data, + const PP_FontDescription_Dev* font_desc, + uint32_t color, + PP_Point position, + PP_Rect clip, + const float transformation[3][3], + uint32_t glyph_count, + const uint16_t glyph_indices[], + const PP_Point glyph_advances[]) { + return DrawGlyphs(instance, pp_image_data, font_desc, color, &position, + &clip, transformation, PP_TRUE, glyph_count, + glyph_indices, glyph_advances); +} + PP_Var GetProxyForURL(PP_Instance pp_instance, const char* url) { PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); if (!instance) @@ -161,7 +179,7 @@ PP_Var GetProxyForURL(PP_Instance pp_instance, const char* url) { int32_t Navigate(PP_Resource request_id, const char* target, - bool from_user_action) { + PP_Bool from_user_action) { EnterResource<PPB_URLRequestInfo_API> enter(request_id, true); if (enter.failed()) return PP_ERROR_BADRESOURCE; @@ -174,7 +192,14 @@ int32_t Navigate(PP_Resource request_id, PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(request); if (!plugin_instance) return PP_ERROR_FAILED; - return plugin_instance->Navigate(request, target, from_user_action); + return plugin_instance->Navigate(request, target, + PP_ToBool(from_user_action)); +} + +int32_t Navigate11(PP_Resource request_id, + const char* target, + bool from_user_action) { + return Navigate(request_id, target, PP_FromBool(from_user_action)); } void RunMessageLoop(PP_Instance instance) { @@ -219,7 +244,22 @@ PP_Var GetCommandLineArgs(PP_Module pp_module) { return StringVar::StringToPPVar(args); } -const PPB_Flash ppb_flash = { +void PreLoadFontInWindows(const void* logfontw) { + // TODO(brettw) implement this. +} + +const PPB_Flash_11 ppb_flash_11 = { + &SetInstanceAlwaysOnTop, + &DrawGlyphs11, + &GetProxyForURL, + &Navigate11, + &RunMessageLoop, + &QuitMessageLoop, + &GetLocalTimeZoneOffset, + &GetCommandLineArgs +}; + +const PPB_Flash ppb_flash_12 = { &SetInstanceAlwaysOnTop, &DrawGlyphs, &GetProxyForURL, @@ -227,14 +267,20 @@ const PPB_Flash ppb_flash = { &RunMessageLoop, &QuitMessageLoop, &GetLocalTimeZoneOffset, - &GetCommandLineArgs + &GetCommandLineArgs, + &PreLoadFontInWindows }; } // namespace // static -const PPB_Flash* PPB_Flash_Impl::GetInterface() { - return &ppb_flash; +const PPB_Flash_11* PPB_Flash_Impl::GetInterface11() { + return &ppb_flash_11; +} + +// static +const PPB_Flash* PPB_Flash_Impl::GetInterface12() { + return &ppb_flash_12; } } // namespace ppapi diff --git a/webkit/plugins/ppapi/ppb_flash_impl.h b/webkit/plugins/ppapi/ppb_flash_impl.h index 28faacd..b9b00aa 100644 --- a/webkit/plugins/ppapi/ppb_flash_impl.h +++ b/webkit/plugins/ppapi/ppb_flash_impl.h @@ -18,7 +18,8 @@ class PPB_Flash_Impl { public: // Returns a pointer to the interface implementing PPB_Flash that is // exposed to the plugin. - static const PPB_Flash* GetInterface(); + static const PPB_Flash_11* GetInterface11(); + static const PPB_Flash* GetInterface12(); private: DISALLOW_COPY_AND_ASSIGN(PPB_Flash_Impl); |