Pepper: Generate ppb_flash_clipboard.h from .idl file.

Also, convert the version number for the PPB_Flash_Clipboard interface to the
standard form.

BUG=104001,104184
TEST=(The existing) Pepper Flash still works.
TBR=dmichael@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109999 0039d316-1c4b-4281-b951-d872f2087c98
parent 320eff44
/* 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.
*/
/**
* This file defines the private <code>PPB_Flash_Clipboard</code> API used by
* Pepper Flash for reading and writing to the clipboard.
*/
label Chrome {
M17 = 3.0
};
#inline c
/**
* The old version string for this interface, equivalent to version 3.0.
* TODO(viettrungluu): Remove this when enough time has passed. crbug.com/104184
*/
#define PPB_FLASH_CLIPBOARD_INTERFACE_3_LEGACY "PPB_Flash_Clipboard;3"
#endinl
/**
* This enumeration contains the types of clipboards that can be accessed.
* These types correspond to clipboard types in WebKit.
*/
[assert_size(4)]
enum PP_Flash_Clipboard_Type {
/** The standard clipboard. */
PP_FLASH_CLIPBOARD_TYPE_STANDARD = 0,
/** The selection clipboard (e.g., on Linux). */
PP_FLASH_CLIPBOARD_TYPE_SELECTION = 1,
/** The drag clipboard. */
PP_FLASH_CLIPBOARD_TYPE_DRAG = 2
};
/**
* This enumeration contains the supported clipboard data formats.
*/
[assert_size(4)]
enum PP_Flash_Clipboard_Format {
/** Indicates an invalid or unsupported clipboard data format. */
PP_FLASH_CLIPBOARD_FORMAT_INVALID = 0,
/** Indicates plain text clipboard data. */
PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT = 1,
/** Indicates HTML clipboard data. */
PP_FLASH_CLIPBOARD_FORMAT_HTML = 2
};
/**
* The <code>PPB_Flash_Clipboard</code> interface contains pointers to functions
* used by Pepper Flash to access the clipboard.
*
* TODO(viettrungluu): Support more formats (e.g., HTML)....
*/
[version=3.0]
interface PPB_Flash_Clipboard {
/**
* Checks whether a given data format is available from the given clipboard.
* Returns true if the given format is available from the given clipboard.
*/
PP_Bool IsFormatAvailable(
[in] PP_Instance instance_id,
[in] PP_Flash_Clipboard_Type clipboard_type,
[in] PP_Flash_Clipboard_Format format);
/**
* Reads plain text data from the clipboard.
*/
PP_Var ReadPlainText(
[in] PP_Instance instance_id,
[in] PP_Flash_Clipboard_Type clipboard_type);
/**
* Writes plain text data to the clipboard. If <code>text</code> is too large,
* it will return <code>PP_ERROR_NOSPACE</code> and not write to the
* clipboard.
*/
int32_t WritePlainText(
[in] PP_Instance instance_id,
[in] PP_Flash_Clipboard_Type clipboard_type,
[in] PP_Var text);
};
// 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.
*/
/* From private/ppb_flash_clipboard.idl modified Mon Nov 14 13:36:44 2011. */
#ifndef PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_ #ifndef PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_
#define PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_ #define PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_
#include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/pp_var.h" #include "ppapi/c/pp_var.h"
#define PPB_FLASH_CLIPBOARD_INTERFACE "PPB_Flash_Clipboard;3" #define PPB_FLASH_CLIPBOARD_INTERFACE_3_0 "PPB_Flash_Clipboard;3.0"
#define PPB_FLASH_CLIPBOARD_INTERFACE PPB_FLASH_CLIPBOARD_INTERFACE_3_0
/**
* @file
* This file defines the private <code>PPB_Flash_Clipboard</code> API used by
* Pepper Flash for reading and writing to the clipboard.
*/
/**
* The old version string for this interface, equivalent to version 3.0.
* TODO(viettrungluu): Remove this when enough time has passed. crbug.com/104184
*/
#define PPB_FLASH_CLIPBOARD_INTERFACE_3_LEGACY "PPB_Flash_Clipboard;3"
/**
* @addtogroup Enums
* @{
*/
/**
* This enumeration contains the types of clipboards that can be accessed.
* These types correspond to clipboard types in WebKit.
*/
typedef enum { typedef enum {
/** The standard clipboard. */
PP_FLASH_CLIPBOARD_TYPE_STANDARD = 0, PP_FLASH_CLIPBOARD_TYPE_STANDARD = 0,
/** The selection clipboard (e.g., on Linux). */
PP_FLASH_CLIPBOARD_TYPE_SELECTION = 1, PP_FLASH_CLIPBOARD_TYPE_SELECTION = 1,
/** The drag clipboard. */
PP_FLASH_CLIPBOARD_TYPE_DRAG = 2 PP_FLASH_CLIPBOARD_TYPE_DRAG = 2
} PP_Flash_Clipboard_Type; } PP_Flash_Clipboard_Type;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_Clipboard_Type, 4);
/**
* This enumeration contains the supported clipboard data formats.
*/
typedef enum { typedef enum {
/** Indicates an invalid or unsupported clipboard data format. */
PP_FLASH_CLIPBOARD_FORMAT_INVALID = 0, PP_FLASH_CLIPBOARD_FORMAT_INVALID = 0,
/** Indicates plain text clipboard data. */
PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT = 1, PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT = 1,
/** Indicates HTML clipboard data. */
PP_FLASH_CLIPBOARD_FORMAT_HTML = 2 PP_FLASH_CLIPBOARD_FORMAT_HTML = 2
} PP_Flash_Clipboard_Format; } PP_Flash_Clipboard_Format;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_Clipboard_Format, 4);
/**
* @}
*/
/**
* @addtogroup Interfaces
* @{
*/
/**
* The <code>PPB_Flash_Clipboard</code> interface contains pointers to functions
* used by Pepper Flash to access the clipboard.
*
* TODO(viettrungluu): Support more formats (e.g., HTML)....
*/
struct PPB_Flash_Clipboard { struct PPB_Flash_Clipboard {
// Returns true if the given format is available from the given clipboard. /**
* Checks whether a given data format is available from the given clipboard.
* Returns true if the given format is available from the given clipboard.
*/
PP_Bool (*IsFormatAvailable)(PP_Instance instance_id, PP_Bool (*IsFormatAvailable)(PP_Instance instance_id,
PP_Flash_Clipboard_Type clipboard_type, PP_Flash_Clipboard_Type clipboard_type,
PP_Flash_Clipboard_Format format); PP_Flash_Clipboard_Format format);
/**
// Reads plain text data from the clipboard. * Reads plain text data from the clipboard.
*/
struct PP_Var (*ReadPlainText)(PP_Instance instance_id, struct PP_Var (*ReadPlainText)(PP_Instance instance_id,
PP_Flash_Clipboard_Type clipboard_type); PP_Flash_Clipboard_Type clipboard_type);
/**
// Writes plain text data to the clipboard. If |text| is too large, it will * Writes plain text data to the clipboard. If <code>text</code> is too large,
// return |PP_ERROR_NOSPACE| (and not write to the clipboard). * it will return <code>PP_ERROR_NOSPACE</code> and not write to the
* clipboard.
*/
int32_t (*WritePlainText)(PP_Instance instance_id, int32_t (*WritePlainText)(PP_Instance instance_id,
PP_Flash_Clipboard_Type clipboard_type, PP_Flash_Clipboard_Type clipboard_type,
struct PP_Var text); struct PP_Var text);
// TODO(vtl): More formats (e.g., HTML)....
}; };
/**
* @}
*/
#endif /* PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_ */
#endif // PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_
...@@ -238,10 +238,21 @@ const void* InterfaceList::GetInterfaceForPPP(const std::string& name) const { ...@@ -238,10 +238,21 @@ const void* InterfaceList::GetInterfaceForPPP(const std::string& name) const {
} }
void InterfaceList::AddFlashInterfaces() { void InterfaceList::AddFlashInterfaces() {
AddProxy(API_ID_PPB_FLASH, &ProxyFactory<PPB_Flash_Proxy>);
AddPPB(PPB_FLASH_INTERFACE, API_ID_PPB_FLASH,
PPB_Flash_Proxy::GetInterface());
AddProxy(API_ID_PPB_FLASH_CLIPBOARD, AddProxy(API_ID_PPB_FLASH_CLIPBOARD,
&ProxyFactory<PPB_Flash_Clipboard_Proxy>); &ProxyFactory<PPB_Flash_Clipboard_Proxy>);
AddPPB(PPB_FLASH_CLIPBOARD_INTERFACE, API_ID_PPB_FLASH_CLIPBOARD, AddPPB(PPB_FLASH_CLIPBOARD_INTERFACE, API_ID_PPB_FLASH_CLIPBOARD,
thunk::GetPPB_Flash_Clipboard_Thunk()); thunk::GetPPB_Flash_Clipboard_Thunk());
AddPPB(PPB_FLASH_CLIPBOARD_INTERFACE_3_LEGACY, API_ID_PPB_FLASH_CLIPBOARD,
thunk::GetPPB_Flash_Clipboard_Thunk());
AddProxy(API_ID_PPB_FLASH_FILE_FILEREF,
&ProxyFactory<PPB_Flash_File_FileRef_Proxy>);
AddPPB(PPB_FLASH_FILE_FILEREF_INTERFACE, API_ID_PPB_FLASH_FILE_FILEREF,
PPB_Flash_File_FileRef_Proxy::GetInterface());
AddProxy(API_ID_PPB_FLASH_FILE_MODULELOCAL, AddProxy(API_ID_PPB_FLASH_FILE_MODULELOCAL,
&ProxyFactory<PPB_Flash_File_ModuleLocal_Proxy>); &ProxyFactory<PPB_Flash_File_ModuleLocal_Proxy>);
...@@ -249,19 +260,10 @@ void InterfaceList::AddFlashInterfaces() { ...@@ -249,19 +260,10 @@ void InterfaceList::AddFlashInterfaces() {
API_ID_PPB_FLASH_FILE_MODULELOCAL, API_ID_PPB_FLASH_FILE_MODULELOCAL,
PPB_Flash_File_ModuleLocal_Proxy::GetInterface()); PPB_Flash_File_ModuleLocal_Proxy::GetInterface());
AddProxy(API_ID_PPB_FLASH_FILE_FILEREF,
&ProxyFactory<PPB_Flash_File_FileRef_Proxy>);
AddPPB(PPB_FLASH_FILE_FILEREF_INTERFACE, API_ID_PPB_FLASH_FILE_FILEREF,
PPB_Flash_File_FileRef_Proxy::GetInterface());
AddProxy(API_ID_PPB_FLASH_MENU, &ProxyFactory<PPB_Flash_Menu_Proxy>); AddProxy(API_ID_PPB_FLASH_MENU, &ProxyFactory<PPB_Flash_Menu_Proxy>);
AddPPB(PPB_FLASH_MENU_INTERFACE, API_ID_PPB_FLASH_MENU, AddPPB(PPB_FLASH_MENU_INTERFACE, API_ID_PPB_FLASH_MENU,
thunk::GetPPB_Flash_Menu_Thunk()); thunk::GetPPB_Flash_Menu_Thunk());
AddProxy(API_ID_PPB_FLASH, &ProxyFactory<PPB_Flash_Proxy>);
AddPPB(PPB_FLASH_INTERFACE, API_ID_PPB_FLASH,
PPB_Flash_Proxy::GetInterface());
AddProxy(API_ID_PPB_FLASH_TCPSOCKET, AddProxy(API_ID_PPB_FLASH_TCPSOCKET,
&ProxyFactory<PPB_Flash_TCPSocket_Proxy>); &ProxyFactory<PPB_Flash_TCPSocket_Proxy>);
AddPPB(PPB_FLASH_TCPSOCKET_INTERFACE, API_ID_PPB_FLASH_TCPSOCKET, AddPPB(PPB_FLASH_TCPSOCKET_INTERFACE, API_ID_PPB_FLASH_TCPSOCKET,
......
...@@ -274,6 +274,8 @@ const void* GetInterface(const char* name) { ...@@ -274,6 +274,8 @@ const void* GetInterface(const char* name) {
return PPB_Flash_Impl::GetInterface(); return PPB_Flash_Impl::GetInterface();
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)
return ::ppapi::thunk::GetPPB_Flash_Clipboard_Thunk();
if (strcmp(name, PPB_FLASH_FILE_FILEREF_INTERFACE) == 0) if (strcmp(name, PPB_FLASH_FILE_FILEREF_INTERFACE) == 0)
return PPB_Flash_File_FileRef_Impl::GetInterface(); return PPB_Flash_File_FileRef_Impl::GetInterface();
if (strcmp(name, PPB_FLASH_FILE_MODULELOCAL_INTERFACE) == 0) if (strcmp(name, PPB_FLASH_FILE_MODULELOCAL_INTERFACE) == 0)
......
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