summaryrefslogtreecommitdiffstats
path: root/ppapi/thunk
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-11 02:02:11 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-11 02:02:11 +0000
commit11d0c36550b865bc690712a07bca9de01b91000c (patch)
tree58aa6ffaabbfbdfe4dcb99ca7dd1010336ab5928 /ppapi/thunk
parent70c7b2f7275b0815a97df029ed599ed7e46c7bfb (diff)
downloadchromium_src-11d0c36550b865bc690712a07bca9de01b91000c.zip
chromium_src-11d0c36550b865bc690712a07bca9de01b91000c.tar.gz
chromium_src-11d0c36550b865bc690712a07bca9de01b91000c.tar.bz2
Implement plugin side of sync EnumerateVideoCaptureDevices
This implements the plugin side of PPB_Flash::EnumerateVideoCaptureDevices which is a synchronous version of PPB_VideoCapture::EnumerateVideoDevices. The result is output into a PP_ArrayOutput. This also adds a unittest which does some basic testing of the messages sent, but mainly demonstrates how to write PluginResource unittests when dealing with sync messages (and adds some infrastructure to make it easy to do this). Once VideoCapture is implemented as a new-style resource, the code for this will simplify a lot. Review URL: https://chromiumcodereview.appspot.com/11039012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161265 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/thunk')
-rw-r--r--ppapi/thunk/interfaces_ppb_private_flash.h3
-rw-r--r--ppapi/thunk/ppb_flash_api.h7
-rw-r--r--ppapi/thunk/ppb_flash_functions_api.h32
-rw-r--r--ppapi/thunk/ppb_flash_thunk.cc43
-rw-r--r--ppapi/thunk/ppb_instance_api.h6
5 files changed, 90 insertions, 1 deletions
diff --git a/ppapi/thunk/interfaces_ppb_private_flash.h b/ppapi/thunk/interfaces_ppb_private_flash.h
index 91e50cd..7a3b423 100644
--- a/ppapi/thunk/interfaces_ppb_private_flash.h
+++ b/ppapi/thunk/interfaces_ppb_private_flash.h
@@ -26,6 +26,9 @@ PROXIED_IFACE(PPB_Flash,
PROXIED_IFACE(PPB_Flash,
PPB_FLASH_INTERFACE_12_5,
PPB_Flash_12_5)
+PROXIED_IFACE(PPB_Flash,
+ PPB_FLASH_INTERFACE_12_6,
+ PPB_Flash_12_6)
PROXIED_IFACE(PPB_Flash,
PPB_FLASH_CLIPBOARD_INTERFACE_3_LEGACY,
diff --git a/ppapi/thunk/ppb_flash_api.h b/ppapi/thunk/ppb_flash_api.h
index d39393e..7a1a641 100644
--- a/ppapi/thunk/ppb_flash_api.h
+++ b/ppapi/thunk/ppb_flash_api.h
@@ -16,6 +16,13 @@ struct URLRequestInfoData;
namespace thunk {
+/////////////////////////// WARNING:DEPRECTATED ////////////////////////////////
+// Please do not add any new functions to this API. They should be implemented
+// in the new-style resource proxy (see flash_functions_api.h and
+// flash_resource.h).
+// TODO(raymes): All of these functions should be moved to
+// flash_functions_api.h.
+////////////////////////////////////////////////////////////////////////////////
// This class collects all of the Flash interface-related APIs into one place.
class PPAPI_THUNK_EXPORT PPB_Flash_API {
public:
diff --git a/ppapi/thunk/ppb_flash_functions_api.h b/ppapi/thunk/ppb_flash_functions_api.h
new file mode 100644
index 0000000..2a4a24e
--- /dev/null
+++ b/ppapi/thunk/ppb_flash_functions_api.h
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 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_THUNK_PPB_FLASH_FUNCTIONS_API_H_
+#define PPAPI_THUNK_PPB_FLASH_FUNCTIONS_API_H_
+
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+struct PP_ArrayOutput;
+
+namespace ppapi {
+namespace thunk {
+
+// This class collects all of the Flash interface-related APIs into one place.
+// PPB_Flash_API is deprecated in favor of this (the new resource model uses
+// this API).
+class PPAPI_THUNK_EXPORT PPB_Flash_Functions_API {
+ public:
+ virtual ~PPB_Flash_Functions_API() {}
+
+ // PPB_Flash.
+ virtual int32_t EnumerateVideoCaptureDevices(
+ PP_Instance instance,
+ PP_Resource video_capture,
+ const PP_ArrayOutput& devices) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_FLASH_FUNCTIONS_API_H_
diff --git a/ppapi/thunk/ppb_flash_thunk.cc b/ppapi/thunk/ppb_flash_thunk.cc
index 85ca393..b95a724 100644
--- a/ppapi/thunk/ppb_flash_thunk.cc
+++ b/ppapi/thunk/ppb_flash_thunk.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "ppapi/c/pp_array_output.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_flash.h"
#include "ppapi/shared_impl/ppapi_globals.h"
@@ -9,6 +10,7 @@
#include "ppapi/shared_impl/var.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_flash_api.h"
+#include "ppapi/thunk/ppb_flash_functions_api.h"
#include "ppapi/thunk/ppb_instance_api.h"
#include "ppapi/thunk/thunk.h"
@@ -153,6 +155,23 @@ PP_Bool SetCrashData(PP_Instance instance,
return enter.functions()->GetFlashAPI()->SetCrashData(instance, key, value);
}
+int32_t EnumerateVideoCaptureDevices(PP_Instance instance,
+ PP_Resource video_capture,
+ PP_ArrayOutput devices) {
+ EnterInstance enter(instance);
+ if (enter.succeeded()) {
+ PPB_Flash_Functions_API* api =
+ enter.functions()->GetFlashFunctionsAPI(instance);
+ if (api) {
+ return api->EnumerateVideoCaptureDevices(instance, video_capture,
+ devices);
+ } else {
+ return PP_ERROR_NOINTERFACE;
+ }
+ }
+ return PP_ERROR_BADRESOURCE;
+}
+
const PPB_Flash_12_0 g_ppb_flash_12_0_thunk = {
&SetInstanceAlwaysOnTop,
&DrawGlyphs,
@@ -250,6 +269,26 @@ const PPB_Flash_12_5 g_ppb_flash_12_5_thunk = {
&SetCrashData
};
+const PPB_Flash_12_6 g_ppb_flash_12_6_thunk = {
+ &SetInstanceAlwaysOnTop,
+ &DrawGlyphs,
+ &GetProxyForURL,
+ &Navigate,
+ &RunMessageLoop,
+ &QuitMessageLoop,
+ &GetLocalTimeZoneOffset,
+ &GetCommandLineArgs,
+ &PreLoadFontWin,
+ &IsRectTopmost,
+ &InvokePrinting,
+ &UpdateActivity,
+ &GetDeviceID,
+ &GetSettingInt,
+ &GetSetting,
+ &SetCrashData,
+ &EnumerateVideoCaptureDevices
+};
+
} // namespace
const PPB_Flash_12_0* GetPPB_Flash_12_0_Thunk() {
@@ -276,5 +315,9 @@ const PPB_Flash_12_5* GetPPB_Flash_12_5_Thunk() {
return &g_ppb_flash_12_5_thunk;
}
+const PPB_Flash_12_6* GetPPB_Flash_12_6_Thunk() {
+ return &g_ppb_flash_12_6_thunk;
+}
+
} // namespace thunk
} // namespace ppapi
diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h
index b919e31..3038c68 100644
--- a/ppapi/thunk/ppb_instance_api.h
+++ b/ppapi/thunk/ppb_instance_api.h
@@ -37,6 +37,7 @@ struct ViewData;
namespace thunk {
class PPB_Flash_API;
+class PPB_Flash_Functions_API;
class PPB_Gamepad_API;
class PPB_Instance_API {
@@ -87,8 +88,11 @@ class PPB_Instance_API {
PP_Bool fullscreen) = 0;
virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) = 0;
- // Flash.
+ // Flash (Deprecated for Flash_Functions).
virtual PPB_Flash_API* GetFlashAPI() = 0;
+ // Flash_Functions
+ virtual PPB_Flash_Functions_API* GetFlashFunctionsAPI(
+ PP_Instance instance) = 0;
// Gamepad.
virtual PPB_Gamepad_API* GetGamepadAPI(PP_Instance instance) = 0;