summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-13 21:17:22 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-13 21:17:22 +0000
commit247e1bc809a02cdcb9a2eb272e8ccf253e61812c (patch)
treeed6f360a904587d054bcc8b4ab8c090233b9c076 /ppapi
parentb04cc6f45cf50d34dad447f94b18930e7884ec77 (diff)
downloadchromium_src-247e1bc809a02cdcb9a2eb272e8ccf253e61812c.zip
chromium_src-247e1bc809a02cdcb9a2eb272e8ccf253e61812c.tar.gz
chromium_src-247e1bc809a02cdcb9a2eb272e8ccf253e61812c.tar.bz2
Add a Flash API to get the device ID.
BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/9960083 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132269 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/api/private/ppb_flash.idl9
-rw-r--r--ppapi/c/private/ppb_flash.h40
-rw-r--r--ppapi/cpp/private/flash.cc126
-rw-r--r--ppapi/cpp/private/flash.h2
-rw-r--r--ppapi/proxy/interface_list.cc2
-rw-r--r--ppapi/proxy/ppb_flash_proxy.cc26
-rw-r--r--ppapi/proxy/ppb_flash_proxy.h1
7 files changed, 169 insertions, 37 deletions
diff --git a/ppapi/api/private/ppb_flash.idl b/ppapi/api/private/ppb_flash.idl
index 997274e..b083882 100644
--- a/ppapi/api/private/ppb_flash.idl
+++ b/ppapi/api/private/ppb_flash.idl
@@ -9,7 +9,8 @@
label Chrome {
M17 = 12.0,
- M19 = 12.1
+ M19 = 12.1,
+ M20 = 12.2
};
/**
@@ -129,6 +130,12 @@ interface PPB_Flash {
[version=12.1]
void UpdateActivity(
[in] PP_Instance instance);
+
+ /**
+ * Returns the device ID as a string. Returns a PP_VARTYPE_UNDEFINED on error.
+ */
+ [version=12.2]
+ PP_Var GetDeviceID([in] PP_Instance instance);
};
#inline c
diff --git a/ppapi/c/private/ppb_flash.h b/ppapi/c/private/ppb_flash.h
index f91f07c..7564693 100644
--- a/ppapi/c/private/ppb_flash.h
+++ b/ppapi/c/private/ppb_flash.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_flash.idl modified Fri Feb 17 15:52:14 2012. */
+/* From private/ppb_flash.idl modified Tue Apr 10 15:38:45 2012. */
#ifndef PPAPI_C_PRIVATE_PPB_FLASH_H_
#define PPAPI_C_PRIVATE_PPB_FLASH_H_
@@ -23,7 +23,8 @@
#define PPB_FLASH_INTERFACE_12_0 "PPB_Flash;12.0"
#define PPB_FLASH_INTERFACE_12_1 "PPB_Flash;12.1"
-#define PPB_FLASH_INTERFACE PPB_FLASH_INTERFACE_12_1
+#define PPB_FLASH_INTERFACE_12_2 "PPB_Flash;12.2"
+#define PPB_FLASH_INTERFACE PPB_FLASH_INTERFACE_12_2
/**
* @file
@@ -39,7 +40,7 @@
* The <code>PPB_Flash</code> interface contains pointers to various functions
* that are only needed to support Pepper Flash.
*/
-struct PPB_Flash_12_1 {
+struct PPB_Flash_12_2 {
/**
* 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
@@ -122,9 +123,13 @@ struct PPB_Flash_12_1 {
* in.
*/
void (*UpdateActivity)(PP_Instance instance);
+ /**
+ * Returns the device ID as a string. Returns a PP_VARTYPE_UNDEFINED on error.
+ */
+ struct PP_Var (*GetDeviceID)(PP_Instance instance);
};
-typedef struct PPB_Flash_12_1 PPB_Flash;
+typedef struct PPB_Flash_12_2 PPB_Flash;
struct PPB_Flash_12_0 {
void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top);
@@ -149,6 +154,33 @@ struct PPB_Flash_12_0 {
struct PP_Var (*GetCommandLineArgs)(PP_Module module);
void (*PreloadFontWin)(const void* logfontw);
};
+
+struct PPB_Flash_12_1 {
+ 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,
+ 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[]);
+ struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url);
+ int32_t (*Navigate)(PP_Resource request_info,
+ const char* target,
+ PP_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);
+ void (*PreloadFontWin)(const void* logfontw);
+ PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect);
+ int32_t (*InvokePrinting)(PP_Instance instance);
+ void (*UpdateActivity)(PP_Instance instance);
+};
/**
* @}
*/
diff --git a/ppapi/cpp/private/flash.cc b/ppapi/cpp/private/flash.cc
index 501da37..d5e2b39 100644
--- a/ppapi/cpp/private/flash.cc
+++ b/ppapi/cpp/private/flash.cc
@@ -21,8 +21,12 @@ namespace pp {
namespace {
-template <> const char* interface_name<PPB_Flash>() {
- return PPB_FLASH_INTERFACE;
+template <> const char* interface_name<PPB_Flash_12_2>() {
+ return PPB_FLASH_INTERFACE_12_2;
+}
+
+template <> const char* interface_name<PPB_Flash_12_1>() {
+ return PPB_FLASH_INTERFACE_12_1;
}
template <> const char* interface_name<PPB_Flash_12_0>() {
@@ -39,7 +43,8 @@ namespace flash {
// static
bool Flash::IsAvailable() {
- return has_interface<PPB_Flash>() ||
+ return has_interface<PPB_Flash_12_2>() ||
+ has_interface<PPB_Flash_12_1>() ||
has_interface<PPB_Flash_12_0>() ||
has_interface<PPB_Flash_11>();
}
@@ -47,9 +52,12 @@ bool Flash::IsAvailable() {
// static
void Flash::SetInstanceAlwaysOnTop(const InstanceHandle& instance,
bool on_top) {
- if (has_interface<PPB_Flash>()) {
- get_interface<PPB_Flash>()->SetInstanceAlwaysOnTop(instance.pp_instance(),
- PP_FromBool(on_top));
+ if (has_interface<PPB_Flash_12_2>()) {
+ get_interface<PPB_Flash_12_2>()->SetInstanceAlwaysOnTop(
+ instance.pp_instance(), PP_FromBool(on_top));
+ } else if (has_interface<PPB_Flash_12_1>()) {
+ get_interface<PPB_Flash_12_1>()->SetInstanceAlwaysOnTop(
+ instance.pp_instance(), PP_FromBool(on_top));
} else if (has_interface<PPB_Flash_12_0>()) {
get_interface<PPB_Flash_12_0>()->SetInstanceAlwaysOnTop(
instance.pp_instance(), PP_FromBool(on_top));
@@ -72,8 +80,21 @@ bool Flash::DrawGlyphs(const InstanceHandle& instance,
const uint16_t glyph_indices[],
const PP_Point glyph_advances[]) {
bool rv = false;
- if (has_interface<PPB_Flash>()) {
- rv = PP_ToBool(get_interface<PPB_Flash>()->DrawGlyphs(
+ if (has_interface<PPB_Flash_12_2>()) {
+ rv = PP_ToBool(get_interface<PPB_Flash_12_2>()->DrawGlyphs(
+ instance.pp_instance(),
+ image->pp_resource(),
+ &font_desc.pp_font_description(),
+ color,
+ &position.pp_point(),
+ &clip.pp_rect(),
+ transformation,
+ PP_FromBool(allow_subpixel_aa),
+ glyph_count,
+ glyph_indices,
+ glyph_advances));
+ } else if (has_interface<PPB_Flash_12_1>()) {
+ rv = PP_ToBool(get_interface<PPB_Flash_12_1>()->DrawGlyphs(
instance.pp_instance(),
image->pp_resource(),
&font_desc.pp_font_description(),
@@ -118,10 +139,14 @@ bool Flash::DrawGlyphs(const InstanceHandle& instance,
Var Flash::GetProxyForURL(const InstanceHandle& instance,
const std::string& url) {
Var rv;
- if (has_interface<PPB_Flash>()) {
+ if (has_interface<PPB_Flash_12_2>()) {
+ rv = Var(PASS_REF,
+ get_interface<PPB_Flash_12_2>()->GetProxyForURL(
+ instance.pp_instance(), url.c_str()));
+ } else if (has_interface<PPB_Flash_12_1>()) {
rv = Var(PASS_REF,
- get_interface<PPB_Flash>()->GetProxyForURL(instance.pp_instance(),
- url.c_str()));
+ get_interface<PPB_Flash_12_1>()->GetProxyForURL(
+ instance.pp_instance(), url.c_str()));
} else if (has_interface<PPB_Flash_12_0>()) {
rv = Var(PASS_REF,
get_interface<PPB_Flash_12_0>()->GetProxyForURL(
@@ -139,10 +164,16 @@ int32_t Flash::Navigate(const URLRequestInfo& request_info,
const std::string& target,
bool from_user_action) {
int32_t rv = PP_ERROR_FAILED;
- if (has_interface<PPB_Flash>()) {
- rv = get_interface<PPB_Flash>()->Navigate(request_info.pp_resource(),
- target.c_str(),
- PP_FromBool(from_user_action));
+ if (has_interface<PPB_Flash_12_2>()) {
+ rv = get_interface<PPB_Flash_12_2>()->Navigate(
+ request_info.pp_resource(),
+ target.c_str(),
+ PP_FromBool(from_user_action));
+ } else if (has_interface<PPB_Flash_12_1>()) {
+ rv = get_interface<PPB_Flash_12_1>()->Navigate(
+ request_info.pp_resource(),
+ target.c_str(),
+ PP_FromBool(from_user_action));
} else if (has_interface<PPB_Flash_12_0>()) {
rv = get_interface<PPB_Flash_12_0>()->Navigate(
request_info.pp_resource(),
@@ -158,8 +189,10 @@ int32_t Flash::Navigate(const URLRequestInfo& request_info,
// static
void Flash::RunMessageLoop(const InstanceHandle& instance) {
- if (has_interface<PPB_Flash>())
- get_interface<PPB_Flash>()->RunMessageLoop(instance.pp_instance());
+ if (has_interface<PPB_Flash_12_2>())
+ get_interface<PPB_Flash_12_2>()->RunMessageLoop(instance.pp_instance());
+ else if (has_interface<PPB_Flash_12_1>())
+ get_interface<PPB_Flash_12_1>()->RunMessageLoop(instance.pp_instance());
else if (has_interface<PPB_Flash_12_0>())
get_interface<PPB_Flash_12_0>()->RunMessageLoop(instance.pp_instance());
else if (has_interface<PPB_Flash_11>())
@@ -168,8 +201,10 @@ void Flash::RunMessageLoop(const InstanceHandle& instance) {
// static
void Flash::QuitMessageLoop(const InstanceHandle& instance) {
- if (has_interface<PPB_Flash>())
- get_interface<PPB_Flash>()->QuitMessageLoop(instance.pp_instance());
+ if (has_interface<PPB_Flash_12_2>())
+ get_interface<PPB_Flash_12_2>()->QuitMessageLoop(instance.pp_instance());
+ else if (has_interface<PPB_Flash_12_1>())
+ get_interface<PPB_Flash_12_1>()->QuitMessageLoop(instance.pp_instance());
else if (has_interface<PPB_Flash_12_0>())
get_interface<PPB_Flash_12_0>()->QuitMessageLoop(instance.pp_instance());
else if (has_interface<PPB_Flash_11>())
@@ -180,8 +215,11 @@ void Flash::QuitMessageLoop(const InstanceHandle& instance) {
double Flash::GetLocalTimeZoneOffset(const InstanceHandle& instance,
PP_Time t) {
double rv = 0;
- if (has_interface<PPB_Flash>()) {
- rv = get_interface<PPB_Flash>()->GetLocalTimeZoneOffset(
+ if (has_interface<PPB_Flash_12_2>()) {
+ rv = get_interface<PPB_Flash_12_2>()->GetLocalTimeZoneOffset(
+ instance.pp_instance(), t);
+ } else if (has_interface<PPB_Flash_12_1>()) {
+ rv = get_interface<PPB_Flash_12_1>()->GetLocalTimeZoneOffset(
instance.pp_instance(), t);
} else if (has_interface<PPB_Flash_12_0>()) {
rv = get_interface<PPB_Flash_12_0>()->GetLocalTimeZoneOffset(
@@ -196,9 +234,13 @@ double Flash::GetLocalTimeZoneOffset(const InstanceHandle& instance,
// static
Var Flash::GetCommandLineArgs(Module* module) {
Var rv;
- if (has_interface<PPB_Flash>()) {
+ if (has_interface<PPB_Flash_12_2>()) {
rv = Var(PASS_REF,
- get_interface<PPB_Flash>()->GetCommandLineArgs(
+ get_interface<PPB_Flash_12_2>()->GetCommandLineArgs(
+ module->pp_module()));
+ } else if (has_interface<PPB_Flash_12_1>()) {
+ rv = Var(PASS_REF,
+ get_interface<PPB_Flash_12_1>()->GetCommandLineArgs(
module->pp_module()));
} else if (has_interface<PPB_Flash_12_0>()) {
rv = Var(PASS_REF,
@@ -214,8 +256,10 @@ Var Flash::GetCommandLineArgs(Module* module) {
// static
void Flash::PreloadFontWin(const void* logfontw) {
- if (has_interface<PPB_Flash>())
- get_interface<PPB_Flash>()->PreloadFontWin(logfontw);
+ if (has_interface<PPB_Flash_12_2>())
+ get_interface<PPB_Flash_12_2>()->PreloadFontWin(logfontw);
+ else if (has_interface<PPB_Flash_12_1>())
+ get_interface<PPB_Flash_12_1>()->PreloadFontWin(logfontw);
else if (has_interface<PPB_Flash_12_0>())
get_interface<PPB_Flash_12_0>()->PreloadFontWin(logfontw);
}
@@ -223,8 +267,11 @@ void Flash::PreloadFontWin(const void* logfontw) {
// static
bool Flash::IsRectTopmost(const InstanceHandle& instance, const Rect& rect) {
bool rv = false;
- if (has_interface<PPB_Flash>()) {
- rv = PP_ToBool(get_interface<PPB_Flash>()->IsRectTopmost(
+ if (has_interface<PPB_Flash_12_2>()) {
+ rv = PP_ToBool(get_interface<PPB_Flash_12_2>()->IsRectTopmost(
+ instance.pp_instance(), &rect.pp_rect()));
+ } else if (has_interface<PPB_Flash_12_1>()) {
+ rv = PP_ToBool(get_interface<PPB_Flash_12_1>()->IsRectTopmost(
instance.pp_instance(), &rect.pp_rect()));
}
return rv;
@@ -233,15 +280,32 @@ bool Flash::IsRectTopmost(const InstanceHandle& instance, const Rect& rect) {
// static
int32_t Flash::InvokePrinting(const InstanceHandle& instance) {
int32_t rv = PP_ERROR_NOTSUPPORTED;
- if (has_interface<PPB_Flash>())
- rv = get_interface<PPB_Flash>()->InvokePrinting(instance.pp_instance());
+ if (has_interface<PPB_Flash_12_2>()) {
+ rv = get_interface<PPB_Flash_12_2>()->InvokePrinting(
+ instance.pp_instance());
+ } else if (has_interface<PPB_Flash_12_1>()) {
+ rv = get_interface<PPB_Flash_12_1>()->InvokePrinting(
+ instance.pp_instance());
+ }
return rv;
}
// static
void Flash::UpdateActivity(const InstanceHandle& instance) {
- if (has_interface<PPB_Flash>())
- get_interface<PPB_Flash>()->UpdateActivity(instance.pp_instance());
+ if (has_interface<PPB_Flash_12_2>())
+ get_interface<PPB_Flash_12_2>()->UpdateActivity(instance.pp_instance());
+ if (has_interface<PPB_Flash_12_1>())
+ get_interface<PPB_Flash_12_1>()->UpdateActivity(instance.pp_instance());
+}
+
+// static
+Var Flash::GetDeviceID(const InstanceHandle& instance) {
+ if (has_interface<PPB_Flash_12_2>()) {
+ return Var(
+ PASS_REF,
+ get_interface<PPB_Flash_12_2>()->GetDeviceID(instance.pp_instance()));
+ }
+ return Var();
}
} // namespace flash
diff --git a/ppapi/cpp/private/flash.h b/ppapi/cpp/private/flash.h
index 9eafac3..a3a8d65 100644
--- a/ppapi/cpp/private/flash.h
+++ b/ppapi/cpp/private/flash.h
@@ -57,7 +57,7 @@ class Flash {
static bool IsRectTopmost(const InstanceHandle& instance, const Rect& rect);
static int32_t InvokePrinting(const InstanceHandle& instance);
static void UpdateActivity(const InstanceHandle& instance);
-
+ static Var GetDeviceID(const InstanceHandle& instance);
};
} // namespace flash
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index 3a23c94..4b526a0f 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -300,6 +300,8 @@ void InterfaceList::AddFlashInterfaces() {
PPB_Flash_Proxy::GetInterface12_0());
AddPPB(PPB_FLASH_INTERFACE_12_1, API_ID_PPB_FLASH,
PPB_Flash_Proxy::GetInterface12_1());
+ AddPPB(PPB_FLASH_INTERFACE_12_2, API_ID_PPB_FLASH,
+ PPB_Flash_Proxy::GetInterface12_2());
AddProxy(API_ID_PPB_FLASH_CLIPBOARD,
&ProxyFactory<PPB_Flash_Clipboard_Proxy>);
diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc
index d2e5cb6..18d1f5a 100644
--- a/ppapi/proxy/ppb_flash_proxy.cc
+++ b/ppapi/proxy/ppb_flash_proxy.cc
@@ -222,6 +222,11 @@ void UpdateActivity(PP_Instance instance) {
// TODO(viettrungluu): Implement me.
}
+PP_Var GetDeviceID(PP_Instance instance) {
+ // TODO(brettw) implement me.
+ return PP_MakeUndefined();
+}
+
const PPB_Flash_11 flash_interface_11 = {
&SetInstanceAlwaysOnTop,
&DrawGlyphs11,
@@ -260,6 +265,22 @@ const PPB_Flash_12_1 flash_interface_12_1 = {
&UpdateActivity
};
+const PPB_Flash_12_2 flash_interface_12_2 = {
+ &SetInstanceAlwaysOnTop,
+ &DrawGlyphs,
+ &GetProxyForURL,
+ &Navigate,
+ &RunMessageLoop,
+ &QuitMessageLoop,
+ &GetLocalTimeZoneOffset,
+ &GetCommandLineArgs,
+ &PreLoadFontWin,
+ &IsRectTopmost,
+ &InvokePrinting,
+ &UpdateActivity,
+ &GetDeviceID
+};
+
} // namespace
PPB_Flash_Proxy::PPB_Flash_Proxy(Dispatcher* dispatcher)
@@ -288,6 +309,11 @@ const PPB_Flash_12_1* PPB_Flash_Proxy::GetInterface12_1() {
return &flash_interface_12_1;
}
+// static
+const PPB_Flash_12_2* PPB_Flash_Proxy::GetInterface12_2() {
+ return &flash_interface_12_2;
+}
+
bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) {
// Prevent the dispatcher from going away during a call to Navigate.
// This must happen OUTSIDE of OnMsgNavigate since the handling code use
diff --git a/ppapi/proxy/ppb_flash_proxy.h b/ppapi/proxy/ppb_flash_proxy.h
index dbdebc7..00ee011 100644
--- a/ppapi/proxy/ppb_flash_proxy.h
+++ b/ppapi/proxy/ppb_flash_proxy.h
@@ -35,6 +35,7 @@ class PPB_Flash_Proxy : public InterfaceProxy {
static const PPB_Flash_11* GetInterface11();
static const PPB_Flash_12_0* GetInterface12_0();
static const PPB_Flash_12_1* GetInterface12_1();
+ static const PPB_Flash_12_2* GetInterface12_2();
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);