Commit 2e4361ae authored by brettw@chromium.org's avatar brettw@chromium.org

Rev the Flash interface to add new functionality.

This adds support for IDL in the private directory. Some of the interfaces there don't actually work, they were a work in progress and this breaks everything, so I moved the broken files to a new subdirectory. Everything left in the api/private directory can be autogenerated now.

BUG=
TEST=

Review URL: http://codereview.chromium.org/8930023

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114534 0039d316-1c4b-4281-b951-d872f2087c98
parent e5aea01b
...@@ -3,7 +3,10 @@ ...@@ -3,7 +3,10 @@
* found in the LICENSE file. * 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 */ /* PPB_FileRefPrivate interface */
interface PPB_FileRefPrivate { interface PPB_FileRefPrivate {
......
...@@ -3,11 +3,21 @@ ...@@ -3,11 +3,21 @@
* found in the LICENSE file. * 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 { * The <code>PPB_Flash</code> interface contains pointers to various functions
/* Sets or clears the rendering hint that the given plugin instance is always * 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 * on top of page content. Somewhat more optimized painting can be used in
* this case. * this case.
*/ */
...@@ -15,6 +25,14 @@ interface PPB_Flash_0_7 { ...@@ -15,6 +25,14 @@ interface PPB_Flash_0_7 {
[in] PP_Instance instance, [in] PP_Instance instance,
[in] PP_Bool on_top); [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( PP_Bool DrawGlyphs(
[in] PP_Instance instance, [in] PP_Instance instance,
[in] PP_Resource pp_image_data, [in] PP_Resource pp_image_data,
...@@ -23,27 +41,30 @@ interface PPB_Flash_0_7 { ...@@ -23,27 +41,30 @@ interface PPB_Flash_0_7 {
[in] PP_Point position, [in] PP_Point position,
[in] PP_Rect clip, [in] PP_Rect clip,
[in] float_t[3][3] transformation, [in] float_t[3][3] transformation,
[in] PP_Bool allow_subpixel_aa,
[in] uint32_t glyph_count, [in] uint32_t glyph_count,
[in, size_is(glyph_count)] uint16_t[] glyph_indices, [in, size_is(glyph_count)] uint16_t[] glyph_indices,
[in, size_is(glyph_count)] PP_Point[] glyph_advances); [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. * be a string in PAC format, or an undefined var on error.
*/ */
PP_Var GetProxyForURL( PP_Var GetProxyForURL(
[in] PP_Instance instance, [in] PP_Instance instance,
[in] str_t url); [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 * Navigate to the URL given by the given URLRequestInfo. (This supports GETs,
* the popup blocker, even when this is not called from an event handler. * POSTs, and javascript: URLs.) May open a new tab if target is not "_self".
*/ */
PP_Bool NavigateToURL( int32_t Navigate(
[in] PP_Instance instance, [in] PP_Resource request_info,
[in] str_t url, [in] str_t target,
[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 * This function is used in places where Flash would normally enter a nested
* message loop (e.g., when displaying context menus), but Pepper provides * message loop (e.g., when displaying context menus), but Pepper provides
* only an asynchronous call. After performing that asynchronous call, call * only an asynchronous call. After performing that asynchronous call, call
...@@ -57,4 +78,59 @@ interface PPB_Flash_0_7 { ...@@ -57,4 +78,59 @@ interface PPB_Flash_0_7 {
*/ */
void QuitMessageLoop( void QuitMessageLoop(
[in] PP_Instance instance); [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
...@@ -3,11 +3,15 @@ ...@@ -3,11 +3,15 @@
* found in the LICENSE file. * 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_ #ifndef PPAPI_C_PRIVATE_PPB_FILE_REF_PRIVATE_H_
#define 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_macros.h"
#include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/pp_var.h" #include "ppapi/c/pp_var.h"
#define PPB_FILEREFPRIVATE_INTERFACE_0_1 "PPB_FileRefPrivate;0.1" #define PPB_FILEREFPRIVATE_INTERFACE_0_1 "PPB_FileRefPrivate;0.1"
...@@ -15,8 +19,7 @@ ...@@ -15,8 +19,7 @@
/** /**
* @file * @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 { ...@@ -40,3 +43,4 @@ struct PPB_FileRefPrivate {
*/ */
#endif /* PPAPI_C_PRIVATE_PPB_FILE_REF_PRIVATE_H_ */ #endif /* PPAPI_C_PRIVATE_PPB_FILE_REF_PRIVATE_H_ */
/* Copyright (c) 2011 The Chromium Authors. All rights reserved. /* Copyright (c) 2011 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be * Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. * found in the LICENSE file.
*/ */
#ifndef PPAPI_C_PRIVATE_PPB_FLASH_H_ /* From private/ppb_flash.idl modified Wed Dec 14 13:56:17 2011. */
#define PPAPI_C_PRIVATE_PPB_FLASH_H_
#ifndef PPAPI_C_PRIVATE_PPB_FLASH_H_
#include "ppapi/c/pp_bool.h" #define PPAPI_C_PRIVATE_PPB_FLASH_H_
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_module.h" #include "ppapi/c/dev/ppb_font_dev.h"
#include "ppapi/c/pp_point.h" #include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_rect.h" #include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_time.h" #include "ppapi/c/pp_module.h"
#include "ppapi/c/pp_var.h" #include "ppapi/c/pp_point.h"
#include "ppapi/c/pp_rect.h"
#define PPB_FLASH_INTERFACE "PPB_Flash;11" #include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_size.h"
/** #include "ppapi/c/pp_stdint.h"
* @file #include "ppapi/c/pp_time.h"
* This file contains the <code>PPB_Flash</code> interface. #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
/**
* @addtogroup Interfaces /**
* @{ * @file
*/ * This file contains the <code>PPB_Flash</code> interface.
/** */
* The <code>PPB_Flash</code> interface contains pointers to various functions
* that are only needed to support Pepper Flash.
*/ /**
struct PPB_Flash { * @addtogroup Interfaces
/** * @{
* 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. * The <code>PPB_Flash</code> interface contains pointers to various functions
*/ * that are only needed to support Pepper Flash.
void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top); */
PP_Bool (*DrawGlyphs)(PP_Instance instance, struct PPB_Flash {
PP_Resource pp_image_data, /**
const struct PP_FontDescription_Dev* font_desc, * Sets or clears the rendering hint that the given plugin instance is always
uint32_t color, * on top of page content. Somewhat more optimized painting can be used in
struct PP_Point position, * this case.
struct PP_Rect clip, */
const float transformation[3][3], void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top);
uint32_t glyph_count, /**
const uint16_t glyph_indices[], * Draws the given pre-laid-out text. It is almost equivalent to Windows'
const struct PP_Point glyph_advances[]); * ExtTextOut with the addition of the transformation (a 3x3 matrix given the
/** * transform to apply before drawing). It also adds the allow_subpixel_aa
* Retrieves the proxy that will be used for the given URL. The result will * flag which when true, will use subpixel antialiasing if enabled in the
* be a string in PAC format, or an undefined var on error. * system settings. For this to work properly, the graphics layer that the
*/ * text is being drawn into must be opaque.
struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url); */
/** PP_Bool (*DrawGlyphs)(PP_Instance instance,
* Navigate to the URL given by the given URLRequestInfo. (This supports GETs, PP_Resource pp_image_data,
* POSTs, and javascript: URLs.) May open a new tab if target is not "_self". const struct PP_FontDescription_Dev* font_desc,
*/ uint32_t color,
int32_t (*Navigate)(PP_Resource request_info, const struct PP_Point* position,
const char* target, const struct PP_Rect* clip,
bool from_user_action); const float transformation[3][3],
/** PP_Bool allow_subpixel_aa,
* Runs a nested message loop. The plugin will be reentered from this call. uint32_t glyph_count,
* This function is used in places where Flash would normally enter a nested const uint16_t glyph_indices[],
* message loop (e.g., when displaying context menus), but Pepper provides const struct PP_Point glyph_advances[]);
* only an asynchronous call. After performing that asynchronous call, call /**
* |RunMessageLoop()|. In the callback, call |QuitMessageLoop()|. * 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.
void (*RunMessageLoop)(PP_Instance instance); */
/** struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url);
* Posts a quit message for the outermost nested message loop. Use this to /**
* exit and return back to the caller after you call RunMessageLoop. * 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".
void (*QuitMessageLoop)(PP_Instance instance); */
/** int32_t (*Navigate)(PP_Resource request_info,
* Retrieves the local time zone offset from GM time for the given UTC time. const char* target,
*/ PP_Bool from_user_action);
double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t); /**
/** * Runs a nested message loop. The plugin will be reentered from this call.
* Gets a (string) with "command-line" options for Flash; used to pass * This function is used in places where Flash would normally enter a nested
* run-time debugging parameters, etc. * message loop (e.g., when displaying context menus), but Pepper provides
*/ * only an asynchronous call. After performing that asynchronous call, call
struct PP_Var (*GetCommandLineArgs)(PP_Module module); * |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.
*/
#endif /* PPAPI_C_PRIVATE_PPB_FLASH_H_ */ 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_ */
...@@ -1002,7 +1002,7 @@ def TestNamespaceFiles(filter): ...@@ -1002,7 +1002,7 @@ def TestNamespaceFiles(filter):
InfoOut.Log("Passed namespace test.") InfoOut.Log("Passed namespace test.")
return errs return errs
default_dirs = ['.', 'trusted', 'dev'] default_dirs = ['.', 'trusted', 'dev', 'private']
def ParseFiles(filenames): def ParseFiles(filenames):
parser = IDLParser() parser = IDLParser()
filenodes = [] filenodes = []
......
...@@ -248,8 +248,10 @@ const void* InterfaceList::GetInterfaceForPPP(const std::string& name) const { ...@@ -248,8 +248,10 @@ const void* InterfaceList::GetInterfaceForPPP(const std::string& name) const {
void InterfaceList::AddFlashInterfaces() { void InterfaceList::AddFlashInterfaces() {
AddProxy(API_ID_PPB_FLASH, &ProxyFactory<PPB_Flash_Proxy>); AddProxy(API_ID_PPB_FLASH, &ProxyFactory<PPB_Flash_Proxy>);
AddPPB(PPB_FLASH_INTERFACE, API_ID_PPB_FLASH, AddPPB(PPB_FLASH_INTERFACE_11_0, API_ID_PPB_FLASH,
PPB_Flash_Proxy::GetInterface()); PPB_Flash_Proxy::GetInterface11());
AddPPB(PPB_FLASH_INTERFACE_12_0, API_ID_PPB_FLASH,
PPB_Flash_Proxy::GetInterface12());
AddProxy(API_ID_PPB_FLASH_CLIPBOARD, AddProxy(API_ID_PPB_FLASH_CLIPBOARD,
&ProxyFactory<PPB_Flash_Clipboard_Proxy>); &ProxyFactory<PPB_Flash_Clipboard_Proxy>);
......
...@@ -663,7 +663,7 @@ IPC_SYNC_MESSAGE_ROUTED4_1(PpapiHostMsg_PPBFlash_Navigate, ...@@ -663,7 +663,7 @@ IPC_SYNC_MESSAGE_ROUTED4_1(PpapiHostMsg_PPBFlash_Navigate,
PP_Instance /* instance */, PP_Instance /* instance */,
ppapi::PPB_URLRequestInfo_Data /* request_data */, ppapi::PPB_URLRequestInfo_Data /* request_data */,
std::string /* target */, std::string /* target */,
bool /* from_user_action */, PP_Bool /* from_user_action */,
int32_t /* result */) int32_t /* result */)
IPC_SYNC_MESSAGE_ROUTED1_0(PpapiHostMsg_PPBFlash_RunMessageLoop, IPC_SYNC_MESSAGE_ROUTED1_0(PpapiHostMsg_PPBFlash_RunMessageLoop,
PP_Instance /* instance */) PP_Instance /* instance */)
......
...@@ -212,6 +212,7 @@ void ParamTraits<ppapi::proxy::PPBFlash_DrawGlyphs_Params>::Write( ...@@ -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][0]);
ParamTraits<float>::Write(m, p.transformation[2][1]); ParamTraits<float>::Write(m, p.transformation[2][1]);
ParamTraits<float>::Write(m, p.transformation[2][2]); 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<uint16_t> >::Write(m, p.glyph_indices);
ParamTraits<std::vector<PP_Point> >::Write(m, p.glyph_advances); ParamTraits<std::vector<PP_Point> >::Write(m, p.glyph_advances);
} }
...@@ -238,6 +239,7 @@ bool ParamTraits<ppapi::proxy::PPBFlash_DrawGlyphs_Params>::Read( ...@@ -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][0]) &&
ParamTraits<float>::Read(m, iter, &r->transformation[2][1]) && ParamTraits<float>::Read(m, iter, &r->transformation[2][1]) &&
ParamTraits<float>::Read(m, iter, &r->transformation[2][2]) && 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<uint16_t> >::Read(m, iter, &r->glyph_indices) &&
ParamTraits<std::vector<PP_Point> >::Read(m, iter, &r->glyph_advances) && ParamTraits<std::vector<PP_Point> >::Read(m, iter, &r->glyph_advances) &&
r->glyph_indices.size() == r->glyph_advances.size(); r->glyph_indices.size() == r->glyph_advances.size();
......
...@@ -43,9 +43,10 @@ PP_Bool DrawGlyphs(PP_Instance instance, ...@@ -43,9 +43,10 @@ PP_Bool DrawGlyphs(PP_Instance instance,
PP_Resource pp_image_data, PP_Resource pp_image_data,
const PP_FontDescription_Dev* font_desc, const PP_FontDescription_Dev* font_desc,
uint32_t color, uint32_t color,
PP_Point position, const PP_Point* position,
PP_Rect clip, const PP_Rect* clip,
const float transformation[3][3], const float transformation[3][3],
PP_Bool allow_subpixel_aa,
uint32_t glyph_count, uint32_t glyph_count,
const uint16_t glyph_indices[], const uint16_t glyph_indices[],
const PP_Point glyph_advances[]) { const PP_Point glyph_advances[]) {
...@@ -67,12 +68,13 @@ PP_Bool DrawGlyphs(PP_Instance instance, ...@@ -67,12 +68,13 @@ PP_Bool DrawGlyphs(PP_Instance instance,
params.image_data = image_data->host_resource(); params.image_data = image_data->host_resource();
params.font_desc.SetFromPPFontDescription(dispatcher, *font_desc, true); params.font_desc.SetFromPPFontDescription(dispatcher, *font_desc, true);
params.color = color; params.color = color;
params.position = position; params.position = *position;
params.clip = clip; params.clip = *clip;
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) for (int j = 0; j < 3; j++)
params.transformation[i][j] = transformation[i][j]; params.transformation[i][j] = transformation[i][j];
} }
params.allow_subpixel_aa = allow_subpixel_aa;
params.glyph_indices.insert(params.glyph_indices.begin(), params.glyph_indices.insert(params.glyph_indices.begin(),
&glyph_indices[0], &glyph_indices[0],
...@@ -87,6 +89,22 @@ PP_Bool DrawGlyphs(PP_Instance instance, ...@@ -87,6 +89,22 @@ PP_Bool DrawGlyphs(PP_Instance instance,
return result; 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) { PP_Var GetProxyForURL(PP_Instance instance, const char* url) {
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
if (!dispatcher) if (!dispatcher)
...@@ -100,7 +118,7 @@ PP_Var GetProxyForURL(PP_Instance instance, const char* url) { ...@@ -100,7 +118,7 @@ PP_Var GetProxyForURL(PP_Instance instance, const char* url) {
int32_t Navigate(PP_Resource request_id, int32_t Navigate(PP_Resource request_id,
const char* target, const char* target,
bool from_user_action) { PP_Bool from_user_action) {
thunk::EnterResource<thunk::PPB_URLRequestInfo_API> enter(request_id, true); thunk::EnterResource<thunk::PPB_URLRequestInfo_API> enter(request_id, true);
if (enter.failed()) if (enter.failed())
return PP_ERROR_BADRESOURCE; return PP_ERROR_BADRESOURCE;
...@@ -118,6 +136,13 @@ int32_t Navigate(PP_Resource request_id, ...@@ -118,6 +136,13 @@ int32_t Navigate(PP_Resource request_id,
return result; 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) { void RunMessageLoop(PP_Instance instance) {
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
if (!dispatcher) if (!dispatcher)
...@@ -158,20 +183,32 @@ PP_Var GetCommandLineArgs(PP_Module /*pp_module*/) { ...@@ -158,20 +183,32 @@ PP_Var GetCommandLineArgs(PP_Module /*pp_module*/) {
return StringVar::StringToPPVar(args); 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, &SetInstanceAlwaysOnTop,
&DrawGlyphs, &DrawGlyphs11,
&GetProxyForURL, &GetProxyForURL,
&Navigate, &Navigate11,
&RunMessageLoop, &RunMessageLoop,
&QuitMessageLoop, &QuitMessageLoop,
&GetLocalTimeZoneOffset, &GetLocalTimeZoneOffset,
&GetCommandLineArgs &GetCommandLineArgs
}; };
InterfaceProxy* CreateFlashProxy(Dispatcher* dispatcher) { const PPB_Flash flash_interface_12 = {
return new PPB_Flash_Proxy(dispatcher); &SetInstanceAlwaysOnTop,
} &DrawGlyphs,
&GetProxyForURL,
&Navigate,
&RunMessageLoop,
&QuitMessageLoop,
&GetLocalTimeZoneOffset,
&GetCommandLineArgs,
&PreLoadFontInWindows
};
} // namespace } // namespace
...@@ -187,8 +224,13 @@ PPB_Flash_Proxy::~PPB_Flash_Proxy() { ...@@ -187,8 +224,13 @@ PPB_Flash_Proxy::~PPB_Flash_Proxy() {
} }
// static // static
const PPB_Flash* PPB_Flash_Proxy::GetInterface() { const PPB_Flash_11* PPB_Flash_Proxy::GetInterface11() {
return &flash_interface; 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) { bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) {
...@@ -238,8 +280,9 @@ void PPB_Flash_Proxy::OnMsgDrawGlyphs(const PPBFlash_DrawGlyphs_Params& params, ...@@ -238,8 +280,9 @@ void PPB_Flash_Proxy::OnMsgDrawGlyphs(const PPBFlash_DrawGlyphs_Params& params,
*result = ppb_flash_impl_->DrawGlyphs( *result = ppb_flash_impl_->DrawGlyphs(
0, // Unused instance param. 0, // Unused instance param.
params.image_data.host_resource(), &font_desc, params.image_data.host_resource(), &font_desc,
params.color, params.position, params.clip, params.color, &params.position, &params.clip,
const_cast<float(*)[3]>(params.transformation), const_cast<float(*)[3]>(params.transformation),
params.allow_subpixel_aa,
static_cast<uint32_t>(params.glyph_indices.size()), static_cast<uint32_t>(params.glyph_indices.size()),
const_cast<uint16_t*>(&params.glyph_indices[0]), const_cast<uint16_t*>(&params.glyph_indices[0]),
const_cast<PP_Point*>(&params.glyph_advances[0])); const_cast<PP_Point*>(&params.glyph_advances[0]));
...@@ -255,7 +298,7 @@ void PPB_Flash_Proxy::OnMsgGetProxyForURL(PP_Instance instance, ...@@ -255,7 +298,7 @@ void PPB_Flash_Proxy::OnMsgGetProxyForURL(PP_Instance instance,
void PPB_Flash_Proxy::OnMsgNavigate(PP_Instance instance, void PPB_Flash_Proxy::OnMsgNavigate(PP_Instance instance,
const PPB_URLRequestInfo_Data& data, const PPB_URLRequestInfo_Data& data,
const std::string& target, const std::string& target,
bool from_user_action, PP_Bool from_user_action,
int32_t* result) { int32_t* result) {
DCHECK(!dispatcher()->IsPlugin()); DCHECK(!dispatcher()->IsPlugin());
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <vector> #include <vector>
#include "ipc/ipc_platform_file.h" #include "ipc/ipc_platform_file.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_module.h" #include "ppapi/c/pp_module.h"
#include "ppapi/c/pp_time.h" #include "ppapi/c/pp_time.h"
...@@ -16,6 +17,7 @@ ...@@ -16,6 +17,7 @@
#include "ppapi/shared_impl/host_resource.h" #include "ppapi/shared_impl/host_resource.h"
struct PPB_Flash; struct PPB_Flash;
struct PPB_Flash_11;
namespace ppapi { namespace ppapi {
...@@ -31,7 +33,9 @@ class PPB_Flash_Proxy : public InterfaceProxy { ...@@ -31,7 +33,9 @@ class PPB_Flash_Proxy : public InterfaceProxy {
explicit PPB_Flash_Proxy(Dispatcher* dispatcher); explicit PPB_Flash_Proxy(Dispatcher* dispatcher);
virtual ~PPB_Flash_Proxy(); 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. // InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg); virtual bool OnMessageReceived(const IPC::Message& msg);
...@@ -48,7 +52,7 @@ class PPB_Flash_Proxy : public InterfaceProxy { ...@@ -48,7 +52,7 @@ class PPB_Flash_Proxy : public InterfaceProxy {
void OnMsgNavigate(PP_Instance instance, void OnMsgNavigate(PP_Instance instance,
const PPB_URLRequestInfo_Data& data, const PPB_URLRequestInfo_Data& data,
const std::string& target, const std::string& target,
bool from_user_action, PP_Bool from_user_action,
int32_t* result); int32_t* result);
void OnMsgRunMessageLoop(PP_Instance instance); void OnMsgRunMessageLoop(PP_Instance instance);
void OnMsgQuitMessageLoop(PP_Instance instance); void OnMsgQuitMessageLoop(PP_Instance instance);
......
...@@ -81,6 +81,7 @@ struct PPBFlash_DrawGlyphs_Params { ...@@ -81,6 +81,7 @@ struct PPBFlash_DrawGlyphs_Params {
PP_Point position; PP_Point position;
PP_Rect clip; PP_Rect clip;
float transformation[3][3]; float transformation[3][3];
PP_Bool allow_subpixel_aa;
std::vector<uint16_t> glyph_indices; std::vector<uint16_t> glyph_indices;
std::vector<PP_Point> glyph_advances; std::vector<PP_Point> glyph_advances;
}; };
......
...@@ -286,8 +286,10 @@ const void* GetInterface(const char* name) { ...@@ -286,8 +286,10 @@ const void* GetInterface(const char* name) {
return &core_interface; return &core_interface;
if (strcmp(name, PPB_FILECHOOSER_TRUSTED_INTERFACE) == 0) if (strcmp(name, PPB_FILECHOOSER_TRUSTED_INTERFACE) == 0)
return ::ppapi::thunk::GetPPB_FileChooser_Trusted_Thunk(); return ::ppapi::thunk::GetPPB_FileChooser_Trusted_Thunk();
if (strcmp(name, PPB_FLASH_INTERFACE) == 0) if (strcmp(name, PPB_FLASH_INTERFACE_11_0) == 0)
return PPB_Flash_Impl::GetInterface(); 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) if (strcmp(name, PPB_FLASH_CLIPBOARD_INTERFACE) == 0)
return ::ppapi::thunk::GetPPB_Flash_Clipboard_Thunk(); return ::ppapi::thunk::GetPPB_Flash_Clipboard_Thunk();
if (strcmp(name, PPB_FLASH_CLIPBOARD_INTERFACE_3_LEGACY) == 0) if (strcmp(name, PPB_FLASH_CLIPBOARD_INTERFACE_3_LEGACY) == 0)
......
...@@ -55,9 +55,10 @@ PP_Bool DrawGlyphs(PP_Instance, ...@@ -55,9 +55,10 @@ PP_Bool DrawGlyphs(PP_Instance,
PP_Resource pp_image_data, PP_Resource pp_image_data,
const PP_FontDescription_Dev* font_desc, const PP_FontDescription_Dev* font_desc,
uint32_t color, uint32_t color,
PP_Point position, const PP_Point* position,
PP_Rect clip, const PP_Rect* clip,
const float transformation[3][3], const float transformation[3][3],
PP_Bool allow_subpixel_aa,
uint32_t glyph_count, uint32_t glyph_count,
const uint16_t glyph_indices[], const uint16_t glyph_indices[],
const PP_Point glyph_advances[]) { const PP_Point glyph_advances[]) {
...@@ -91,9 +92,9 @@ PP_Bool DrawGlyphs(PP_Instance, ...@@ -91,9 +92,9 @@ PP_Bool DrawGlyphs(PP_Instance,
canvas->save(); canvas->save();
// Clip is applied in pixels before the transform. // Clip is applied in pixels before the transform.
SkRect clip_rect = { clip.point.x, clip.point.y, SkRect clip_rect = { clip->point.x, clip->point.y,
clip.point.x + clip.size.width, clip->point.x + clip->size.width,
clip.point.y + clip.size.height }; clip->point.y + clip->size.height };
canvas->clipRect(clip_rect); canvas->clipRect(clip_rect);
// -- Do not return early below this. The canvas needs restoring and the // -- Do not return early below this. The canvas needs restoring and the
...@@ -120,11 +121,13 @@ PP_Bool DrawGlyphs(PP_Instance, ...@@ -120,11 +121,13 @@ PP_Bool DrawGlyphs(PP_Instance,
paint.setHinting(SkPaint::kFull_Hinting); paint.setHinting(SkPaint::kFull_Hinting);
paint.setTextSize(SkIntToScalar(font_desc->size)); paint.setTextSize(SkIntToScalar(font_desc->size));
paint.setTypeface(typeface); // Takes a ref and manages lifetime. paint.setTypeface(typeface); // Takes a ref and manages lifetime.
paint.setSubpixelText(true); if (allow_subpixel_aa) {
paint.setLCDRenderText(true); paint.setSubpixelText(true);
paint.setLCDRenderText(true);
}
SkScalar x = SkIntToScalar(position.x); SkScalar x = SkIntToScalar(position->x);
SkScalar y = SkIntToScalar(position.y); SkScalar y = SkIntToScalar(position->y);
// Build up the skia advances. // Build up the skia advances.
if (glyph_count == 0) if (glyph_count == 0)
...@@ -144,6 +147,21 @@ PP_Bool DrawGlyphs(PP_Instance, ...@@ -144,6 +147,21 @@ PP_Bool DrawGlyphs(PP_Instance,
return PP_TRUE; 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) { PP_Var GetProxyForURL(PP_Instance pp_instance, const char* url) {
PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance);
if (!instance) if (!instance)
...@@ -161,7 +179,7 @@ PP_Var GetProxyForURL(PP_Instance pp_instance, const char* url) { ...@@ -161,7 +179,7 @@ PP_Var GetProxyForURL(PP_Instance pp_instance, const char* url) {
int32_t Navigate(PP_Resource request_id, int32_t Navigate(PP_Resource request_id,
const char* target, const char* target,
bool from_user_action) { PP_Bool from_user_action) {
EnterResource<PPB_URLRequestInfo_API> enter(request_id, true); EnterResource<PPB_URLRequestInfo_API> enter(request_id, true);
if (enter.failed()) if (enter.failed())
return PP_ERROR_BADRESOURCE; return PP_ERROR_BADRESOURCE;
...@@ -174,7 +192,14 @@ int32_t Navigate(PP_Resource request_id, ...@@ -174,7 +192,14 @@ int32_t Navigate(PP_Resource request_id,
PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(request); PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(request);
if (!plugin_instance) if (!plugin_instance)
return PP_ERROR_FAILED; 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) { void RunMessageLoop(PP_Instance instance) {
...@@ -219,7 +244,22 @@ PP_Var GetCommandLineArgs(PP_Module pp_module) { ...@@ -219,7 +244,22 @@ PP_Var GetCommandLineArgs(PP_Module pp_module) {
return StringVar::StringToPPVar(args); 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, &SetInstanceAlwaysOnTop,
&DrawGlyphs, &DrawGlyphs,
&GetProxyForURL, &GetProxyForURL,
...@@ -227,14 +267,20 @@ const PPB_Flash ppb_flash = { ...@@ -227,14 +267,20 @@ const PPB_Flash ppb_flash = {
&RunMessageLoop, &RunMessageLoop,
&QuitMessageLoop, &QuitMessageLoop,
&GetLocalTimeZoneOffset, &GetLocalTimeZoneOffset,
&GetCommandLineArgs &GetCommandLineArgs,
&PreLoadFontInWindows
}; };
} // namespace } // namespace
// static // static
const PPB_Flash* PPB_Flash_Impl::GetInterface() { const PPB_Flash_11* PPB_Flash_Impl::GetInterface11() {
return &ppb_flash; return &ppb_flash_11;
}
// static
const PPB_Flash* PPB_Flash_Impl::GetInterface12() {
return &ppb_flash_12;
} }
} // namespace ppapi } // namespace ppapi
......
...@@ -18,7 +18,8 @@ class PPB_Flash_Impl { ...@@ -18,7 +18,8 @@ class PPB_Flash_Impl {
public: public:
// Returns a pointer to the interface implementing PPB_Flash that is // Returns a pointer to the interface implementing PPB_Flash that is
// exposed to the plugin. // exposed to the plugin.
static const PPB_Flash* GetInterface(); static const PPB_Flash_11* GetInterface11();
static const PPB_Flash* GetInterface12();
private: private:
DISALLOW_COPY_AND_ASSIGN(PPB_Flash_Impl); DISALLOW_COPY_AND_ASSIGN(PPB_Flash_Impl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment