summaryrefslogtreecommitdiff
path: root/chromium/ppapi/thunk
diff options
context:
space:
mode:
authorZeno Albisser <zeno.albisser@digia.com>2013-08-15 21:46:11 +0200
committerZeno Albisser <zeno.albisser@digia.com>2013-08-15 21:46:11 +0200
commit679147eead574d186ebf3069647b4c23e8ccace6 (patch)
treefc247a0ac8ff119f7c8550879ebb6d3dd8d1ff69 /chromium/ppapi/thunk
downloadqtwebengine-chromium-679147eead574d186ebf3069647b4c23e8ccace6.tar.gz
Initial import.
Diffstat (limited to 'chromium/ppapi/thunk')
-rw-r--r--chromium/ppapi/thunk/DEPS6
-rw-r--r--chromium/ppapi/thunk/enter.cc322
-rw-r--r--chromium/ppapi/thunk/enter.h333
-rw-r--r--chromium/ppapi/thunk/extensions_common_api.h44
-rw-r--r--chromium/ppapi/thunk/interfaces_legacy.h43
-rw-r--r--chromium/ppapi/thunk/interfaces_postamble.h25
-rw-r--r--chromium/ppapi/thunk/interfaces_ppb_private.h65
-rw-r--r--chromium/ppapi/thunk/interfaces_ppb_private_flash.h58
-rw-r--r--chromium/ppapi/thunk/interfaces_ppb_private_no_permissions.h57
-rw-r--r--chromium/ppapi/thunk/interfaces_ppb_public_dev.h85
-rw-r--r--chromium/ppapi/thunk/interfaces_ppb_public_stable.h103
-rw-r--r--chromium/ppapi/thunk/interfaces_preamble.h31
-rw-r--r--chromium/ppapi/thunk/ppapi_thunk_export.h29
-rw-r--r--chromium/ppapi/thunk/ppb_audio_api.h38
-rw-r--r--chromium/ppapi/thunk/ppb_audio_config_api.h25
-rw-r--r--chromium/ppapi/thunk/ppb_audio_config_thunk.cc105
-rw-r--r--chromium/ppapi/thunk/ppb_audio_input_api.h49
-rw-r--r--chromium/ppapi/thunk/ppb_audio_input_dev_thunk.cc183
-rw-r--r--chromium/ppapi/thunk/ppb_audio_thunk.cc80
-rw-r--r--chromium/ppapi/thunk/ppb_broker_api.h44
-rw-r--r--chromium/ppapi/thunk/ppb_broker_thunk.cc86
-rw-r--r--chromium/ppapi/thunk/ppb_browser_font_singleton_api.h28
-rw-r--r--chromium/ppapi/thunk/ppb_browser_font_trusted_api.h39
-rw-r--r--chromium/ppapi/thunk/ppb_browser_font_trusted_thunk.cc105
-rw-r--r--chromium/ppapi/thunk/ppb_buffer_api.h31
-rw-r--r--chromium/ppapi/thunk/ppb_buffer_thunk.cc65
-rw-r--r--chromium/ppapi/thunk/ppb_char_set_thunk.cc107
-rw-r--r--chromium/ppapi/thunk/ppb_console_thunk.cc51
-rw-r--r--chromium/ppapi/thunk/ppb_content_decryptor_private_thunk.cc169
-rw-r--r--chromium/ppapi/thunk/ppb_cursor_control_thunk.cc60
-rw-r--r--chromium/ppapi/thunk/ppb_device_ref_api.h32
-rw-r--r--chromium/ppapi/thunk/ppb_device_ref_dev_thunk.cc56
-rw-r--r--chromium/ppapi/thunk/ppb_ext_alarms_thunk.cc95
-rw-r--r--chromium/ppapi/thunk/ppb_ext_crx_file_system_private_api.h34
-rw-r--r--chromium/ppapi/thunk/ppb_ext_crx_file_system_private_thunk.cc48
-rw-r--r--chromium/ppapi/thunk/ppb_ext_socket_thunk.cc419
-rw-r--r--chromium/ppapi/thunk/ppb_file_chooser_api.h45
-rw-r--r--chromium/ppapi/thunk/ppb_file_chooser_dev_thunk.cc88
-rw-r--r--chromium/ppapi/thunk/ppb_file_chooser_trusted_thunk.cc72
-rw-r--r--chromium/ppapi/thunk/ppb_file_io_api.h65
-rw-r--r--chromium/ppapi/thunk/ppb_file_io_private_thunk.cc44
-rw-r--r--chromium/ppapi/thunk/ppb_file_io_thunk.cc181
-rw-r--r--chromium/ppapi/thunk/ppb_file_io_trusted_thunk.cc62
-rw-r--r--chromium/ppapi/thunk/ppb_file_ref_api.h70
-rw-r--r--chromium/ppapi/thunk/ppb_file_ref_thunk.cc195
-rw-r--r--chromium/ppapi/thunk/ppb_file_system_api.h29
-rw-r--r--chromium/ppapi/thunk/ppb_file_system_thunk.cc68
-rw-r--r--chromium/ppapi/thunk/ppb_find_dev_thunk.cc50
-rw-r--r--chromium/ppapi/thunk/ppb_flash_clipboard_api.h40
-rw-r--r--chromium/ppapi/thunk/ppb_flash_clipboard_thunk.cc104
-rw-r--r--chromium/ppapi/thunk/ppb_flash_device_id_thunk.cc52
-rw-r--r--chromium/ppapi/thunk/ppb_flash_drm_api.h27
-rw-r--r--chromium/ppapi/thunk/ppb_flash_drm_thunk.cc73
-rw-r--r--chromium/ppapi/thunk/ppb_flash_file_api.h63
-rw-r--r--chromium/ppapi/thunk/ppb_flash_file_fileref_thunk.cc57
-rw-r--r--chromium/ppapi/thunk/ppb_flash_file_modulelocal_thunk.cc111
-rw-r--r--chromium/ppapi/thunk/ppb_flash_font_file_api.h26
-rw-r--r--chromium/ppapi/thunk/ppb_flash_font_file_thunk.cc53
-rw-r--r--chromium/ppapi/thunk/ppb_flash_fullscreen_api.h35
-rw-r--r--chromium/ppapi/thunk/ppb_flash_fullscreen_thunk.cc54
-rw-r--r--chromium/ppapi/thunk/ppb_flash_functions_api.h57
-rw-r--r--chromium/ppapi/thunk/ppb_flash_menu_api.h29
-rw-r--r--chromium/ppapi/thunk/ppb_flash_menu_thunk.cc55
-rw-r--r--chromium/ppapi/thunk/ppb_flash_message_loop_api.h32
-rw-r--r--chromium/ppapi/thunk/ppb_flash_message_loop_thunk.cc56
-rw-r--r--chromium/ppapi/thunk/ppb_flash_print_thunk.cc34
-rw-r--r--chromium/ppapi/thunk/ppb_flash_thunk.cc255
-rw-r--r--chromium/ppapi/thunk/ppb_fullscreen_thunk.cc57
-rw-r--r--chromium/ppapi/thunk/ppb_gamepad_api.h29
-rw-r--r--chromium/ppapi/thunk/ppb_gamepad_thunk.cc44
-rw-r--r--chromium/ppapi/thunk/ppb_gles_chromium_texture_mapping_thunk.cc55
-rw-r--r--chromium/ppapi/thunk/ppb_graphics_2d_api.h47
-rw-r--r--chromium/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc49
-rw-r--r--chromium/ppapi/thunk/ppb_graphics_2d_thunk.cc139
-rw-r--r--chromium/ppapi/thunk/ppb_graphics_3d_api.h63
-rw-r--r--chromium/ppapi/thunk/ppb_graphics_3d_thunk.cc109
-rw-r--r--chromium/ppapi/thunk/ppb_host_resolver_api.h34
-rw-r--r--chromium/ppapi/thunk/ppb_host_resolver_private_api.h35
-rw-r--r--chromium/ppapi/thunk/ppb_host_resolver_private_thunk.cc83
-rw-r--r--chromium/ppapi/thunk/ppb_host_resolver_thunk.cc91
-rw-r--r--chromium/ppapi/thunk/ppb_image_data_api.h57
-rw-r--r--chromium/ppapi/thunk/ppb_image_data_thunk.cc97
-rw-r--r--chromium/ppapi/thunk/ppb_input_event_api.h57
-rw-r--r--chromium/ppapi/thunk/ppb_input_event_thunk.cc540
-rw-r--r--chromium/ppapi/thunk/ppb_instance_api.h200
-rw-r--r--chromium/ppapi/thunk/ppb_instance_private_thunk.cc59
-rw-r--r--chromium/ppapi/thunk/ppb_instance_thunk.cc48
-rw-r--r--chromium/ppapi/thunk/ppb_message_loop_api.h38
-rw-r--r--chromium/ppapi/thunk/ppb_messaging_thunk.cc39
-rw-r--r--chromium/ppapi/thunk/ppb_mouse_cursor_thunk.cc42
-rw-r--r--chromium/ppapi/thunk/ppb_mouse_lock_thunk.cc50
-rw-r--r--chromium/ppapi/thunk/ppb_net_address_api.h31
-rw-r--r--chromium/ppapi/thunk/ppb_net_address_thunk.cc98
-rw-r--r--chromium/ppapi/thunk/ppb_network_list_api.h43
-rw-r--r--chromium/ppapi/thunk/ppb_network_list_private_thunk.cc105
-rw-r--r--chromium/ppapi/thunk/ppb_network_monitor_private_api.h22
-rw-r--r--chromium/ppapi/thunk/ppb_network_monitor_private_thunk.cc45
-rw-r--r--chromium/ppapi/thunk/ppb_network_proxy_api.h38
-rw-r--r--chromium/ppapi/thunk/ppb_network_proxy_thunk.cc47
-rw-r--r--chromium/ppapi/thunk/ppb_pdf_api.h41
-rw-r--r--chromium/ppapi/thunk/ppb_pdf_thunk.cc161
-rw-r--r--chromium/ppapi/thunk/ppb_printing_api.h29
-rw-r--r--chromium/ppapi/thunk/ppb_printing_dev_thunk.cc54
-rw-r--r--chromium/ppapi/thunk/ppb_resource_array_api.h25
-rw-r--r--chromium/ppapi/thunk/ppb_resource_array_dev_thunk.cc67
-rw-r--r--chromium/ppapi/thunk/ppb_scrollbar_api.h29
-rw-r--r--chromium/ppapi/thunk/ppb_scrollbar_thunk.cc95
-rw-r--r--chromium/ppapi/thunk/ppb_talk_private_api.h36
-rw-r--r--chromium/ppapi/thunk/ppb_talk_private_thunk.cc87
-rw-r--r--chromium/ppapi/thunk/ppb_tcp_server_socket_private_api.h34
-rw-r--r--chromium/ppapi/thunk/ppb_tcp_server_socket_private_thunk.cc96
-rw-r--r--chromium/ppapi/thunk/ppb_tcp_socket_api.h41
-rw-r--r--chromium/ppapi/thunk/ppb_tcp_socket_private_api.h51
-rw-r--r--chromium/ppapi/thunk/ppb_tcp_socket_private_thunk.cc194
-rw-r--r--chromium/ppapi/thunk/ppb_tcp_socket_thunk.cc128
-rw-r--r--chromium/ppapi/thunk/ppb_text_input_thunk.cc133
-rw-r--r--chromium/ppapi/thunk/ppb_truetype_font_api.h36
-rw-r--r--chromium/ppapi/thunk/ppb_truetype_font_dev_thunk.cc121
-rw-r--r--chromium/ppapi/thunk/ppb_truetype_font_singleton_api.h40
-rw-r--r--chromium/ppapi/thunk/ppb_udp_socket_api.h42
-rw-r--r--chromium/ppapi/thunk/ppb_udp_socket_private_api.h41
-rw-r--r--chromium/ppapi/thunk/ppb_udp_socket_private_thunk.cc148
-rw-r--r--chromium/ppapi/thunk/ppb_udp_socket_thunk.cc123
-rw-r--r--chromium/ppapi/thunk/ppb_url_loader_api.h57
-rw-r--r--chromium/ppapi/thunk/ppb_url_loader_thunk.cc143
-rw-r--r--chromium/ppapi/thunk/ppb_url_loader_trusted_thunk.cc50
-rw-r--r--chromium/ppapi/thunk/ppb_url_request_info_api.h36
-rw-r--r--chromium/ppapi/thunk/ppb_url_request_info_thunk.cc83
-rw-r--r--chromium/ppapi/thunk/ppb_url_response_info_api.h25
-rw-r--r--chromium/ppapi/thunk/ppb_url_response_info_thunk.cc57
-rw-r--r--chromium/ppapi/thunk/ppb_url_util_thunk.cc74
-rw-r--r--chromium/ppapi/thunk/ppb_var_array_thunk.cc74
-rw-r--r--chromium/ppapi/thunk/ppb_var_dictionary_thunk.cc86
-rw-r--r--chromium/ppapi/thunk/ppb_video_capture_api.h50
-rw-r--r--chromium/ppapi/thunk/ppb_video_capture_thunk.cc149
-rw-r--r--chromium/ppapi/thunk/ppb_video_decoder_api.h34
-rw-r--r--chromium/ppapi/thunk/ppb_video_decoder_thunk.cc96
-rw-r--r--chromium/ppapi/thunk/ppb_video_destination_private_api.h32
-rw-r--r--chromium/ppapi/thunk/ppb_video_destination_private_thunk.cc74
-rw-r--r--chromium/ppapi/thunk/ppb_video_source_private_api.h33
-rw-r--r--chromium/ppapi/thunk/ppb_video_source_private_thunk.cc71
-rw-r--r--chromium/ppapi/thunk/ppb_view_api.h35
-rw-r--r--chromium/ppapi/thunk/ppb_view_dev_thunk.cc49
-rw-r--r--chromium/ppapi/thunk/ppb_view_thunk.cc114
-rw-r--r--chromium/ppapi/thunk/ppb_websocket_api.h84
-rw-r--r--chromium/ppapi/thunk/ppb_websocket_thunk.cc169
-rw-r--r--chromium/ppapi/thunk/ppb_widget_api.h27
-rw-r--r--chromium/ppapi/thunk/ppb_widget_dev_thunk.cc97
-rw-r--r--chromium/ppapi/thunk/ppb_x509_certificate_private_api.h25
-rw-r--r--chromium/ppapi/thunk/ppb_x509_certificate_private_thunk.cc63
-rw-r--r--chromium/ppapi/thunk/ppb_zoom_dev_thunk.cc52
-rw-r--r--chromium/ppapi/thunk/resource_creation_api.h197
-rw-r--r--chromium/ppapi/thunk/thunk.h45
153 files changed, 11856 insertions, 0 deletions
diff --git a/chromium/ppapi/thunk/DEPS b/chromium/ppapi/thunk/DEPS
new file mode 100644
index 00000000000..9509d54b237
--- /dev/null
+++ b/chromium/ppapi/thunk/DEPS
@@ -0,0 +1,6 @@
+include_rules = [
+ # For gpu::CommandBuffer::State
+ "+gpu/command_buffer/common/command_buffer.h",
+ "-ppapi/cpp",
+ "-ppapi/proxy",
+]
diff --git a/chromium/ppapi/thunk/enter.cc b/chromium/ppapi/thunk/enter.cc
new file mode 100644
index 00000000000..bd955b2ca8f
--- /dev/null
+++ b/chromium/ppapi/thunk/enter.cc
@@ -0,0 +1,322 @@
+// 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.
+
+#include "ppapi/thunk/enter.h"
+
+#include "base/bind.h"
+#include "base/logging.h"
+#include "base/message_loop/message_loop.h"
+#include "base/strings/stringprintf.h"
+#include "base/synchronization/lock.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace {
+
+bool IsMainThread() {
+ return
+ PpapiGlobals::Get()->GetMainThreadMessageLoop()->BelongsToCurrentThread();
+}
+
+} // namespace
+
+namespace thunk {
+
+namespace subtle {
+
+void AssertLockHeld() {
+ base::Lock* proxy_lock = PpapiGlobals::Get()->GetProxyLock();
+ // The lock is only valid in the plugin side of the proxy, so it only makes
+ // sense to assert there. Otherwise, silently succeed.
+ if (proxy_lock)
+ proxy_lock->AssertAcquired();
+}
+
+EnterBase::EnterBase()
+ : resource_(NULL),
+ retval_(PP_OK) {
+}
+
+EnterBase::EnterBase(PP_Resource resource)
+ : resource_(GetResource(resource)),
+ retval_(PP_OK) {
+}
+
+EnterBase::EnterBase(PP_Instance instance, SingletonResourceID resource_id)
+ : resource_(GetSingletonResource(instance, resource_id)),
+ retval_(PP_OK) {
+}
+
+EnterBase::EnterBase(PP_Resource resource,
+ const PP_CompletionCallback& callback)
+ : resource_(GetResource(resource)),
+ retval_(PP_OK) {
+ callback_ = new TrackedCallback(resource_, callback);
+}
+
+EnterBase::EnterBase(PP_Instance instance, SingletonResourceID resource_id,
+ const PP_CompletionCallback& callback)
+ : resource_(GetSingletonResource(instance, resource_id)),
+ retval_(PP_OK) {
+ DCHECK(resource_ || !instance);
+ if (!resource_)
+ retval_ = PP_ERROR_BADARGUMENT;
+ callback_ = new TrackedCallback(resource_, callback);
+}
+
+EnterBase::~EnterBase() {
+ // callback_ is cleared any time it is run, scheduled to be run, or once we
+ // know it will be completed asynchronously. So by this point it should be
+ // NULL.
+ DCHECK(!callback_.get())
+ << "|callback_| is not NULL. Did you forget to call "
+ "|EnterBase::SetResult| in the interface's thunk?";
+}
+
+int32_t EnterBase::SetResult(int32_t result) {
+ if (!callback_.get()) {
+ // It doesn't make sense to call SetResult if there is no callback.
+ NOTREACHED();
+ retval_ = result;
+ return result;
+ }
+ if (result == PP_OK_COMPLETIONPENDING) {
+ retval_ = result;
+ if (callback_->is_blocking()) {
+ DCHECK(!IsMainThread()); // We should have returned an error before this.
+ retval_ = callback_->BlockUntilComplete();
+ } else {
+ // The callback is not blocking and the operation will complete
+ // asynchronously, so there's nothing to do.
+ retval_ = result;
+ }
+ } else {
+ // The function completed synchronously.
+ if (callback_->is_required()) {
+ // This is a required callback, so we must issue it asynchronously.
+ callback_->PostRun(result);
+ retval_ = PP_OK_COMPLETIONPENDING;
+ } else {
+ // The callback is blocking or optional, so all we need to do is mark
+ // the callback as completed so that it won't be issued later.
+ callback_->MarkAsCompleted();
+ retval_ = result;
+ }
+ }
+ callback_ = NULL;
+ return retval_;
+}
+
+// static
+Resource* EnterBase::GetResource(PP_Resource resource) {
+ return PpapiGlobals::Get()->GetResourceTracker()->GetResource(resource);
+}
+
+// static
+Resource* EnterBase::GetSingletonResource(PP_Instance instance,
+ SingletonResourceID resource_id) {
+ PPB_Instance_API* ppb_instance =
+ PpapiGlobals::Get()->GetInstanceAPI(instance);
+ if (!ppb_instance)
+ return NULL;
+
+ return ppb_instance->GetSingletonResource(instance, resource_id);
+}
+
+void EnterBase::SetStateForCallbackError(bool report_error) {
+ if (PpapiGlobals::Get()->IsHostGlobals()) {
+ // In-process plugins can't make PPAPI calls off the main thread.
+ CHECK(IsMainThread());
+ }
+ if (callback_.get()) {
+ if (callback_->is_blocking() && IsMainThread()) {
+ // Blocking callbacks are never allowed on the main thread.
+ callback_->MarkAsCompleted();
+ callback_ = NULL;
+ retval_ = PP_ERROR_BLOCKS_MAIN_THREAD;
+ if (report_error) {
+ std::string message(
+ "Blocking callbacks are not allowed on the main thread.");
+ PpapiGlobals::Get()->BroadcastLogWithSource(0, PP_LOGLEVEL_ERROR,
+ std::string(), message);
+ }
+ } else if (!IsMainThread() &&
+ callback_->has_null_target_loop() &&
+ !callback_->is_blocking()) {
+ // On a non-main thread, there must be a valid target loop for non-
+ // blocking callbacks, or we will have no place to run them.
+
+ // If the callback is required, there's no nice way to tell the plugin.
+ // We can't run their callback asynchronously without a message loop, and
+ // the plugin won't expect any return code other than
+ // PP_OK_COMPLETIONPENDING. So we crash to make the problem more obvious.
+ if (callback_->is_required()) {
+ std::string message("Attempted to use a required callback, but there "
+ "is no attached message loop on which to run the "
+ "callback.");
+ PpapiGlobals::Get()->BroadcastLogWithSource(0, PP_LOGLEVEL_ERROR,
+ std::string(), message);
+ LOG(FATAL) << message;
+ }
+
+ callback_->MarkAsCompleted();
+ callback_ = NULL;
+ retval_ = PP_ERROR_NO_MESSAGE_LOOP;
+ if (report_error) {
+ std::string message(
+ "The calling thread must have a message loop attached.");
+ PpapiGlobals::Get()->BroadcastLogWithSource(0, PP_LOGLEVEL_ERROR,
+ std::string(), message);
+ }
+ }
+ }
+}
+
+void EnterBase::ClearCallback() {
+ callback_ = NULL;
+}
+
+void EnterBase::SetStateForResourceError(PP_Resource pp_resource,
+ Resource* resource_base,
+ void* object,
+ bool report_error) {
+ // Check for callback errors. If we get any, SetStateForCallbackError will
+ // emit a log message. But we also want to check for resource errors. If there
+ // are both kinds of errors, we'll emit two log messages and return
+ // PP_ERROR_BADRESOURCE.
+ SetStateForCallbackError(report_error);
+
+ if (object)
+ return; // Everything worked.
+
+ if (callback_.get() && callback_->is_required()) {
+ callback_->PostRun(static_cast<int32_t>(PP_ERROR_BADRESOURCE));
+ callback_ = NULL;
+ retval_ = PP_OK_COMPLETIONPENDING;
+ } else {
+ if (callback_.get())
+ callback_->MarkAsCompleted();
+ callback_ = NULL;
+ retval_ = PP_ERROR_BADRESOURCE;
+ }
+
+ // We choose to silently ignore the error when the pp_resource is null
+ // because this is a pretty common case and we don't want to have lots
+ // of errors in the log. This should be an obvious case to debug.
+ if (report_error && pp_resource) {
+ std::string message;
+ if (resource_base) {
+ message = base::StringPrintf(
+ "0x%X is not the correct type for this function.",
+ pp_resource);
+ } else {
+ message = base::StringPrintf(
+ "0x%X is not a valid resource ID.",
+ pp_resource);
+ }
+ PpapiGlobals::Get()->BroadcastLogWithSource(0, PP_LOGLEVEL_ERROR,
+ std::string(), message);
+ }
+}
+
+void EnterBase::SetStateForFunctionError(PP_Instance pp_instance,
+ void* object,
+ bool report_error) {
+ // Check for callback errors. If we get any, SetStateForCallbackError will
+ // emit a log message. But we also want to check for instance errors. If there
+ // are both kinds of errors, we'll emit two log messages and return
+ // PP_ERROR_BADARGUMENT.
+ SetStateForCallbackError(report_error);
+
+ if (object)
+ return; // Everything worked.
+
+ if (callback_.get() && callback_->is_required()) {
+ callback_->PostRun(static_cast<int32_t>(PP_ERROR_BADARGUMENT));
+ callback_ = NULL;
+ retval_ = PP_OK_COMPLETIONPENDING;
+ } else {
+ if (callback_.get())
+ callback_->MarkAsCompleted();
+ callback_ = NULL;
+ retval_ = PP_ERROR_BADARGUMENT;
+ }
+
+ // We choose to silently ignore the error when the pp_instance is null as
+ // for PP_Resources above.
+ if (report_error && pp_instance) {
+ std::string message;
+ message = base::StringPrintf(
+ "0x%X is not a valid instance ID.",
+ pp_instance);
+ PpapiGlobals::Get()->BroadcastLogWithSource(0, PP_LOGLEVEL_ERROR,
+ std::string(), message);
+ }
+}
+
+} // namespace subtle
+
+EnterInstance::EnterInstance(PP_Instance instance)
+ : EnterBase(),
+ functions_(PpapiGlobals::Get()->GetInstanceAPI(instance)) {
+ SetStateForFunctionError(instance, functions_, true);
+}
+
+EnterInstance::EnterInstance(PP_Instance instance,
+ const PP_CompletionCallback& callback)
+ : EnterBase(0 /* resource */, callback),
+ // TODO(dmichael): This means that the callback_ we get is not associated
+ // even with the instance, but we should handle that for
+ // MouseLock (maybe others?).
+ functions_(PpapiGlobals::Get()->GetInstanceAPI(instance)) {
+ SetStateForFunctionError(instance, functions_, true);
+}
+
+EnterInstance::~EnterInstance() {
+}
+
+EnterInstanceNoLock::EnterInstanceNoLock(PP_Instance instance)
+ : EnterBase(),
+ functions_(PpapiGlobals::Get()->GetInstanceAPI(instance)) {
+ SetStateForFunctionError(instance, functions_, true);
+}
+
+EnterInstanceNoLock::EnterInstanceNoLock(
+ PP_Instance instance,
+ const PP_CompletionCallback& callback)
+ : EnterBase(0 /* resource */, callback),
+ // TODO(dmichael): This means that the callback_ we get is not associated
+ // even with the instance, but we should handle that for
+ // MouseLock (maybe others?).
+ functions_(PpapiGlobals::Get()->GetInstanceAPI(instance)) {
+ SetStateForFunctionError(instance, functions_, true);
+}
+
+EnterInstanceNoLock::~EnterInstanceNoLock() {
+}
+
+EnterResourceCreation::EnterResourceCreation(PP_Instance instance)
+ : EnterBase(),
+ functions_(PpapiGlobals::Get()->GetResourceCreationAPI(instance)) {
+ SetStateForFunctionError(instance, functions_, true);
+}
+
+EnterResourceCreation::~EnterResourceCreation() {
+}
+
+EnterResourceCreationNoLock::EnterResourceCreationNoLock(PP_Instance instance)
+ : EnterBase(),
+ functions_(PpapiGlobals::Get()->GetResourceCreationAPI(instance)) {
+ SetStateForFunctionError(instance, functions_, true);
+}
+
+EnterResourceCreationNoLock::~EnterResourceCreationNoLock() {
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/enter.h b/chromium/ppapi/thunk/enter.h
new file mode 100644
index 00000000000..a5a00720fe0
--- /dev/null
+++ b/chromium/ppapi/thunk/enter.h
@@ -0,0 +1,333 @@
+// 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_ENTER_H_
+#define PPAPI_THUNK_ENTER_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/shared_impl/resource.h"
+#include "ppapi/shared_impl/resource_tracker.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+// Enter* helper objects: These objects wrap a call from the C PPAPI into
+// the internal implementation. They make sure the lock is acquired and will
+// automatically set up some stuff for you.
+//
+// You should always check whether the enter succeeded before using the object.
+// If this fails, then the instance or resource ID supplied was invalid.
+//
+// The |report_error| arguments to the constructor should indicate if errors
+// should be logged to the console. If the calling function expects that the
+// input values are correct (the normal case), this should be set to true. In
+// some case like |IsFoo(PP_Resource)| the caller is questioning whether their
+// handle is this type, and we don't want to report an error if it's not.
+//
+// Resource member functions: EnterResource
+// Automatically interprets the given PP_Resource as a resource ID and sets
+// up the resource object for you.
+
+namespace subtle {
+
+// Assert that we are holding the proxy lock.
+PPAPI_THUNK_EXPORT void AssertLockHeld();
+
+// This helps us define our RAII Enter classes easily. To make an RAII class
+// which locks the proxy lock on construction and unlocks on destruction,
+// inherit from |LockOnEntry<true>| before all other base classes. This ensures
+// that the lock is acquired before any other base class's constructor can run,
+// and that the lock is only released after all other destructors have run.
+// (This order of initialization is guaranteed by C++98/C++11 12.6.2.10).
+//
+// For cases where you don't want to lock, inherit from |LockOnEntry<false>|.
+// This allows us to share more code between Enter* and Enter*NoLock classes.
+template <bool lock_on_entry>
+struct LockOnEntry;
+
+template <>
+struct LockOnEntry<false> {
+#if (!NDEBUG)
+ LockOnEntry() {
+ // You must already hold the lock to use Enter*NoLock.
+ AssertLockHeld();
+ }
+ ~LockOnEntry() {
+ // You must not release the lock before leaving the scope of the
+ // Enter*NoLock.
+ AssertLockHeld();
+ }
+#endif
+};
+
+template <>
+struct LockOnEntry<true> {
+ LockOnEntry() {
+ ppapi::ProxyLock::Acquire();
+ }
+ ~LockOnEntry() {
+ ppapi::ProxyLock::Release();
+ }
+};
+
+// Keep non-templatized since we need non-inline functions here.
+class PPAPI_THUNK_EXPORT EnterBase {
+ public:
+ EnterBase();
+ explicit EnterBase(PP_Resource resource);
+ EnterBase(PP_Instance instance, SingletonResourceID resource_id);
+ EnterBase(PP_Resource resource, const PP_CompletionCallback& callback);
+ EnterBase(PP_Instance instance, SingletonResourceID resource_id,
+ const PP_CompletionCallback& callback);
+ virtual ~EnterBase();
+
+ // Sets the result for calls that use a completion callback. It handles making
+ // sure that "Required" callbacks are scheduled to run asynchronously and
+ // "Blocking" callbacks cause the caller to block. (Interface implementations,
+ // therefore, should not do any special casing based on the type of the
+ // callback.)
+ //
+ // Returns the "retval()". This is to support the typical usage of
+ // return enter.SetResult(...);
+ // without having to write a separate "return enter.retval();" line.
+ int32_t SetResult(int32_t result);
+
+ // Use this value as the return value for the function.
+ int32_t retval() const { return retval_; }
+
+ // All failure conditions cause retval_ to be set to an appropriate error
+ // code.
+ bool succeeded() const { return retval_ == PP_OK; }
+ bool failed() const { return !succeeded(); }
+
+ const scoped_refptr<TrackedCallback>& callback() { return callback_; }
+
+ protected:
+ // Helper function to return a Resource from a PP_Resource. Having this
+ // code be in the non-templatized base keeps us from having to instantiate
+ // it in every template.
+ static Resource* GetResource(PP_Resource resource);
+
+ // Helper function to return a Resource from a PP_Instance and singleton
+ // resource identifier.
+ static Resource* GetSingletonResource(PP_Instance instance,
+ SingletonResourceID resource_id);
+
+ void ClearCallback();
+
+ // Does error handling associated with entering a resource. The resource_base
+ // is the result of looking up the given pp_resource. The object is the
+ // result of converting the base to the desired object (converted to a void*
+ // so this function doesn't have to be templatized). The reason for passing
+ // both resource_base and object is that we can differentiate "bad resource
+ // ID" from "valid resource ID not of the correct type."
+ //
+ // This will set retval_ = PP_ERROR_BADRESOURCE if the object is invalid, and
+ // if report_error is set, log a message to the programmer.
+ void SetStateForResourceError(PP_Resource pp_resource,
+ Resource* resource_base,
+ void* object,
+ bool report_error);
+
+ // Same as SetStateForResourceError except for function API.
+ void SetStateForFunctionError(PP_Instance pp_instance,
+ void* object,
+ bool report_error);
+
+ // For Enter objects that need a resource, we'll store a pointer to the
+ // Resource object so that we don't need to look it up more than once. For
+ // Enter objects with no resource, this will be NULL.
+ Resource* resource_;
+
+ private:
+ bool CallbackIsValid() const;
+
+ // Checks whether the callback is valid (i.e., if it is either non-blocking,
+ // or blocking and we're on a background thread). If the callback is invalid,
+ // this will set retval_ = PP_ERROR_BLOCKS_MAIN_THREAD, and if report_error is
+ // set, it will log a message to the programmer.
+ void SetStateForCallbackError(bool report_error);
+
+ // Holds the callback. For Enter objects that aren't given a callback, this
+ // will be NULL.
+ scoped_refptr<TrackedCallback> callback_;
+
+ int32_t retval_;
+};
+
+} // namespace subtle
+
+// EnterResource ---------------------------------------------------------------
+
+template<typename ResourceT, bool lock_on_entry = true>
+class EnterResource
+ : public subtle::LockOnEntry<lock_on_entry>, // Must be first; see above.
+ public subtle::EnterBase {
+ public:
+ EnterResource(PP_Resource resource, bool report_error)
+ : EnterBase(resource) {
+ Init(resource, report_error);
+ }
+ EnterResource(PP_Resource resource, const PP_CompletionCallback& callback,
+ bool report_error)
+ : EnterBase(resource, callback) {
+ Init(resource, report_error);
+ }
+ ~EnterResource() {}
+
+ ResourceT* object() { return object_; }
+ Resource* resource() { return resource_; }
+
+ private:
+ void Init(PP_Resource resource, bool report_error) {
+ if (resource_)
+ object_ = resource_->GetAs<ResourceT>();
+ else
+ object_ = NULL;
+ // Validate the resource (note, if both are wrong, we will return
+ // PP_ERROR_BADRESOURCE; last in wins).
+ SetStateForResourceError(resource, resource_, object_, report_error);
+ }
+
+ ResourceT* object_;
+
+ DISALLOW_COPY_AND_ASSIGN(EnterResource);
+};
+
+// ----------------------------------------------------------------------------
+
+// Like EnterResource but assumes the lock is already held.
+template<typename ResourceT>
+class EnterResourceNoLock : public EnterResource<ResourceT, false> {
+ public:
+ EnterResourceNoLock(PP_Resource resource, bool report_error)
+ : EnterResource<ResourceT, false>(resource, report_error) {
+ }
+ EnterResourceNoLock(PP_Resource resource,
+ const PP_CompletionCallback& callback,
+ bool report_error)
+ : EnterResource<ResourceT, false>(resource, callback, report_error) {
+ }
+};
+
+// EnterInstance ---------------------------------------------------------------
+
+class PPAPI_THUNK_EXPORT EnterInstance
+ : public subtle::LockOnEntry<true>, // Must be first; see above.
+ public subtle::EnterBase {
+ public:
+ explicit EnterInstance(PP_Instance instance);
+ EnterInstance(PP_Instance instance,
+ const PP_CompletionCallback& callback);
+ ~EnterInstance();
+
+ bool succeeded() const { return !!functions_; }
+ bool failed() const { return !functions_; }
+
+ PPB_Instance_API* functions() const { return functions_; }
+
+ private:
+ PPB_Instance_API* functions_;
+};
+
+class PPAPI_THUNK_EXPORT EnterInstanceNoLock
+ : public subtle::LockOnEntry<false>, // Must be first; see above.
+ public subtle::EnterBase {
+ public:
+ explicit EnterInstanceNoLock(PP_Instance instance);
+ EnterInstanceNoLock(PP_Instance instance,
+ const PP_CompletionCallback& callback);
+ ~EnterInstanceNoLock();
+
+ PPB_Instance_API* functions() { return functions_; }
+
+ private:
+ PPB_Instance_API* functions_;
+};
+
+// EnterInstanceAPI ------------------------------------------------------------
+
+template<typename ApiT, bool lock_on_entry = true>
+class EnterInstanceAPI
+ : public subtle::LockOnEntry<lock_on_entry>, // Must be first; see above
+ public subtle::EnterBase {
+ public:
+ explicit EnterInstanceAPI(PP_Instance instance)
+ : EnterBase(instance, ApiT::kSingletonResourceID),
+ functions_(NULL) {
+ if (resource_)
+ functions_ = resource_->GetAs<ApiT>();
+ SetStateForFunctionError(instance, functions_, true);
+ }
+ EnterInstanceAPI(PP_Instance instance,
+ const PP_CompletionCallback& callback)
+ : EnterBase(instance, ApiT::kSingletonResourceID, callback),
+ functions_(NULL) {
+ if (resource_)
+ functions_ = resource_->GetAs<ApiT>();
+ SetStateForFunctionError(instance, functions_, true);
+ }
+ ~EnterInstanceAPI() {}
+
+ bool succeeded() const { return !!functions_; }
+ bool failed() const { return !functions_; }
+
+ ApiT* functions() const { return functions_; }
+
+ private:
+ ApiT* functions_;
+};
+
+template<typename ApiT>
+class EnterInstanceAPINoLock : public EnterInstanceAPI<ApiT, false> {
+ public:
+ explicit EnterInstanceAPINoLock(PP_Instance instance)
+ : EnterInstanceAPI<ApiT, false>(instance) {
+ }
+};
+
+// EnterResourceCreation -------------------------------------------------------
+
+class PPAPI_THUNK_EXPORT EnterResourceCreation
+ : public subtle::LockOnEntry<true>, // Must be first; see above.
+ public subtle::EnterBase {
+ public:
+ explicit EnterResourceCreation(PP_Instance instance);
+ ~EnterResourceCreation();
+
+ ResourceCreationAPI* functions() { return functions_; }
+
+ private:
+ ResourceCreationAPI* functions_;
+};
+
+class PPAPI_THUNK_EXPORT EnterResourceCreationNoLock
+ : public subtle::LockOnEntry<false>, // Must be first; see above.
+ public subtle::EnterBase {
+ public:
+ explicit EnterResourceCreationNoLock(PP_Instance instance);
+ ~EnterResourceCreationNoLock();
+
+ ResourceCreationAPI* functions() { return functions_; }
+
+ private:
+ ResourceCreationAPI* functions_;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_ENTER_H_
diff --git a/chromium/ppapi/thunk/extensions_common_api.h b/chromium/ppapi/thunk/extensions_common_api.h
new file mode 100644
index 00000000000..5afb73fac90
--- /dev/null
+++ b/chromium/ppapi/thunk/extensions_common_api.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2013 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_EXTENSIONS_COMMON_API_H_
+#define PPAPI_THUNK_EXTENSIONS_COMMON_API_H_
+
+#include <string>
+#include <vector>
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT ExtensionsCommon_API {
+ public:
+ virtual ~ExtensionsCommon_API() {}
+
+ virtual int32_t CallRenderer(const std::string& request_name,
+ const std::vector<PP_Var>& input_args,
+ const std::vector<PP_Var*>& output_args,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual void PostRenderer(const std::string& request_name,
+ const std::vector<PP_Var>& args) = 0;
+ virtual int32_t CallBrowser(const std::string& request_name,
+ const std::vector<PP_Var>& input_args,
+ const std::vector<PP_Var*>& output_args,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual void PostBrowser(const std::string& request_name,
+ const std::vector<PP_Var>& args) = 0;
+
+ static const SingletonResourceID kSingletonResourceID =
+ EXTENSIONS_COMMON_SINGLETON_ID;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_EXTENSIONS_COMMON_API_H_
diff --git a/chromium/ppapi/thunk/interfaces_legacy.h b/chromium/ppapi/thunk/interfaces_legacy.h
new file mode 100644
index 00000000000..6e53ea45802
--- /dev/null
+++ b/chromium/ppapi/thunk/interfaces_legacy.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2013 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 LEGACY_IFACE
+#define LEGACY_IFACE(iface_str, function_name)
+#endif
+
+LEGACY_IFACE(PPB_INPUT_EVENT_INTERFACE_1_0,
+ ::ppapi::thunk::GetPPB_InputEvent_1_0_Thunk())
+LEGACY_IFACE(PPB_INSTANCE_PRIVATE_INTERFACE_0_1,
+ ::ppapi::thunk::GetPPB_Instance_Private_0_1_Thunk())
+LEGACY_IFACE(PPB_CORE_INTERFACE_1_0, &core_interface)
+LEGACY_IFACE(PPB_GPUBLACKLIST_PRIVATE_INTERFACE,
+ PPB_GpuBlacklist_Private_Impl::GetInterface())
+LEGACY_IFACE(PPB_OPENGLES2_INTERFACE,
+ ::ppapi::PPB_OpenGLES2_Shared::GetInterface())
+LEGACY_IFACE(PPB_OPENGLES2_INSTANCEDARRAYS_INTERFACE,
+ ::ppapi::PPB_OpenGLES2_Shared::GetInstancedArraysInterface())
+LEGACY_IFACE(PPB_OPENGLES2_FRAMEBUFFERBLIT_INTERFACE,
+ ::ppapi::PPB_OpenGLES2_Shared::GetFramebufferBlitInterface())
+LEGACY_IFACE(
+ PPB_OPENGLES2_FRAMEBUFFERMULTISAMPLE_INTERFACE,
+ ::ppapi::PPB_OpenGLES2_Shared::GetFramebufferMultisampleInterface())
+LEGACY_IFACE(PPB_OPENGLES2_CHROMIUMENABLEFEATURE_INTERFACE,
+ ::ppapi::PPB_OpenGLES2_Shared::GetChromiumEnableFeatureInterface())
+LEGACY_IFACE(PPB_OPENGLES2_CHROMIUMMAPSUB_INTERFACE,
+ ::ppapi::PPB_OpenGLES2_Shared::GetChromiumMapSubInterface())
+LEGACY_IFACE(PPB_OPENGLES2_CHROMIUMMAPSUB_DEV_INTERFACE_1_0,
+ ::ppapi::PPB_OpenGLES2_Shared::GetChromiumMapSubInterface())
+LEGACY_IFACE(PPB_OPENGLES2_QUERY_INTERFACE,
+ ::ppapi::PPB_OpenGLES2_Shared::GetQueryInterface())
+LEGACY_IFACE(PPB_PROXY_PRIVATE_INTERFACE, PPB_Proxy_Impl::GetInterface())
+LEGACY_IFACE(PPB_UMA_PRIVATE_INTERFACE, PPB_UMA_Private_Impl::GetInterface())
+LEGACY_IFACE(PPB_VAR_DEPRECATED_INTERFACE,
+ PPB_Var_Deprecated_Impl::GetVarDeprecatedInterface())
+LEGACY_IFACE(PPB_VAR_INTERFACE_1_0,
+ ::ppapi::PPB_Var_Shared::GetVarInterface1_0())
+LEGACY_IFACE(PPB_VAR_INTERFACE_1_1,
+ ::ppapi::PPB_Var_Shared::GetVarInterface1_1())
+LEGACY_IFACE(PPB_VAR_ARRAY_BUFFER_INTERFACE_1_0,
+ ::ppapi::PPB_Var_Shared::GetVarArrayBufferInterface1_0())
+
+
diff --git a/chromium/ppapi/thunk/interfaces_postamble.h b/chromium/ppapi/thunk/interfaces_postamble.h
new file mode 100644
index 00000000000..cebfe74e5d2
--- /dev/null
+++ b/chromium/ppapi/thunk/interfaces_postamble.h
@@ -0,0 +1,25 @@
+// 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.
+
+// Cleans up after interfaces_preamble.h, see that file for more.
+
+#ifdef UNDEFINE_PROXIED_API
+#undef UNDEFINE_PROXIED_API
+#undef PROXIED_API
+#endif
+
+#ifdef UNDEFINE_UNPROXIED_API
+#undef UNDEFINE_UNPROXIED_API
+#undef UNPROXIED_API
+#endif
+
+#ifdef UNDEFINE_PROXIED_IFACE
+#undef UNDEFINE_PROXIED_IFACE
+#undef PROXIED_IFACE
+#endif
+
+#ifdef UNDEFINE_UNPROXIED_IFACE
+#undef UNDEFINE_UNPROXIED_IFACE
+#undef UNPROXIED_IFACE
+#endif
diff --git a/chromium/ppapi/thunk/interfaces_ppb_private.h b/chromium/ppapi/thunk/interfaces_ppb_private.h
new file mode 100644
index 00000000000..3e0289cc3c7
--- /dev/null
+++ b/chromium/ppapi/thunk/interfaces_ppb_private.h
@@ -0,0 +1,65 @@
+// 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.
+
+// Please see inteface_ppb_public_stable for the documentation on the format of
+// this file.
+
+#include "ppapi/thunk/interfaces_preamble.h"
+
+// See interfaces_ppb_private_no_permissions.h for other private interfaces.
+
+PROXIED_API(PPB_X509Certificate_Private)
+
+PROXIED_IFACE(PPB_X509Certificate_Private,
+ PPB_X509CERTIFICATE_PRIVATE_INTERFACE_0_1,
+ PPB_X509Certificate_Private_0_1)
+
+#if !defined(OS_NACL)
+PROXIED_API(PPB_Broker)
+
+PROXIED_IFACE(PPB_Broker, PPB_BROKER_TRUSTED_INTERFACE_0_2,
+ PPB_BrokerTrusted_0_2)
+PROXIED_IFACE(PPB_Broker, PPB_BROKER_TRUSTED_INTERFACE_0_3,
+ PPB_BrokerTrusted_0_3)
+PROXIED_IFACE(PPB_Instance, PPB_BROWSERFONT_TRUSTED_INTERFACE_1_0,
+ PPB_BrowserFont_Trusted_1_0)
+PROXIED_IFACE(PPB_Instance,
+ PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_6,
+ PPB_ContentDecryptor_Private_0_6)
+PROXIED_IFACE(PPB_Instance, PPB_CHARSET_TRUSTED_INTERFACE_1_0,
+ PPB_CharSet_Trusted_1_0)
+PROXIED_IFACE(NoAPIName, PPB_FILECHOOSER_TRUSTED_INTERFACE_0_5,
+ PPB_FileChooserTrusted_0_5)
+PROXIED_IFACE(NoAPIName, PPB_FILECHOOSER_TRUSTED_INTERFACE_0_6,
+ PPB_FileChooserTrusted_0_6)
+PROXIED_IFACE(PPB_FileRef, PPB_FILEREFPRIVATE_INTERFACE_0_1,
+ PPB_FileRefPrivate_0_1)
+// TODO(xhwang): Move PPB_Flash_DeviceID back to interfaces_ppb_private_flash.h.
+PROXIED_IFACE(NoAPIName, PPB_FLASH_DEVICEID_INTERFACE_1_0,
+ PPB_Flash_DeviceID_1_0)
+PROXIED_IFACE(PPB_Instance, PPB_FLASHFULLSCREEN_INTERFACE_0_1,
+ PPB_FlashFullscreen_0_1)
+PROXIED_IFACE(PPB_Instance, PPB_FLASHFULLSCREEN_INTERFACE_1_0,
+ PPB_FlashFullscreen_0_1)
+PROXIED_IFACE(NoAPIName, PPB_PDF_INTERFACE,
+ PPB_PDF)
+
+PROXIED_IFACE(NoAPIName, PPB_TALK_PRIVATE_INTERFACE_1_0,
+ PPB_Talk_Private_1_0)
+PROXIED_IFACE(NoAPIName, PPB_TALK_PRIVATE_INTERFACE_2_0,
+ PPB_Talk_Private_2_0)
+// This uses the FileIO API which is declared in the public stable file.
+PROXIED_IFACE(NoAPIName, PPB_FILEIOTRUSTED_INTERFACE_0_4, PPB_FileIOTrusted_0_4)
+
+PROXIED_IFACE(NoAPIName, PPB_URLLOADERTRUSTED_INTERFACE_0_3,
+ PPB_URLLoaderTrusted_0_3)
+
+// Hack to keep font working. The Font 0.6 API is binary compatible with
+// BrowserFont 1.0, so just map the string to the same thing.
+// TODO(brettw) remove support for the old Font API.
+PROXIED_IFACE(PPB_Instance, PPB_FONT_DEV_INTERFACE_0_6,
+ PPB_BrowserFont_Trusted_1_0)
+#endif // !defined(OS_NACL)
+
+#include "ppapi/thunk/interfaces_postamble.h"
diff --git a/chromium/ppapi/thunk/interfaces_ppb_private_flash.h b/chromium/ppapi/thunk/interfaces_ppb_private_flash.h
new file mode 100644
index 00000000000..facfdebc620
--- /dev/null
+++ b/chromium/ppapi/thunk/interfaces_ppb_private_flash.h
@@ -0,0 +1,58 @@
+// 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.
+
+// Please see inteface_ppb_public_stable for the documentation on the format of
+// this file.
+
+#include "ppapi/thunk/interfaces_preamble.h"
+
+PROXIED_IFACE(NoAPIName,
+ PPB_FLASH_INTERFACE_12_4,
+ PPB_Flash_12_4)
+PROXIED_IFACE(NoAPIName,
+ PPB_FLASH_INTERFACE_12_5,
+ PPB_Flash_12_5)
+PROXIED_IFACE(NoAPIName,
+ PPB_FLASH_INTERFACE_12_6,
+ PPB_Flash_12_6)
+PROXIED_IFACE(NoAPIName,
+ PPB_FLASH_INTERFACE_13_0,
+ PPB_Flash_13_0)
+
+PROXIED_IFACE(NoAPIName,
+ PPB_FLASH_FILE_MODULELOCAL_INTERFACE_3_0,
+ PPB_Flash_File_ModuleLocal_3_0)
+PROXIED_IFACE(NoAPIName,
+ PPB_FLASH_FILE_FILEREF_INTERFACE,
+ PPB_Flash_File_FileRef)
+
+PROXIED_IFACE(NoAPIName,
+ PPB_FLASH_CLIPBOARD_INTERFACE_4_0,
+ PPB_Flash_Clipboard_4_0)
+PROXIED_IFACE(NoAPIName,
+ PPB_FLASH_CLIPBOARD_INTERFACE_5_0,
+ PPB_Flash_Clipboard_5_0)
+
+PROXIED_IFACE(NoAPIName,
+ PPB_FLASH_DRM_INTERFACE_1_0,
+ PPB_Flash_DRM_1_0)
+
+PROXIED_IFACE(NoAPIName,
+ PPB_FLASH_FONTFILE_INTERFACE_0_1,
+ PPB_Flash_FontFile_0_1)
+
+PROXIED_IFACE(NoAPIName,
+ PPB_FLASH_MENU_INTERFACE_0_2,
+ PPB_Flash_Menu_0_2)
+
+PROXIED_API(PPB_Flash_MessageLoop)
+PROXIED_IFACE(PPB_Flash_MessageLoop,
+ PPB_FLASH_MESSAGELOOP_INTERFACE_0_1,
+ PPB_Flash_MessageLoop_0_1)
+
+PROXIED_IFACE(NoAPIName,
+ PPB_FLASH_PRINT_INTERFACE_1_0,
+ PPB_Flash_Print_1_0)
+
+#include "ppapi/thunk/interfaces_postamble.h"
diff --git a/chromium/ppapi/thunk/interfaces_ppb_private_no_permissions.h b/chromium/ppapi/thunk/interfaces_ppb_private_no_permissions.h
new file mode 100644
index 00000000000..44cbc3658fa
--- /dev/null
+++ b/chromium/ppapi/thunk/interfaces_ppb_private_no_permissions.h
@@ -0,0 +1,57 @@
+// 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.
+
+// Please see inteface_ppb_public_stable for the documentation on the format of
+// this file.
+
+#include "ppapi/thunk/interfaces_preamble.h"
+
+// These interfaces don't require private permissions. However, they only work
+// for whitelisted origins.
+PROXIED_API(PPB_TCPSocket_Private)
+UNPROXIED_API(PPB_NetworkList_Private)
+PROXIED_API(PPB_NetworkMonitor_Private)
+
+PROXIED_IFACE(NoAPIName, PPB_HOSTRESOLVER_PRIVATE_INTERFACE_0_1,
+ PPB_HostResolver_Private_0_1)
+PROXIED_IFACE(NoAPIName, PPB_TCPSERVERSOCKET_PRIVATE_INTERFACE_0_1,
+ PPB_TCPServerSocket_Private_0_1)
+PROXIED_IFACE(NoAPIName, PPB_TCPSERVERSOCKET_PRIVATE_INTERFACE_0_2,
+ PPB_TCPServerSocket_Private_0_2)
+PROXIED_IFACE(PPB_TCPSocket_Private, PPB_TCPSOCKET_PRIVATE_INTERFACE_0_3,
+ PPB_TCPSocket_Private_0_3)
+PROXIED_IFACE(PPB_TCPSocket_Private, PPB_TCPSOCKET_PRIVATE_INTERFACE_0_4,
+ PPB_TCPSocket_Private_0_4)
+PROXIED_IFACE(PPB_TCPSocket_Private, PPB_TCPSOCKET_PRIVATE_INTERFACE_0_5,
+ PPB_TCPSocket_Private_0_5)
+PROXIED_IFACE(NoAPIName, PPB_UDPSOCKET_PRIVATE_INTERFACE_0_2,
+ PPB_UDPSocket_Private_0_2)
+PROXIED_IFACE(NoAPIName, PPB_UDPSOCKET_PRIVATE_INTERFACE_0_3,
+ PPB_UDPSocket_Private_0_3)
+PROXIED_IFACE(NoAPIName, PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4,
+ PPB_UDPSocket_Private_0_4)
+
+PROXIED_IFACE(NoAPIName, PPB_NETADDRESS_PRIVATE_INTERFACE_0_1,
+ PPB_NetAddress_Private_0_1)
+PROXIED_IFACE(NoAPIName, PPB_NETADDRESS_PRIVATE_INTERFACE_1_0,
+ PPB_NetAddress_Private_1_0)
+PROXIED_IFACE(NoAPIName, PPB_NETADDRESS_PRIVATE_INTERFACE_1_1,
+ PPB_NetAddress_Private_1_1)
+PROXIED_IFACE(NoAPIName, PPB_NETWORKLIST_PRIVATE_INTERFACE_0_2,
+ PPB_NetworkList_Private_0_2)
+PROXIED_IFACE(PPB_NetworkMonitor_Private,
+ PPB_NETWORKMONITOR_PRIVATE_INTERFACE_0_2,
+ PPB_NetworkMonitor_Private_0_2)
+
+PROXIED_IFACE(NoAPIName, PPB_EXT_CRXFILESYSTEM_PRIVATE_INTERFACE_0_1,
+ PPB_Ext_CrxFileSystem_Private_0_1)
+PROXIED_IFACE(NoAPIName, PPB_FILEIO_PRIVATE_INTERFACE_0_1,
+ PPB_FileIO_Private_0_1)
+
+PROXIED_IFACE(NoAPIName, PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1,
+ PPB_VideoDestination_Private_0_1)
+PROXIED_IFACE(NoAPIName, PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1,
+ PPB_VideoSource_Private_0_1)
+
+#include "ppapi/thunk/interfaces_postamble.h"
diff --git a/chromium/ppapi/thunk/interfaces_ppb_public_dev.h b/chromium/ppapi/thunk/interfaces_ppb_public_dev.h
new file mode 100644
index 00000000000..ca487aac253
--- /dev/null
+++ b/chromium/ppapi/thunk/interfaces_ppb_public_dev.h
@@ -0,0 +1,85 @@
+// 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.
+
+// Please see inteface_ppb_public_stable for the documentation on the format of
+// this file.
+
+#include "ppapi/thunk/interfaces_preamble.h"
+
+// Map the old dev console interface to the stable one (which is the same) to
+// keep Flash, etc. working.
+PROXIED_IFACE(PPB_Instance, "PPB_Console(Dev);0.1", PPB_Console_1_0)
+PROXIED_IFACE(NoAPIName, PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4,
+ PPB_CursorControl_Dev_0_4)
+PROXIED_IFACE(NoAPIName, PPB_EXT_ALARMS_DEV_INTERFACE_0_1,
+ PPB_Ext_Alarms_Dev_0_1)
+PROXIED_IFACE(NoAPIName, PPB_EXT_SOCKET_DEV_INTERFACE_0_1,
+ PPB_Ext_Socket_Dev_0_1)
+PROXIED_IFACE(NoAPIName, PPB_EXT_SOCKET_DEV_INTERFACE_0_2,
+ PPB_Ext_Socket_Dev_0_2)
+PROXIED_IFACE(NoAPIName, PPB_FILECHOOSER_DEV_INTERFACE_0_5,
+ PPB_FileChooser_Dev_0_5)
+PROXIED_IFACE(NoAPIName, PPB_FILECHOOSER_DEV_INTERFACE_0_6,
+ PPB_FileChooser_Dev_0_6)
+UNPROXIED_IFACE(PPB_Find, PPB_FIND_DEV_INTERFACE_0_3, PPB_Find_Dev_0_3)
+PROXIED_IFACE(NoAPIName, PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_2,
+ PPB_IMEInputEvent_Dev_0_2)
+PROXIED_IFACE(NoAPIName, PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE_0_1,
+ PPB_KeyboardInputEvent_Dev_0_1)
+PROXIED_IFACE(NoAPIName, PPB_MEMORY_DEV_INTERFACE_0_1, PPB_Memory_Dev_0_1)
+PROXIED_IFACE(NoAPIName, PPB_PRINTING_DEV_INTERFACE_0_7,
+ PPB_Printing_Dev_0_7)
+PROXIED_IFACE(NoAPIName, PPB_RESOURCEARRAY_DEV_INTERFACE_0_1,
+ PPB_ResourceArray_Dev_0_1)
+PROXIED_IFACE(PPB_Instance, PPB_TEXTINPUT_DEV_INTERFACE_0_2,
+ PPB_TextInput_Dev_0_2)
+PROXIED_IFACE(NoAPIName, PPB_TRUETYPEFONT_DEV_INTERFACE_0_1,
+ PPB_TrueTypeFont_Dev_0_1)
+PROXIED_IFACE(NoAPIName, PPB_VIEW_DEV_INTERFACE_0_1,
+ PPB_View_Dev_0_1)
+UNPROXIED_IFACE(PPB_Instance, PPB_ZOOM_DEV_INTERFACE_0_2, PPB_Zoom_Dev_0_2)
+PROXIED_IFACE(PPB_Instance, PPB_TRACE_EVENT_DEV_INTERFACE_0_1,
+ PPB_Trace_Event_Dev_0_1)
+PROXIED_IFACE(PPB_Instance, PPB_TRACE_EVENT_DEV_INTERFACE_0_2,
+ PPB_Trace_Event_Dev_0_2)
+
+#if !defined(OS_NACL)
+PROXIED_API(PPB_Buffer)
+UNPROXIED_API(PPB_Scrollbar)
+PROXIED_API(PPB_VideoDecoder)
+UNPROXIED_API(PPB_Widget)
+
+PROXIED_IFACE(NoAPIName, PPB_AUDIO_INPUT_DEV_INTERFACE_0_2,
+ PPB_AudioInput_Dev_0_2)
+PROXIED_IFACE(NoAPIName, PPB_AUDIO_INPUT_DEV_INTERFACE_0_3,
+ PPB_AudioInput_Dev_0_3)
+PROXIED_IFACE(NoAPIName, PPB_AUDIO_INPUT_DEV_INTERFACE_0_4,
+ PPB_AudioInput_Dev_0_4)
+PROXIED_IFACE(NoAPIName, PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_1,
+ PPB_IMEInputEvent_Dev_0_1)
+PROXIED_IFACE(PPB_Buffer, PPB_BUFFER_DEV_INTERFACE_0_4, PPB_Buffer_Dev_0_4)
+PROXIED_IFACE(PPB_Graphics3D,
+ PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE_0_1,
+ PPB_GLESChromiumTextureMapping_Dev_0_1)
+PROXIED_IFACE(NoAPIName, PPB_CRYPTO_DEV_INTERFACE_0_1, PPB_Crypto_Dev_0_1)
+PROXIED_IFACE(NoAPIName, PPB_DEVICEREF_DEV_INTERFACE_0_1, PPB_DeviceRef_Dev_0_1)
+PROXIED_IFACE(NoAPIName, PPB_GRAPHICS2D_DEV_INTERFACE_0_1,
+ PPB_Graphics2D_Dev_0_1)
+PROXIED_IFACE(PPB_Instance, PPB_CHAR_SET_DEV_INTERFACE_0_4, PPB_CharSet_Dev_0_4)
+PROXIED_IFACE(PPB_Instance, PPB_URLUTIL_DEV_INTERFACE_0_6, PPB_URLUtil_Dev_0_6)
+UNPROXIED_IFACE(PPB_Scrollbar, PPB_SCROLLBAR_DEV_INTERFACE_0_5,
+ PPB_Scrollbar_Dev_0_5)
+PROXIED_IFACE(PPB_Instance, PPB_TEXTINPUT_DEV_INTERFACE_0_1,
+ PPB_TextInput_Dev_0_1)
+PROXIED_IFACE(NoAPIName, PPB_VIDEOCAPTURE_DEV_INTERFACE_0_2,
+ PPB_VideoCapture_Dev_0_2)
+PROXIED_IFACE(NoAPIName, PPB_VIDEOCAPTURE_DEV_INTERFACE_0_3,
+ PPB_VideoCapture_Dev_0_3)
+PROXIED_IFACE(PPB_VideoDecoder, PPB_VIDEODECODER_DEV_INTERFACE_0_16,
+ PPB_VideoDecoder_Dev_0_16)
+UNPROXIED_IFACE(PPB_Widget, PPB_WIDGET_DEV_INTERFACE_0_3, PPB_Widget_Dev_0_3)
+UNPROXIED_IFACE(PPB_Widget, PPB_WIDGET_DEV_INTERFACE_0_4, PPB_Widget_Dev_0_4)
+#endif // !defined(OS_NACL)
+
+#include "ppapi/thunk/interfaces_postamble.h"
diff --git a/chromium/ppapi/thunk/interfaces_ppb_public_stable.h b/chromium/ppapi/thunk/interfaces_ppb_public_stable.h
new file mode 100644
index 00000000000..b0918a3f056
--- /dev/null
+++ b/chromium/ppapi/thunk/interfaces_ppb_public_stable.h
@@ -0,0 +1,103 @@
+// 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.
+
+#include "ppapi/thunk/interfaces_preamble.h"
+
+// This file contains lists of interfaces. It's intended to be included by
+// another file which defines implementations of the macros. This allows files
+// to do specific registration tasks for each supported interface.
+
+
+// Api categories
+// --------------
+// Enumerates the categories of APIs. These correspnd to the *_api.h files in
+// this directory. One API may implement one or more actual interfaces.
+//
+// For PROXIED_APIs, these also correspond to *_Proxy objects. The proxied ones
+// define factory functions for each of these classes. UNPROXIED_APIs are ones
+// that exist in the webkit/plugins/ppapi/*_impl.h, but not in the proxy.
+PROXIED_API(PPB_Audio)
+PROXIED_API(PPB_Core)
+PROXIED_API(PPB_FileRef)
+PROXIED_API(PPB_Graphics3D)
+PROXIED_API(PPB_ImageData)
+PROXIED_API(PPB_Instance)
+PROXIED_API(PPB_TCPSocket)
+
+// AudioConfig isn't proxied in the normal way, we have only local classes and
+// serialize it to a struct when we need it on the host side.
+UNPROXIED_API(PPB_AudioConfig)
+
+// Interfaces
+// ----------
+// Enumerates interfaces as (api_name, interface_name, interface_struct).
+//
+// The api_name corresponds to the class in the list above for the object
+// that implements the API. Some things may be special and aren't implemented
+// by any specific API object, and we use "NoAPIName" for those. Implementors
+// of these macros should handle this case. There can be more than one line
+// referring to the same api_name (typically different versions of the
+// same interface).
+//
+// The interface_name is the string that corresponds to the interface.
+//
+// The interface_struct is the typename of the struct corresponding to the
+// interface string.
+// Note: Core is special and is registered manually.
+PROXIED_IFACE(PPB_Audio, PPB_AUDIO_INTERFACE_1_0, PPB_Audio_1_0)
+PROXIED_IFACE(PPB_FileRef, PPB_FILEREF_INTERFACE_1_0, PPB_FileRef_1_0)
+PROXIED_IFACE(PPB_FileRef, PPB_FILEREF_INTERFACE_1_1, PPB_FileRef_1_1)
+PROXIED_IFACE(NoAPIName, PPB_FILESYSTEM_INTERFACE_1_0, PPB_FileSystem_1_0)
+PROXIED_IFACE(PPB_Graphics3D, PPB_GRAPHICS_3D_INTERFACE_1_0, PPB_Graphics3D_1_0)
+PROXIED_IFACE(PPB_ImageData, PPB_IMAGEDATA_INTERFACE_1_0, PPB_ImageData_1_0)
+PROXIED_IFACE(PPB_Instance, PPB_CONSOLE_INTERFACE_1_0, PPB_Console_1_0)
+PROXIED_IFACE(PPB_Instance, PPB_GAMEPAD_INTERFACE_1_0, PPB_Gamepad_1_0)
+PROXIED_IFACE(PPB_Instance, PPB_INSTANCE_INTERFACE_1_0, PPB_Instance_1_0)
+PROXIED_IFACE(NoAPIName, PPB_FILEIO_INTERFACE_1_0, PPB_FileIO_1_0)
+PROXIED_IFACE(NoAPIName, PPB_FILEIO_INTERFACE_1_1, PPB_FileIO_1_1)
+PROXIED_IFACE(NoAPIName, PPB_GRAPHICS_2D_INTERFACE_1_0, PPB_Graphics2D_1_0)
+PROXIED_IFACE(NoAPIName, PPB_GRAPHICS_2D_INTERFACE_1_1, PPB_Graphics2D_1_1)
+PROXIED_IFACE(NoAPIName, PPB_HOSTRESOLVER_INTERFACE_1_0, PPB_HostResolver_1_0)
+PROXIED_IFACE(NoAPIName, PPB_IME_INPUT_EVENT_INTERFACE_1_0,
+ PPB_IMEInputEvent_1_0)
+PROXIED_IFACE(NoAPIName, PPB_INPUT_EVENT_INTERFACE_1_0, PPB_InputEvent_1_0)
+PROXIED_IFACE(NoAPIName, PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0,
+ PPB_KeyboardInputEvent_1_0)
+PROXIED_IFACE(NoAPIName, PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0,
+ PPB_MouseInputEvent_1_0)
+PROXIED_IFACE(NoAPIName, PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1,
+ PPB_MouseInputEvent_1_1)
+PROXIED_IFACE(NoAPIName, PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0,
+ PPB_WheelInputEvent_1_0)
+PROXIED_IFACE(NoAPIName, PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0,
+ PPB_TouchInputEvent_1_0)
+PROXIED_IFACE(PPB_Instance, PPB_FULLSCREEN_INTERFACE_1_0, PPB_Fullscreen_1_0)
+PROXIED_IFACE(PPB_Instance, PPB_MESSAGING_INTERFACE_1_0, PPB_Messaging_1_0)
+PROXIED_IFACE(PPB_Instance, PPB_MOUSECURSOR_INTERFACE_1_0, PPB_MouseCursor_1_0)
+PROXIED_IFACE(PPB_Instance, PPB_MOUSELOCK_INTERFACE_1_0, PPB_MouseLock_1_0)
+PROXIED_IFACE(NoAPIName, PPB_NETADDRESS_INTERFACE_1_0, PPB_NetAddress_1_0)
+PROXIED_IFACE(NoAPIName, PPB_NETWORKPROXY_INTERFACE_1_0, PPB_NetworkProxy_1_0)
+PROXIED_IFACE(PPB_TCPSocket, PPB_TCPSOCKET_INTERFACE_1_0, PPB_TCPSocket_1_0)
+PROXIED_IFACE(NoAPIName, PPB_TEXTINPUTCONTROLLER_INTERFACE_1_0,
+ PPB_TextInputController_1_0)
+PROXIED_IFACE(NoAPIName, PPB_UDPSOCKET_INTERFACE_1_0, PPB_UDPSocket_1_0)
+PROXIED_IFACE(NoAPIName, PPB_URLLOADER_INTERFACE_1_0, PPB_URLLoader_1_0)
+PROXIED_IFACE(NoAPIName, PPB_URLREQUESTINFO_INTERFACE_1_0,
+ PPB_URLRequestInfo_1_0)
+PROXIED_IFACE(NoAPIName, PPB_URLRESPONSEINFO_INTERFACE_1_0,
+ PPB_URLResponseInfo_1_0)
+PROXIED_IFACE(NoAPIName, PPB_VAR_ARRAY_INTERFACE_1_0, PPB_VarArray_1_0)
+PROXIED_IFACE(NoAPIName, PPB_VAR_DICTIONARY_INTERFACE_1_0,
+ PPB_VarDictionary_1_0)
+PROXIED_IFACE(NoAPIName, PPB_WEBSOCKET_INTERFACE_1_0, PPB_WebSocket_1_0)
+
+// Note: PPB_Var and PPB_VarArrayBuffer are special and registered manually.
+PROXIED_IFACE(NoAPIName, PPB_VIEW_INTERFACE_1_0, PPB_View_1_0)
+PROXIED_IFACE(NoAPIName, PPB_VIEW_INTERFACE_1_1, PPB_View_1_1)
+
+// This has no corresponding _Proxy object since it does no IPC.
+PROXIED_IFACE(NoAPIName, PPB_AUDIO_CONFIG_INTERFACE_1_0, PPB_AudioConfig_1_0)
+PROXIED_IFACE(NoAPIName, PPB_AUDIO_CONFIG_INTERFACE_1_1, PPB_AudioConfig_1_1)
+
+#include "ppapi/thunk/interfaces_postamble.h"
diff --git a/chromium/ppapi/thunk/interfaces_preamble.h b/chromium/ppapi/thunk/interfaces_preamble.h
new file mode 100644
index 00000000000..7fe1d77bbf8
--- /dev/null
+++ b/chromium/ppapi/thunk/interfaces_preamble.h
@@ -0,0 +1,31 @@
+// 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 empty versions of the macros used in the interfaces_*.h
+// files, as long as they aren't already defined. This allows users of those
+// files to only implement the macros they need, and everything else will
+// compile.
+//
+// Include this file at the top, and interfaces_postamble.h at the bottom. The
+// postamble will clean up these definitions.
+
+#ifndef PROXIED_API
+#define PROXIED_API(api_name)
+#define UNDEFINE_PROXIED_API
+#endif
+
+#ifndef UNPROXIED_API
+#define UNPROXIED_API(api_name)
+#define UNDEFINE_UNPROXIED_API
+#endif
+
+#ifndef PROXIED_IFACE
+#define PROXIED_IFACE(api_name, iface_str, iface_struct)
+#define UNDEFINE_PROXIED_IFACE
+#endif
+
+#ifndef UNPROXIED_IFACE
+#define UNPROXIED_IFACE(api_name, iface_str, iface_struct)
+#define UNDEFINE_UNPROXIED_IFACE
+#endif
diff --git a/chromium/ppapi/thunk/ppapi_thunk_export.h b/chromium/ppapi/thunk/ppapi_thunk_export.h
new file mode 100644
index 00000000000..ed2da9fdeba
--- /dev/null
+++ b/chromium/ppapi/thunk/ppapi_thunk_export.h
@@ -0,0 +1,29 @@
+// 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_THUNK_PPAPI_THUNK_EXPORT_H_
+#define PPAPI_THUNK_PPAPI_THUNK_EXPORT_H_
+
+#if defined(COMPONENT_BUILD)
+#if defined(WIN32)
+
+#if defined(PPAPI_THUNK_IMPLEMENTATION)
+#define PPAPI_THUNK_EXPORT __declspec(dllexport)
+#else
+#define PPAPI_THUNK_EXPORT __declspec(dllimport)
+#endif // defined(PPAPI_THUNK_IMPLEMENTATION)
+
+#else // defined(WIN32)
+#if defined(PPAPI_THUNK_IMPLEMENTATION)
+#define PPAPI_THUNK_EXPORT __attribute__((visibility("default")))
+#else
+#define PPAPI_THUNK_EXPORT
+#endif
+#endif
+
+#else // defined(COMPONENT_BUILD)
+#define PPAPI_THUNK_EXPORT
+#endif
+
+#endif // PPAPI_THUNK_PPAPI_THUNK_EXPORT_H_
diff --git a/chromium/ppapi/thunk/ppb_audio_api.h b/chromium/ppapi/thunk/ppb_audio_api.h
new file mode 100644
index 00000000000..25a1eb33365
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_audio_api.h
@@ -0,0 +1,38 @@
+// 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_AUDIO_API_H_
+#define PPAPI_THUNK_PPB_AUDIO_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/ppb_audio.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_Audio_API {
+ public:
+ virtual ~PPB_Audio_API() {}
+
+ virtual PP_Resource GetCurrentConfig() = 0;
+ virtual PP_Bool StartPlayback() = 0;
+ virtual PP_Bool StopPlayback() = 0;
+
+ // Trusted API.
+ virtual int32_t Open(
+ PP_Resource config_id,
+ scoped_refptr<TrackedCallback> create_callback) = 0;
+ virtual int32_t GetSyncSocket(int* sync_socket) = 0;
+ virtual int32_t GetSharedMemory(int* shm_handle, uint32_t* shm_size) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_AUDIO_API_H_
diff --git a/chromium/ppapi/thunk/ppb_audio_config_api.h b/chromium/ppapi/thunk/ppb_audio_config_api.h
new file mode 100644
index 00000000000..17542fa0aa4
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_audio_config_api.h
@@ -0,0 +1,25 @@
+// 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_THUNK_AUDIO_CONFIG_API_H_
+#define PPAPI_THUNK_AUDIO_CONFIG_API_H_
+
+#include "ppapi/c/ppb_audio_config.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_AudioConfig_API {
+ public:
+ virtual ~PPB_AudioConfig_API() {}
+
+ virtual PP_AudioSampleRate GetSampleRate() = 0;
+ virtual uint32_t GetSampleFrameCount() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_AUDIO_CONFIG_API_H_
diff --git a/chromium/ppapi/thunk/ppb_audio_config_thunk.cc b/chromium/ppapi/thunk/ppb_audio_config_thunk.cc
new file mode 100644
index 00000000000..b06affd5c0d
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_audio_config_thunk.cc
@@ -0,0 +1,105 @@
+// 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.
+
+#include "ppapi/shared_impl/ppb_audio_config_shared.h"
+#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_audio_config_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource CreateStereo16bit(PP_Instance instance,
+ PP_AudioSampleRate sample_rate,
+ uint32_t sample_frame_count) {
+ VLOG(4) << "PPB_AudioConfig::CreateStereo16Bit()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateAudioConfig(instance, sample_rate,
+ sample_frame_count);
+}
+
+uint32_t RecommendSampleFrameCount_1_0(PP_AudioSampleRate sample_rate,
+ uint32_t requested_sample_frame_count) {
+ VLOG(4) << "PPB_AudioConfig::RecommendSampleFrameCount()";
+ return PPB_AudioConfig_Shared::RecommendSampleFrameCount_1_0(sample_rate,
+ requested_sample_frame_count);
+}
+
+uint32_t RecommendSampleFrameCount_1_1(PP_Instance instance,
+ PP_AudioSampleRate sample_rate,
+ uint32_t requested_sample_frame_count) {
+ VLOG(4) << "PPB_AudioConfig::RecommendSampleFrameCount()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return 0;
+ return PPB_AudioConfig_Shared::RecommendSampleFrameCount_1_1(instance,
+ sample_rate, requested_sample_frame_count);
+}
+
+
+PP_Bool IsAudioConfig(PP_Resource resource) {
+ VLOG(4) << "PPB_AudioConfig::IsAudioConfig()";
+ EnterResource<PPB_AudioConfig_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+PP_AudioSampleRate GetSampleRate(PP_Resource config_id) {
+ VLOG(4) << "PPB_AudioConfig::GetSampleRate()";
+ EnterResource<PPB_AudioConfig_API> enter(config_id, true);
+ if (enter.failed())
+ return PP_AUDIOSAMPLERATE_NONE;
+ return enter.object()->GetSampleRate();
+}
+
+uint32_t GetSampleFrameCount(PP_Resource config_id) {
+ VLOG(4) << "PPB_AudioConfig::GetSampleFrameCount()";
+ EnterResource<PPB_AudioConfig_API> enter(config_id, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetSampleFrameCount();
+}
+
+PP_AudioSampleRate RecommendSampleRate(PP_Instance instance) {
+ VLOG(4) << "PPB_AudioConfig::RecommendSampleRate()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_AUDIOSAMPLERATE_NONE;
+ return PPB_AudioConfig_Shared::RecommendSampleRate(instance);
+}
+
+const PPB_AudioConfig_1_0 g_ppb_audio_config_thunk_1_0 = {
+ &CreateStereo16bit,
+ &RecommendSampleFrameCount_1_0,
+ &IsAudioConfig,
+ &GetSampleRate,
+ &GetSampleFrameCount
+};
+
+const PPB_AudioConfig_1_1 g_ppb_audio_config_thunk_1_1 = {
+ &CreateStereo16bit,
+ &RecommendSampleFrameCount_1_1,
+ &IsAudioConfig,
+ &GetSampleRate,
+ &GetSampleFrameCount,
+ &RecommendSampleRate
+};
+
+
+} // namespace
+
+const PPB_AudioConfig_1_0* GetPPB_AudioConfig_1_0_Thunk() {
+ return &g_ppb_audio_config_thunk_1_0;
+}
+
+const PPB_AudioConfig_1_1* GetPPB_AudioConfig_1_1_Thunk() {
+ return &g_ppb_audio_config_thunk_1_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_audio_input_api.h b/chromium/ppapi/thunk/ppb_audio_input_api.h
new file mode 100644
index 00000000000..60fc881d8a8
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_audio_input_api.h
@@ -0,0 +1,49 @@
+// 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_AUDIO_INPUT_API_H_
+#define PPAPI_THUNK_AUDIO_INPUT_API_H_
+
+#include <string>
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/dev/ppb_audio_input_dev.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPB_AudioInput_API {
+ public:
+ virtual ~PPB_AudioInput_API() {}
+
+ virtual int32_t EnumerateDevices0_2(
+ PP_Resource* devices,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t EnumerateDevices(const PP_ArrayOutput& output,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback,
+ void* user_data) = 0;
+ virtual int32_t Open0_2(PP_Resource device_ref,
+ PP_Resource config,
+ PPB_AudioInput_Callback_0_2 audio_input_callback_0_2,
+ void* user_data,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t Open(PP_Resource device_ref,
+ PP_Resource config,
+ PPB_AudioInput_Callback audio_input_callback,
+ void* user_data,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual PP_Resource GetCurrentConfig() = 0;
+ virtual PP_Bool StartCapture() = 0;
+ virtual PP_Bool StopCapture() = 0;
+ virtual void Close() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_AUDIO_INPUT_API_H_
diff --git a/chromium/ppapi/thunk/ppb_audio_input_dev_thunk.cc b/chromium/ppapi/thunk/ppb_audio_input_dev_thunk.cc
new file mode 100644
index 00000000000..ee38c7ad9fe
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_audio_input_dev_thunk.cc
@@ -0,0 +1,183 @@
+// 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.
+
+#include "ppapi/c/dev/ppb_audio_input_dev.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_audio_input_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_AudioInput_Dev::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateAudioInput(instance);
+}
+
+PP_Bool IsAudioInput(PP_Resource resource) {
+ VLOG(4) << "PPB_AudioInput_Dev::IsAudioInput()";
+ EnterResource<PPB_AudioInput_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t EnumerateDevices_0_2(PP_Resource audio_input,
+ PP_Resource* devices,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_AudioInput_Dev::EnumerateDevices()";
+ EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->EnumerateDevices0_2(
+ devices,
+ enter.callback()));
+}
+
+int32_t EnumerateDevices(PP_Resource audio_input,
+ struct PP_ArrayOutput output,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_AudioInput_Dev::EnumerateDevices()";
+ EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->EnumerateDevices(output,
+ enter.callback()));
+}
+
+int32_t MonitorDeviceChange(PP_Resource audio_input,
+ PP_MonitorDeviceChangeCallback callback,
+ void* user_data) {
+ VLOG(4) << "PPB_AudioInput_Dev::MonitorDeviceChange()";
+ EnterResource<PPB_AudioInput_API> enter(audio_input, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->MonitorDeviceChange(callback, user_data);
+}
+
+int32_t Open_0_2(PP_Resource audio_input,
+ PP_Resource device_ref,
+ PP_Resource config,
+ PPB_AudioInput_Callback_0_2 audio_input_callback,
+ void* user_data,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_AudioInput_Dev::Open()";
+ EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Open0_2(device_ref,
+ config,
+ audio_input_callback,
+ user_data,
+ enter.callback()));
+}
+
+int32_t Open(PP_Resource audio_input,
+ PP_Resource device_ref,
+ PP_Resource config,
+ PPB_AudioInput_Callback audio_input_callback,
+ void* user_data,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_AudioInput_Dev::Open()";
+ EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Open(device_ref,
+ config,
+ audio_input_callback,
+ user_data,
+ enter.callback()));
+}
+
+PP_Resource GetCurrentConfig(PP_Resource audio_input) {
+ VLOG(4) << "PPB_AudioInput_Dev::GetCurrentConfig()";
+ EnterResource<PPB_AudioInput_API> enter(audio_input, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetCurrentConfig();
+}
+
+PP_Bool StartCapture(PP_Resource audio_input) {
+ VLOG(4) << "PPB_AudioInput_Dev::StartCapture()";
+ EnterResource<PPB_AudioInput_API> enter(audio_input, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->StartCapture();
+}
+
+PP_Bool StopCapture(PP_Resource audio_input) {
+ VLOG(4) << "PPB_AudioInput_Dev::StopCapture()";
+ EnterResource<PPB_AudioInput_API> enter(audio_input, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->StopCapture();
+}
+
+void Close(PP_Resource audio_input) {
+ VLOG(4) << "PPB_AudioInput_Dev::Close()";
+ EnterResource<PPB_AudioInput_API> enter(audio_input, true);
+ if (enter.failed())
+ return;
+ enter.object()->Close();
+}
+
+const PPB_AudioInput_Dev_0_2 g_ppb_audioinput_dev_thunk_0_2 = {
+ &Create,
+ &IsAudioInput,
+ &EnumerateDevices_0_2,
+ &Open_0_2,
+ &GetCurrentConfig,
+ &StartCapture,
+ &StopCapture,
+ &Close
+};
+
+const PPB_AudioInput_Dev_0_3 g_ppb_audioinput_dev_thunk_0_3 = {
+ &Create,
+ &IsAudioInput,
+ &EnumerateDevices,
+ &MonitorDeviceChange,
+ &Open_0_2,
+ &GetCurrentConfig,
+ &StartCapture,
+ &StopCapture,
+ &Close
+};
+
+const PPB_AudioInput_Dev_0_4 g_ppb_audioinput_dev_thunk_0_4 = {
+ &Create,
+ &IsAudioInput,
+ &EnumerateDevices,
+ &MonitorDeviceChange,
+ &Open,
+ &GetCurrentConfig,
+ &StartCapture,
+ &StopCapture,
+ &Close
+};
+
+} // namespace
+
+const PPB_AudioInput_Dev_0_2* GetPPB_AudioInput_Dev_0_2_Thunk() {
+ return &g_ppb_audioinput_dev_thunk_0_2;
+}
+
+const PPB_AudioInput_Dev_0_3* GetPPB_AudioInput_Dev_0_3_Thunk() {
+ return &g_ppb_audioinput_dev_thunk_0_3;
+}
+
+const PPB_AudioInput_Dev_0_4* GetPPB_AudioInput_Dev_0_4_Thunk() {
+ return &g_ppb_audioinput_dev_thunk_0_4;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_audio_thunk.cc b/chromium/ppapi/thunk/ppb_audio_thunk.cc
new file mode 100644
index 00000000000..5dddb891784
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_audio_thunk.cc
@@ -0,0 +1,80 @@
+// 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.
+
+// From ppb_audio.idl modified Thu Dec 20 13:10:26 2012.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_audio.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_audio_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance,
+ PP_Resource config,
+ PPB_Audio_Callback audio_callback,
+ void* user_data) {
+ VLOG(4) << "PPB_Audio::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateAudio(instance,
+ config,
+ audio_callback,
+ user_data);
+}
+
+PP_Bool IsAudio(PP_Resource resource) {
+ VLOG(4) << "PPB_Audio::IsAudio()";
+ EnterResource<PPB_Audio_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+PP_Resource GetCurrentConfig(PP_Resource audio) {
+ VLOG(4) << "PPB_Audio::GetCurrentConfig()";
+ EnterResource<PPB_Audio_API> enter(audio, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetCurrentConfig();
+}
+
+PP_Bool StartPlayback(PP_Resource audio) {
+ VLOG(4) << "PPB_Audio::StartPlayback()";
+ EnterResource<PPB_Audio_API> enter(audio, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->StartPlayback();
+}
+
+PP_Bool StopPlayback(PP_Resource audio) {
+ VLOG(4) << "PPB_Audio::StopPlayback()";
+ EnterResource<PPB_Audio_API> enter(audio, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->StopPlayback();
+}
+
+const PPB_Audio_1_0 g_ppb_audio_thunk_1_0 = {
+ &Create,
+ &IsAudio,
+ &GetCurrentConfig,
+ &StartPlayback,
+ &StopPlayback
+};
+
+} // namespace
+
+const PPB_Audio_1_0* GetPPB_Audio_1_0_Thunk() {
+ return &g_ppb_audio_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_broker_api.h b/chromium/ppapi/thunk/ppb_broker_api.h
new file mode 100644
index 00000000000..8ac1dd2e547
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_broker_api.h
@@ -0,0 +1,44 @@
+// 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_BROKER_API_H_
+#define PPAPI_THUNK_PPB_BROKER_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPB_Broker_API {
+ public:
+ virtual ~PPB_Broker_API() {}
+
+ virtual int32_t Connect(scoped_refptr<TrackedCallback> connect_callback) = 0;
+ virtual int32_t GetHandle(int32_t* handle) = 0;
+};
+
+// TODO(raymes): Merge this into PPB_Broker_API when the PPB_Broker proxy is
+// refactored to the new resource model. The IsAllowed function should be
+// attached to the resource implementing the PPB_Broker_API. However in order to
+// implement this quickly, the function is added in a new instance API.
+class PPB_Broker_Instance_API {
+ public:
+ virtual ~PPB_Broker_Instance_API() {}
+
+ virtual PP_Bool IsAllowed() = 0;
+
+ static const SingletonResourceID kSingletonResourceID = BROKER_SINGLETON_ID;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_BROKER_API_H_
diff --git a/chromium/ppapi/thunk/ppb_broker_thunk.cc b/chromium/ppapi/thunk/ppb_broker_thunk.cc
new file mode 100644
index 00000000000..0f2f1c9ebd0
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_broker_thunk.cc
@@ -0,0 +1,86 @@
+// 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.
+
+#include "ppapi/c/trusted/ppb_broker_trusted.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/ppb_broker_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource CreateTrusted(PP_Instance instance) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateBroker(instance);
+}
+
+PP_Bool IsBrokerTrusted(PP_Resource resource) {
+ EnterResource<PPB_Broker_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Connect(PP_Resource resource,
+ PP_CompletionCallback callback) {
+ EnterResource<PPB_Broker_API> enter(resource, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Connect(enter.callback()));
+}
+
+int32_t GetHandle(PP_Resource resource, int32_t* handle) {
+ EnterResource<PPB_Broker_API> enter(resource, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->GetHandle(handle);
+}
+
+PP_Bool IsAllowed(PP_Resource resource) {
+ // TODO(raymes): This is a hack. See the note in ppb_broker_api.h.
+ PP_Instance instance = 0;
+ {
+ EnterResource<PPB_Broker_API> enter_resource(resource, true);
+ if (enter_resource.failed())
+ return PP_FALSE;
+ instance = enter_resource.resource()->pp_instance();
+ }
+ EnterInstanceAPI<PPB_Broker_Instance_API> enter_instance(instance);
+ if (enter_instance.failed())
+ return PP_FALSE;
+ return enter_instance.functions()->IsAllowed();
+}
+
+const PPB_BrokerTrusted_0_2 g_ppb_broker_0_2_thunk = {
+ &CreateTrusted,
+ &IsBrokerTrusted,
+ &Connect,
+ &GetHandle,
+};
+
+const PPB_BrokerTrusted_0_3 g_ppb_broker_0_3_thunk = {
+ &CreateTrusted,
+ &IsBrokerTrusted,
+ &Connect,
+ &GetHandle,
+ &IsAllowed,
+};
+
+} // namespace
+
+const PPB_BrokerTrusted_0_2* GetPPB_BrokerTrusted_0_2_Thunk() {
+ return &g_ppb_broker_0_2_thunk;
+}
+
+const PPB_BrokerTrusted_0_3* GetPPB_BrokerTrusted_0_3_Thunk() {
+ return &g_ppb_broker_0_3_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_browser_font_singleton_api.h b/chromium/ppapi/thunk/ppb_browser_font_singleton_api.h
new file mode 100644
index 00000000000..e5717d6285c
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_browser_font_singleton_api.h
@@ -0,0 +1,28 @@
+// 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_BROWSER_FONT_SINGLETON_API_H_
+#define PPAPI_THUNK_PPB_BROWSER_FONT_SINGLETON_API_H_
+
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPB_BrowserFont_Singleton_API {
+ public:
+ virtual ~PPB_BrowserFont_Singleton_API() {}
+
+ virtual PP_Var GetFontFamilies(PP_Instance instance) = 0;
+
+ static const SingletonResourceID kSingletonResourceID =
+ BROWSER_FONT_SINGLETON_ID;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_BROWSER_FONT_SINGLETON_API_H_
diff --git a/chromium/ppapi/thunk/ppb_browser_font_trusted_api.h b/chromium/ppapi/thunk/ppb_browser_font_trusted_api.h
new file mode 100644
index 00000000000..85c188a1b88
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_browser_font_trusted_api.h
@@ -0,0 +1,39 @@
+// 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_THUNK_PPB_BROWSER_FONT_TRUSTED_API_H_
+#define PPAPI_THUNK_PPB_BROWSER_FONT_TRUSTED_API_H_
+
+#include "ppapi/c/trusted/ppb_browser_font_trusted.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+namespace thunk {
+
+// API for font resources.
+class PPAPI_THUNK_EXPORT PPB_BrowserFont_Trusted_API {
+ public:
+ virtual ~PPB_BrowserFont_Trusted_API() {}
+
+ virtual PP_Bool Describe(PP_BrowserFont_Trusted_Description* description,
+ PP_BrowserFont_Trusted_Metrics* metrics) = 0;
+ virtual PP_Bool DrawTextAt(PP_Resource image_data,
+ const PP_BrowserFont_Trusted_TextRun* text,
+ const PP_Point* position,
+ uint32_t color,
+ const PP_Rect* clip,
+ PP_Bool image_data_is_opaque) = 0;
+ virtual int32_t MeasureText(const PP_BrowserFont_Trusted_TextRun* text) = 0;
+ virtual uint32_t CharacterOffsetForPixel(
+ const PP_BrowserFont_Trusted_TextRun* text,
+ int32_t pixel_position) = 0;
+ virtual int32_t PixelOffsetForCharacter(
+ const PP_BrowserFont_Trusted_TextRun* text,
+ uint32_t char_offset) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_BROWSER_FONT_TRUSTED_API_H_
diff --git a/chromium/ppapi/thunk/ppb_browser_font_trusted_thunk.cc b/chromium/ppapi/thunk/ppb_browser_font_trusted_thunk.cc
new file mode 100644
index 00000000000..5db8b84347b
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_browser_font_trusted_thunk.cc
@@ -0,0 +1,105 @@
+// 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.
+
+#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_browser_font_singleton_api.h"
+#include "ppapi/thunk/ppb_browser_font_trusted_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterResource<PPB_BrowserFont_Trusted_API> EnterBrowserFont;
+
+PP_Var GetFontFamilies(PP_Instance instance) {
+ EnterInstanceAPI<PPB_BrowserFont_Singleton_API> enter(instance);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.functions()->GetFontFamilies(instance);
+}
+
+PP_Resource Create(PP_Instance instance,
+ const PP_BrowserFont_Trusted_Description* description) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateBrowserFont(instance, description);
+}
+
+PP_Bool IsBrowserFont(PP_Resource resource) {
+ EnterBrowserFont enter(resource, false);
+ return enter.succeeded() ? PP_TRUE : PP_FALSE;
+}
+
+PP_Bool Describe(PP_Resource font_id,
+ PP_BrowserFont_Trusted_Description* description,
+ PP_BrowserFont_Trusted_Metrics* metrics) {
+ EnterBrowserFont enter(font_id, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->Describe(description, metrics);
+}
+
+PP_Bool DrawTextAt(PP_Resource font_id,
+ PP_Resource image_data,
+ const PP_BrowserFont_Trusted_TextRun* text,
+ const PP_Point* position,
+ uint32_t color,
+ const PP_Rect* clip,
+ PP_Bool image_data_is_opaque) {
+ EnterBrowserFont enter(font_id, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->DrawTextAt(image_data, text, position, color, clip,
+ image_data_is_opaque);
+}
+
+int32_t MeasureText(PP_Resource font_id,
+ const PP_BrowserFont_Trusted_TextRun* text) {
+ EnterBrowserFont enter(font_id, true);
+ if (enter.failed())
+ return -1;
+ return enter.object()->MeasureText(text);
+}
+
+uint32_t CharacterOffsetForPixel(PP_Resource font_id,
+ const PP_BrowserFont_Trusted_TextRun* text,
+ int32_t pixel_position) {
+ EnterBrowserFont enter(font_id, true);
+ if (enter.failed())
+ return -1;
+ return enter.object()->CharacterOffsetForPixel(text, pixel_position);
+}
+
+int32_t PixelOffsetForCharacter(PP_Resource font_id,
+ const PP_BrowserFont_Trusted_TextRun* text,
+ uint32_t char_offset) {
+ EnterBrowserFont enter(font_id, true);
+ if (enter.failed())
+ return -1;
+ return enter.object()->PixelOffsetForCharacter(text, char_offset);
+}
+
+const PPB_BrowserFont_Trusted_1_0 g_ppb_browser_font_trusted_thunk = {
+ &GetFontFamilies,
+ &Create,
+ &IsBrowserFont,
+ &Describe,
+ &DrawTextAt,
+ &MeasureText,
+ &CharacterOffsetForPixel,
+ &PixelOffsetForCharacter
+};
+
+} // namespace
+
+const PPB_BrowserFont_Trusted_1_0* GetPPB_BrowserFont_Trusted_1_0_Thunk() {
+ return &g_ppb_browser_font_trusted_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_buffer_api.h b/chromium/ppapi/thunk/ppb_buffer_api.h
new file mode 100644
index 00000000000..2542ec4cf5a
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_buffer_api.h
@@ -0,0 +1,31 @@
+// 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_THUNK_PPB_BUFFER_API_H_
+#define PPAPI_THUNK_PPB_BUFFER_API_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_Buffer_API {
+ public:
+ virtual ~PPB_Buffer_API() {}
+
+ virtual PP_Bool Describe(uint32_t* size_in_bytes) = 0;
+ virtual PP_Bool IsMapped() = 0;
+ virtual void* Map() = 0;
+ virtual void Unmap() = 0;
+
+ // Trusted API
+ virtual int32_t GetSharedMemory(int* handle) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_BUFFER_API_H_
diff --git a/chromium/ppapi/thunk/ppb_buffer_thunk.cc b/chromium/ppapi/thunk/ppb_buffer_thunk.cc
new file mode 100644
index 00000000000..9c6698d27da
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_buffer_thunk.cc
@@ -0,0 +1,65 @@
+// 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.
+
+#include "ppapi/c/dev/ppb_buffer_dev.h"
+#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_buffer_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance, uint32_t size) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateBuffer(instance, size);
+}
+
+PP_Bool IsBuffer(PP_Resource resource) {
+ EnterResource<PPB_Buffer_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+PP_Bool Describe(PP_Resource resource, uint32_t* size_in_bytes) {
+ EnterResource<PPB_Buffer_API> enter(resource, true);
+ if (enter.failed()) {
+ *size_in_bytes = 0;
+ return PP_FALSE;
+ }
+ return enter.object()->Describe(size_in_bytes);
+}
+
+void* Map(PP_Resource resource) {
+ EnterResource<PPB_Buffer_API> enter(resource, true);
+ if (enter.failed())
+ return NULL;
+ return enter.object()->Map();
+}
+
+void Unmap(PP_Resource resource) {
+ EnterResource<PPB_Buffer_API> enter(resource, true);
+ if (enter.succeeded())
+ enter.object()->Unmap();
+}
+
+const PPB_Buffer_Dev g_ppb_buffer_thunk = {
+ &Create,
+ &IsBuffer,
+ &Describe,
+ &Map,
+ &Unmap,
+};
+
+} // namespace
+
+const PPB_Buffer_Dev_0_4* GetPPB_Buffer_Dev_0_4_Thunk() {
+ return &g_ppb_buffer_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_char_set_thunk.cc b/chromium/ppapi/thunk/ppb_char_set_thunk.cc
new file mode 100644
index 00000000000..a663c55dd4a
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_char_set_thunk.cc
@@ -0,0 +1,107 @@
+// 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.
+
+#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/private/ppb_char_set_shared.h"
+#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/enter.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+char* UTF16ToCharSetDeprecated(PP_Instance instance,
+ const uint16_t* utf16, uint32_t utf16_len,
+ const char* output_char_set,
+ PP_CharSet_ConversionError on_error,
+ uint32_t* output_length) {
+ // We validate the instance just to make sure we can make changes in the
+ // future and assume people pass proper instances.
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return NULL;
+
+ return PPB_CharSet_Shared::UTF16ToCharSetDeprecated(
+ utf16, utf16_len, output_char_set, on_error, output_length);
+}
+
+PP_Bool UTF16ToCharSet(const uint16_t utf16[],
+ uint32_t utf16_len,
+ const char* output_char_set,
+ PP_CharSet_Trusted_ConversionError on_error,
+ char* output_buffer,
+ uint32_t* output_length) {
+ // This interface is a bit odd because it contains a function
+ // (GetDefaultCharSet) that must be called on the instance object and
+ // proxied, but the rest of the functions are implemented in the plugin
+ // process by just calling base functions.
+ //
+ // We could have PPB_Instance_API functions for the two charset conversion
+ // functions, and then have the instance impl and proxy call through to the
+ // shared_impl. That would be more consistent, and we may want to do that if
+ // this file is autogenerated in the future. For now, however, it's less code
+ // to just call the shared_impl code directly here.
+ return PPB_CharSet_Shared::UTF16ToCharSet(
+ utf16, utf16_len, output_char_set, on_error,
+ output_buffer, output_length);
+}
+
+uint16_t* CharSetToUTF16Deprecated(PP_Instance instance,
+ const char* input, uint32_t input_len,
+ const char* input_char_set,
+ PP_CharSet_ConversionError on_error,
+ uint32_t* output_length) {
+ // We validate the instance just to make sure we can make changes in the
+ // future and assume people pass proper instances.
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return NULL;
+
+ return PPB_CharSet_Shared::CharSetToUTF16Deprecated(
+ input, input_len, input_char_set, on_error, output_length);
+}
+
+PP_Bool CharSetToUTF16(const char* input,
+ uint32_t input_len,
+ const char* input_char_set,
+ PP_CharSet_Trusted_ConversionError on_error,
+ uint16_t* output_buffer,
+ uint32_t* output_utf16_length) {
+ return PPB_CharSet_Shared::CharSetToUTF16(
+ input, input_len, input_char_set, on_error,
+ output_buffer, output_utf16_length);
+}
+
+PP_Var GetDefaultCharSet(PP_Instance instance) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.functions()->GetDefaultCharSet(instance);
+}
+
+const PPB_CharSet_Dev g_ppb_char_set_thunk = {
+ &UTF16ToCharSetDeprecated,
+ &CharSetToUTF16Deprecated,
+ &GetDefaultCharSet
+};
+
+const PPB_CharSet_Trusted_1_0 g_ppb_char_set_trusted_thunk = {
+ &UTF16ToCharSet,
+ &CharSetToUTF16,
+ &GetDefaultCharSet
+};
+
+} // namespace
+
+const PPB_CharSet_Dev_0_4* GetPPB_CharSet_Dev_0_4_Thunk() {
+ return &g_ppb_char_set_thunk;
+}
+
+const PPB_CharSet_Trusted_1_0* GetPPB_CharSet_Trusted_1_0_Thunk() {
+ return &g_ppb_char_set_trusted_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_console_thunk.cc b/chromium/ppapi/thunk/ppb_console_thunk.cc
new file mode 100644
index 00000000000..80b115c0608
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_console_thunk.cc
@@ -0,0 +1,51 @@
+// 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.
+
+// From ppb_console.idl modified Tue Apr 16 11:25:44 2013.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_console.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void Log(PP_Instance instance, PP_LogLevel level, struct PP_Var value) {
+ VLOG(4) << "PPB_Console::Log()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->Log(instance, level, value);
+}
+
+void LogWithSource(PP_Instance instance,
+ PP_LogLevel level,
+ struct PP_Var source,
+ struct PP_Var value) {
+ VLOG(4) << "PPB_Console::LogWithSource()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->LogWithSource(instance, level, source, value);
+}
+
+const PPB_Console_1_0 g_ppb_console_thunk_1_0 = {
+ &Log,
+ &LogWithSource
+};
+
+} // namespace
+
+const PPB_Console_1_0* GetPPB_Console_1_0_Thunk() {
+ return &g_ppb_console_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_content_decryptor_private_thunk.cc b/chromium/ppapi/thunk/ppb_content_decryptor_private_thunk.cc
new file mode 100644
index 00000000000..9450eedcbd6
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_content_decryptor_private_thunk.cc
@@ -0,0 +1,169 @@
+// 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.
+
+// From private/ppb_content_decryptor_private.idl,
+// modified Tue Apr 16 11:25:44 2013.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_content_decryptor_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void NeedKey(PP_Instance instance,
+ struct PP_Var key_system,
+ struct PP_Var session_id,
+ struct PP_Var init_data) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::NeedKey()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->NeedKey(instance, key_system, session_id, init_data);
+}
+
+void KeyAdded(PP_Instance instance,
+ struct PP_Var key_system,
+ struct PP_Var session_id) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::KeyAdded()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->KeyAdded(instance, key_system, session_id);
+}
+
+void KeyMessage(PP_Instance instance,
+ struct PP_Var key_system,
+ struct PP_Var session_id,
+ struct PP_Var message,
+ struct PP_Var default_url) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::KeyMessage()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->KeyMessage(instance,
+ key_system,
+ session_id,
+ message,
+ default_url);
+}
+
+void KeyError(PP_Instance instance,
+ struct PP_Var key_system,
+ struct PP_Var session_id,
+ int32_t media_error,
+ int32_t system_code) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::KeyError()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->KeyError(instance,
+ key_system,
+ session_id,
+ media_error,
+ system_code);
+}
+
+void DeliverBlock(PP_Instance instance,
+ PP_Resource decrypted_block,
+ const struct PP_DecryptedBlockInfo* decrypted_block_info) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::DeliverBlock()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->DeliverBlock(instance,
+ decrypted_block,
+ decrypted_block_info);
+}
+
+void DecoderInitializeDone(PP_Instance instance,
+ PP_DecryptorStreamType decoder_type,
+ uint32_t request_id,
+ PP_Bool success) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::DecoderInitializeDone()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->DecoderInitializeDone(instance,
+ decoder_type,
+ request_id,
+ success);
+}
+
+void DecoderDeinitializeDone(PP_Instance instance,
+ PP_DecryptorStreamType decoder_type,
+ uint32_t request_id) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::DecoderDeinitializeDone()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->DecoderDeinitializeDone(instance,
+ decoder_type,
+ request_id);
+}
+
+void DecoderResetDone(PP_Instance instance,
+ PP_DecryptorStreamType decoder_type,
+ uint32_t request_id) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::DecoderResetDone()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->DecoderResetDone(instance, decoder_type, request_id);
+}
+
+void DeliverFrame(PP_Instance instance,
+ PP_Resource decrypted_frame,
+ const struct PP_DecryptedFrameInfo* decrypted_frame_info) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::DeliverFrame()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->DeliverFrame(instance,
+ decrypted_frame,
+ decrypted_frame_info);
+}
+
+void DeliverSamples(
+ PP_Instance instance,
+ PP_Resource audio_frames,
+ const struct PP_DecryptedBlockInfo* decrypted_block_info) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::DeliverSamples()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->DeliverSamples(instance,
+ audio_frames,
+ decrypted_block_info);
+}
+
+const PPB_ContentDecryptor_Private_0_6
+ g_ppb_contentdecryptor_private_thunk_0_6 = {
+ &NeedKey,
+ &KeyAdded,
+ &KeyMessage,
+ &KeyError,
+ &DeliverBlock,
+ &DecoderInitializeDone,
+ &DecoderDeinitializeDone,
+ &DecoderResetDone,
+ &DeliverFrame,
+ &DeliverSamples
+};
+
+} // namespace
+
+const PPB_ContentDecryptor_Private_0_6*
+ GetPPB_ContentDecryptor_Private_0_6_Thunk() {
+ return &g_ppb_contentdecryptor_private_thunk_0_6;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_cursor_control_thunk.cc b/chromium/ppapi/thunk/ppb_cursor_control_thunk.cc
new file mode 100644
index 00000000000..743b3e52aad
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_cursor_control_thunk.cc
@@ -0,0 +1,60 @@
+// 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.
+
+#include "ppapi/c/dev/ppb_cursor_control_dev.h"
+#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+
+// This interface is only for temporary backwards compat and currently just
+// forwards to the stable interfaces that implement these features.
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Bool SetCursor(PP_Instance instance,
+ PP_CursorType_Dev type,
+ PP_Resource custom_image,
+ const PP_Point* hot_spot) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->SetCursor(instance,
+ static_cast<PP_MouseCursor_Type>(type), custom_image, hot_spot);
+}
+
+PP_Bool LockCursor(PP_Instance instance) {
+ return PP_FALSE;
+}
+
+PP_Bool UnlockCursor(PP_Instance instance) {
+ return PP_FALSE;
+}
+
+PP_Bool HasCursorLock(PP_Instance instance) {
+ return PP_FALSE;
+}
+
+PP_Bool CanLockCursor(PP_Instance instance) {
+ return PP_FALSE;
+}
+
+const PPB_CursorControl_Dev g_ppb_cursor_control_thunk = {
+ &SetCursor,
+ &LockCursor,
+ &UnlockCursor,
+ &HasCursorLock,
+ &CanLockCursor
+};
+
+} // namespace
+
+const PPB_CursorControl_Dev_0_4* GetPPB_CursorControl_Dev_0_4_Thunk() {
+ return &g_ppb_cursor_control_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_device_ref_api.h b/chromium/ppapi/thunk/ppb_device_ref_api.h
new file mode 100644
index 00000000000..19812e7afb0
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_device_ref_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_DEVICE_REF_API_H_
+#define PPAPI_THUNK_PPB_DEVICE_REF_API_H_
+
+#include "ppapi/c/dev/ppb_device_ref_dev.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+struct DeviceRefData;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_DeviceRef_API {
+ public:
+ virtual ~PPB_DeviceRef_API() {}
+
+ // This function is not exposed through the C API, but returns the internal
+ // data for easy proxying.
+ virtual const DeviceRefData& GetDeviceRefData() const = 0;
+
+ virtual PP_DeviceType_Dev GetType() = 0;
+ virtual PP_Var GetName() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_DEVICE_REF_API_H_
diff --git a/chromium/ppapi/thunk/ppb_device_ref_dev_thunk.cc b/chromium/ppapi/thunk/ppb_device_ref_dev_thunk.cc
new file mode 100644
index 00000000000..9045cd84410
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_device_ref_dev_thunk.cc
@@ -0,0 +1,56 @@
+// 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.
+
+// From dev/ppb_device_ref_dev.idl modified Thu Dec 20 13:10:26 2012.
+
+#include "ppapi/c/dev/ppb_device_ref_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_device_ref_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Bool IsDeviceRef(PP_Resource resource) {
+ VLOG(4) << "PPB_DeviceRef_Dev::IsDeviceRef()";
+ EnterResource<PPB_DeviceRef_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+PP_DeviceType_Dev GetType(PP_Resource device_ref) {
+ VLOG(4) << "PPB_DeviceRef_Dev::GetType()";
+ EnterResource<PPB_DeviceRef_API> enter(device_ref, true);
+ if (enter.failed())
+ return PP_DEVICETYPE_DEV_INVALID;
+ return enter.object()->GetType();
+}
+
+struct PP_Var GetName(PP_Resource device_ref) {
+ VLOG(4) << "PPB_DeviceRef_Dev::GetName()";
+ EnterResource<PPB_DeviceRef_API> enter(device_ref, true);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.object()->GetName();
+}
+
+const PPB_DeviceRef_Dev_0_1 g_ppb_deviceref_dev_thunk_0_1 = {
+ &IsDeviceRef,
+ &GetType,
+ &GetName
+};
+
+} // namespace
+
+const PPB_DeviceRef_Dev_0_1* GetPPB_DeviceRef_Dev_0_1_Thunk() {
+ return &g_ppb_deviceref_dev_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_ext_alarms_thunk.cc b/chromium/ppapi/thunk/ppb_ext_alarms_thunk.cc
new file mode 100644
index 00000000000..2fc88d08f5b
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_ext_alarms_thunk.cc
@@ -0,0 +1,95 @@
+// Copyright (c) 2013 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.
+
+#include <vector>
+
+#include "ppapi/c/extensions/dev/ppb_ext_alarms_dev.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/extensions_common_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void Create(PP_Instance instance,
+ PP_Var name,
+ PP_Ext_Alarms_AlarmCreateInfo_Dev alarm_info) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance);
+ if (enter.failed())
+ return;
+
+ std::vector<PP_Var> args;
+ args.push_back(name);
+ args.push_back(alarm_info);
+ enter.functions()->PostRenderer("alarms.create", args);
+}
+
+int32_t Get(PP_Instance instance,
+ PP_Var name,
+ PP_Ext_Alarms_Alarm_Dev* alarm,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(name);
+ output_args.push_back(alarm);
+ return enter.SetResult(enter.functions()->CallRenderer(
+ "alarms.get", input_args, output_args, enter.callback()));
+}
+
+int32_t GetAll(PP_Instance instance,
+ PP_Ext_Alarms_Alarm_Dev_Array* alarms,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ output_args.push_back(alarms);
+ return enter.SetResult(enter.functions()->CallRenderer(
+ "alarms.getAll", input_args, output_args, enter.callback()));
+}
+
+void Clear(PP_Instance instance, PP_Var name) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance);
+ if (enter.failed())
+ return;
+
+ std::vector<PP_Var> args;
+ args.push_back(name);
+ enter.functions()->PostRenderer("alarms.clear", args);
+}
+
+void ClearAll(PP_Instance instance) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance);
+ if (enter.failed())
+ return;
+
+ std::vector<PP_Var> args;
+ enter.functions()->PostRenderer("alarms.clearAll", args);
+}
+
+const PPB_Ext_Alarms_Dev_0_1 g_ppb_ext_alarms_dev_0_1_thunk = {
+ &Create,
+ &Get,
+ &GetAll,
+ &Clear,
+ &ClearAll
+};
+
+} // namespace
+
+const PPB_Ext_Alarms_Dev_0_1* GetPPB_Ext_Alarms_Dev_0_1_Thunk() {
+ return &g_ppb_ext_alarms_dev_0_1_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_ext_crx_file_system_private_api.h b/chromium/ppapi/thunk/ppb_ext_crx_file_system_private_api.h
new file mode 100644
index 00000000000..9af926d3b12
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_ext_crx_file_system_private_api.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2013 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_EXT_CRX_FILE_SYSTEM_API_H_
+#define PPAPI_THUNK_PPB_EXT_CRX_FILE_SYSTEM_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_Ext_CrxFileSystem_Private_API {
+ public:
+ virtual ~PPB_Ext_CrxFileSystem_Private_API() {}
+
+ virtual int32_t Open(PP_Instance instance,
+ PP_Resource* file_system,
+ scoped_refptr<TrackedCallback> callback) = 0;
+
+ static const SingletonResourceID kSingletonResourceID =
+ CRX_FILESYSTEM_SINGLETON_ID;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_EXT_CRX_FILE_SYSTEM_API_H_
diff --git a/chromium/ppapi/thunk/ppb_ext_crx_file_system_private_thunk.cc b/chromium/ppapi/thunk/ppb_ext_crx_file_system_private_thunk.cc
new file mode 100644
index 00000000000..7e18ba941de
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_ext_crx_file_system_private_thunk.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2013 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_ext_crx_file_system_private.idl,
+// modified Fri May 3 09:24:58 2013.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_ext_crx_file_system_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_ext_crx_file_system_private_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+int32_t Open(PP_Instance instance,
+ PP_Resource* file_system,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_Ext_CrxFileSystem_Private::Open()";
+ EnterInstanceAPI<PPB_Ext_CrxFileSystem_Private_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.functions()->Open(instance,
+ file_system,
+ enter.callback()));
+}
+
+const PPB_Ext_CrxFileSystem_Private_0_1
+ g_ppb_ext_crxfilesystem_private_thunk_0_1 = {
+ &Open
+};
+
+} // namespace
+
+const PPB_Ext_CrxFileSystem_Private_0_1*
+ GetPPB_Ext_CrxFileSystem_Private_0_1_Thunk() {
+ return &g_ppb_ext_crxfilesystem_private_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_ext_socket_thunk.cc b/chromium/ppapi/thunk/ppb_ext_socket_thunk.cc
new file mode 100644
index 00000000000..e0afd66e27e
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_ext_socket_thunk.cc
@@ -0,0 +1,419 @@
+// Copyright (c) 2013 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.
+
+#include <vector>
+
+#include "ppapi/c/extensions/dev/ppb_ext_socket_dev.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/extensions_common_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+int32_t Create(PP_Instance instance,
+ PP_Ext_Socket_SocketType_Dev type,
+ PP_Ext_Socket_CreateOptions_Dev options,
+ PP_Ext_Socket_CreateInfo_Dev* create_info,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(type);
+ input_args.push_back(options);
+ output_args.push_back(create_info);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.create", input_args, output_args, enter.callback()));
+}
+
+void Destroy(PP_Instance instance, PP_Var socket_id) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance);
+ if (enter.failed())
+ return;
+
+ std::vector<PP_Var> args;
+ args.push_back(socket_id);
+ enter.functions()->PostBrowser("socket.destroy", args);
+}
+
+int32_t Connect(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var hostname,
+ PP_Var port,
+ PP_Var* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(hostname);
+ input_args.push_back(port);
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.connect", input_args, output_args, enter.callback()));
+}
+
+int32_t Bind(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var address,
+ PP_Var port,
+ PP_Var* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(address);
+ input_args.push_back(port);
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.bind", input_args, output_args, enter.callback()));
+}
+
+void Disconnect(PP_Instance instance, PP_Var socket_id) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance);
+ if (enter.failed())
+ return;
+
+ std::vector<PP_Var> args;
+ args.push_back(socket_id);
+ enter.functions()->PostBrowser("socket.disconnect", args);
+}
+
+int32_t Read(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var buffer_size,
+ PP_Ext_Socket_ReadInfo_Dev* read_info,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(buffer_size);
+ output_args.push_back(read_info);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.read", input_args, output_args, enter.callback()));
+}
+
+int32_t Write(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var data,
+ PP_Ext_Socket_WriteInfo_Dev* write_info,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(data);
+ output_args.push_back(write_info);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.write", input_args, output_args, enter.callback()));
+}
+
+int32_t RecvFrom(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var buffer_size,
+ PP_Ext_Socket_RecvFromInfo_Dev* recv_from_info,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(buffer_size);
+ output_args.push_back(recv_from_info);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.recvFrom", input_args, output_args, enter.callback()));
+}
+
+int32_t SendTo(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var data,
+ PP_Var address,
+ PP_Var port,
+ PP_Ext_Socket_WriteInfo_Dev* write_info,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(data);
+ input_args.push_back(address);
+ input_args.push_back(port);
+ output_args.push_back(write_info);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.sendTo", input_args, output_args, enter.callback()));
+}
+
+int32_t Listen(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var address,
+ PP_Var port,
+ PP_Var backlog,
+ PP_Var* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(address);
+ input_args.push_back(port);
+ input_args.push_back(backlog);
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.listen", input_args, output_args, enter.callback()));
+}
+
+int32_t Accept(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Ext_Socket_AcceptInfo_Dev* accept_info,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ output_args.push_back(accept_info);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.accept", input_args, output_args, enter.callback()));
+}
+
+int32_t SetKeepAlive(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var enable,
+ PP_Var delay,
+ PP_Var* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(enable);
+ input_args.push_back(delay);
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.setKeepAlive", input_args, output_args, enter.callback()));
+}
+
+int32_t SetNoDelay(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var no_delay,
+ PP_Var* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(no_delay);
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.setNoDelay", input_args, output_args, enter.callback()));
+}
+
+int32_t GetInfo(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Ext_Socket_SocketInfo_Dev* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.getInfo", input_args, output_args, enter.callback()));
+}
+
+int32_t GetNetworkList(PP_Instance instance,
+ PP_Ext_Socket_NetworkInterface_Dev_Array* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.getNetworkList", input_args, output_args, enter.callback()));
+}
+
+int32_t JoinGroup(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var address,
+ PP_Var* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(address);
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.joinGroup", input_args, output_args, enter.callback()));
+}
+
+int32_t LeaveGroup(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var address,
+ PP_Var* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(address);
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.leaveGroup", input_args, output_args, enter.callback()));
+}
+
+int32_t SetMulticastTimeToLive(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var ttl,
+ PP_Var* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(ttl);
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.setMulticastTimeToLive", input_args, output_args,
+ enter.callback()));
+}
+
+int32_t SetMulticastLoopbackMode(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var enabled,
+ PP_Var* result,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ input_args.push_back(enabled);
+ output_args.push_back(result);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.setMulticastLoopbackMode", input_args, output_args,
+ enter.callback()));
+}
+
+int32_t GetJoinedGroups(PP_Instance instance,
+ PP_Var socket_id,
+ PP_Var* groups,
+ PP_CompletionCallback callback) {
+ EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+
+ std::vector<PP_Var> input_args;
+ std::vector<PP_Var*> output_args;
+ input_args.push_back(socket_id);
+ output_args.push_back(groups);
+ return enter.SetResult(enter.functions()->CallBrowser(
+ "socket.getJoinedGroups", input_args, output_args, enter.callback()));
+}
+
+const PPB_Ext_Socket_Dev_0_1 g_ppb_ext_socket_dev_0_1_thunk = {
+ &Create,
+ &Destroy,
+ &Connect,
+ &Bind,
+ &Disconnect,
+ &Read,
+ &Write,
+ &RecvFrom,
+ &SendTo,
+ &Listen,
+ &Accept,
+ &SetKeepAlive,
+ &SetNoDelay,
+ &GetInfo,
+ &GetNetworkList
+};
+
+const PPB_Ext_Socket_Dev_0_2 g_ppb_ext_socket_dev_0_2_thunk = {
+ &Create,
+ &Destroy,
+ &Connect,
+ &Bind,
+ &Disconnect,
+ &Read,
+ &Write,
+ &RecvFrom,
+ &SendTo,
+ &Listen,
+ &Accept,
+ &SetKeepAlive,
+ &SetNoDelay,
+ &GetInfo,
+ &GetNetworkList,
+ &JoinGroup,
+ &LeaveGroup,
+ &SetMulticastTimeToLive,
+ &SetMulticastLoopbackMode,
+ &GetJoinedGroups
+};
+} // namespace
+
+const PPB_Ext_Socket_Dev_0_1* GetPPB_Ext_Socket_Dev_0_1_Thunk() {
+ return &g_ppb_ext_socket_dev_0_1_thunk;
+}
+
+const PPB_Ext_Socket_Dev_0_2* GetPPB_Ext_Socket_Dev_0_2_Thunk() {
+ return &g_ppb_ext_socket_dev_0_2_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_file_chooser_api.h b/chromium/ppapi/thunk/ppb_file_chooser_api.h
new file mode 100644
index 00000000000..15cc9e499df
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_file_chooser_api.h
@@ -0,0 +1,45 @@
+// 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_FILE_CHOOSER_API_H_
+#define PPAPI_THUNK_PPB_FILE_CHOOSER_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/dev/ppb_file_chooser_dev.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPB_FileChooser_API {
+ public:
+ virtual ~PPB_FileChooser_API() {}
+
+ virtual int32_t Show(const PP_ArrayOutput& output,
+ scoped_refptr<TrackedCallback> callback) = 0;
+
+ // Trusted API.
+ virtual int32_t ShowWithoutUserGesture(
+ PP_Bool save_as,
+ PP_Var suggested_file_name,
+ const PP_ArrayOutput& output,
+ scoped_refptr<TrackedCallback> callback) = 0;
+
+ // Version 0.5 API.
+ virtual int32_t Show0_5(scoped_refptr<TrackedCallback> callback) = 0;
+ virtual PP_Resource GetNextChosenFile() = 0;
+
+ // Trusted version 0.5 API.
+ virtual int32_t ShowWithoutUserGesture0_5(
+ PP_Bool save_as,
+ PP_Var suggested_file_name,
+ scoped_refptr<TrackedCallback> callback) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_FILE_CHOOSER_API_H_
diff --git a/chromium/ppapi/thunk/ppb_file_chooser_dev_thunk.cc b/chromium/ppapi/thunk/ppb_file_chooser_dev_thunk.cc
new file mode 100644
index 00000000000..fe1aa0dbf77
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_file_chooser_dev_thunk.cc
@@ -0,0 +1,88 @@
+// 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.
+
+// From dev/ppb_file_chooser_dev.idl modified Mon Apr 1 08:24:03 2013.
+
+#include "ppapi/c/dev/ppb_file_chooser_dev.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_file_chooser_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance,
+ PP_FileChooserMode_Dev mode,
+ struct PP_Var accept_types) {
+ VLOG(4) << "PPB_FileChooser_Dev::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateFileChooser(instance, mode, accept_types);
+}
+
+PP_Bool IsFileChooser(PP_Resource resource) {
+ VLOG(4) << "PPB_FileChooser_Dev::IsFileChooser()";
+ EnterResource<PPB_FileChooser_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Show_0_5(PP_Resource chooser, struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileChooser_Dev::Show()";
+ EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Show0_5(enter.callback()));
+}
+
+PP_Resource GetNextChosenFile(PP_Resource chooser) {
+ VLOG(4) << "PPB_FileChooser_Dev::GetNextChosenFile()";
+ EnterResource<PPB_FileChooser_API> enter(chooser, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetNextChosenFile();
+}
+
+int32_t Show(PP_Resource chooser,
+ struct PP_ArrayOutput output,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileChooser_Dev::Show()";
+ EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Show(output, enter.callback()));
+}
+
+const PPB_FileChooser_Dev_0_5 g_ppb_filechooser_dev_thunk_0_5 = {
+ &Create,
+ &IsFileChooser,
+ &Show_0_5,
+ &GetNextChosenFile
+};
+
+const PPB_FileChooser_Dev_0_6 g_ppb_filechooser_dev_thunk_0_6 = {
+ &Create,
+ &IsFileChooser,
+ &Show
+};
+
+} // namespace
+
+const PPB_FileChooser_Dev_0_5* GetPPB_FileChooser_Dev_0_5_Thunk() {
+ return &g_ppb_filechooser_dev_thunk_0_5;
+}
+
+const PPB_FileChooser_Dev_0_6* GetPPB_FileChooser_Dev_0_6_Thunk() {
+ return &g_ppb_filechooser_dev_thunk_0_6;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_file_chooser_trusted_thunk.cc b/chromium/ppapi/thunk/ppb_file_chooser_trusted_thunk.cc
new file mode 100644
index 00000000000..552bee08f8f
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_file_chooser_trusted_thunk.cc
@@ -0,0 +1,72 @@
+// 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.
+
+// From trusted/ppb_file_chooser_trusted.idl,
+// modified Mon Apr 1 08:24:03 2013.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/trusted/ppb_file_chooser_trusted.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_file_chooser_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+int32_t ShowWithoutUserGesture_0_5(PP_Resource chooser,
+ PP_Bool save_as,
+ struct PP_Var suggested_file_name,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileChooserTrusted::ShowWithoutUserGesture()";
+ EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->ShowWithoutUserGesture0_5(
+ save_as,
+ suggested_file_name,
+ enter.callback()));
+}
+
+int32_t ShowWithoutUserGesture(PP_Resource chooser,
+ PP_Bool save_as,
+ struct PP_Var suggested_file_name,
+ struct PP_ArrayOutput output,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileChooserTrusted::ShowWithoutUserGesture()";
+ EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->ShowWithoutUserGesture(
+ save_as,
+ suggested_file_name,
+ output,
+ enter.callback()));
+}
+
+const PPB_FileChooserTrusted_0_5 g_ppb_filechoosertrusted_thunk_0_5 = {
+ &ShowWithoutUserGesture_0_5
+};
+
+const PPB_FileChooserTrusted_0_6 g_ppb_filechoosertrusted_thunk_0_6 = {
+ &ShowWithoutUserGesture
+};
+
+} // namespace
+
+const PPB_FileChooserTrusted_0_5* GetPPB_FileChooserTrusted_0_5_Thunk() {
+ return &g_ppb_filechoosertrusted_thunk_0_5;
+}
+
+const PPB_FileChooserTrusted_0_6* GetPPB_FileChooserTrusted_0_6_Thunk() {
+ return &g_ppb_filechoosertrusted_thunk_0_6;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_file_io_api.h b/chromium/ppapi/thunk/ppb_file_io_api.h
new file mode 100644
index 00000000000..ec7f16d1140
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_file_io_api.h
@@ -0,0 +1,65 @@
+// 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_FILE_IO_API_H_
+#define PPAPI_THUNK_PPB_FILE_IO_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/ppb_file_io.h"
+#include "ppapi/c/private/pp_file_handle.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_FileIO_API {
+ public:
+ virtual ~PPB_FileIO_API() {}
+
+ virtual int32_t Open(PP_Resource file_ref,
+ int32_t open_flags,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t Query(PP_FileInfo* info,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t Touch(PP_Time last_access_time,
+ PP_Time last_modified_time,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t Read(int64_t offset,
+ char* buffer,
+ int32_t bytes_to_read,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t ReadToArray(int64_t offset,
+ int32_t max_read_length,
+ PP_ArrayOutput* buffer,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t Write(int64_t offset,
+ const char* buffer,
+ int32_t bytes_to_write,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t SetLength(int64_t length,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) = 0;
+ virtual void Close() = 0;
+
+ // Trusted API.
+ virtual int32_t GetOSFileDescriptor() = 0;
+ virtual int32_t WillWrite(int64_t offset,
+ int32_t bytes_to_write,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t WillSetLength(int64_t length,
+ scoped_refptr<TrackedCallback> callback) = 0;
+
+ // Private API.
+ virtual int32_t RequestOSFileHandle(
+ PP_FileHandle* handle,
+ scoped_refptr<TrackedCallback> callback) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_FILE_IO_API_H_
diff --git a/chromium/ppapi/thunk/ppb_file_io_private_thunk.cc b/chromium/ppapi/thunk/ppb_file_io_private_thunk.cc
new file mode 100644
index 00000000000..20c7971a2a0
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_file_io_private_thunk.cc
@@ -0,0 +1,44 @@
+// Copyright (c) 2013 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_file_io_private.idl modified Tue Mar 26 15:29:46 2013.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_file_io_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_file_io_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+int32_t RequestOSFileHandle(PP_Resource file_io,
+ PP_FileHandle* handle,
+ struct PP_CompletionCallback callback) {
+ EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->RequestOSFileHandle(
+ handle,
+ enter.callback()));
+}
+
+const PPB_FileIO_Private_0_1 g_ppb_fileio_private_thunk_0_1 = {
+ &RequestOSFileHandle
+};
+
+} // namespace
+
+const PPB_FileIO_Private_0_1* GetPPB_FileIO_Private_0_1_Thunk() {
+ return &g_ppb_fileio_private_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_file_io_thunk.cc b/chromium/ppapi/thunk/ppb_file_io_thunk.cc
new file mode 100644
index 00000000000..331d190ca81
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_file_io_thunk.cc
@@ -0,0 +1,181 @@
+// 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.
+
+// From ppb_file_io.idl modified Tue Apr 16 11:25:44 2013.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_file_io.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_file_io_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_FileIO::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateFileIO(instance);
+}
+
+PP_Bool IsFileIO(PP_Resource resource) {
+ VLOG(4) << "PPB_FileIO::IsFileIO()";
+ EnterResource<PPB_FileIO_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Open(PP_Resource file_io,
+ PP_Resource file_ref,
+ int32_t open_flags,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileIO::Open()";
+ EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Open(file_ref,
+ open_flags,
+ enter.callback()));
+}
+
+int32_t Query(PP_Resource file_io,
+ struct PP_FileInfo* info,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileIO::Query()";
+ EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Query(info, enter.callback()));
+}
+
+int32_t Touch(PP_Resource file_io,
+ PP_Time last_access_time,
+ PP_Time last_modified_time,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileIO::Touch()";
+ EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Touch(last_access_time,
+ last_modified_time,
+ enter.callback()));
+}
+
+int32_t Read(PP_Resource file_io,
+ int64_t offset,
+ char* buffer,
+ int32_t bytes_to_read,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileIO::Read()";
+ EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Read(offset,
+ buffer,
+ bytes_to_read,
+ enter.callback()));
+}
+
+int32_t Write(PP_Resource file_io,
+ int64_t offset,
+ const char* buffer,
+ int32_t bytes_to_write,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileIO::Write()";
+ EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Write(offset,
+ buffer,
+ bytes_to_write,
+ enter.callback()));
+}
+
+int32_t SetLength(PP_Resource file_io,
+ int64_t length,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileIO::SetLength()";
+ EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->SetLength(length, enter.callback()));
+}
+
+int32_t Flush(PP_Resource file_io, struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileIO::Flush()";
+ EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Flush(enter.callback()));
+}
+
+void Close(PP_Resource file_io) {
+ VLOG(4) << "PPB_FileIO::Close()";
+ EnterResource<PPB_FileIO_API> enter(file_io, true);
+ if (enter.failed())
+ return;
+ enter.object()->Close();
+}
+
+int32_t ReadToArray(PP_Resource file_io,
+ int64_t offset,
+ int32_t max_read_length,
+ struct PP_ArrayOutput* output,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileIO::ReadToArray()";
+ EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->ReadToArray(offset,
+ max_read_length,
+ output,
+ enter.callback()));
+}
+
+const PPB_FileIO_1_0 g_ppb_fileio_thunk_1_0 = {
+ &Create,
+ &IsFileIO,
+ &Open,
+ &Query,
+ &Touch,
+ &Read,
+ &Write,
+ &SetLength,
+ &Flush,
+ &Close
+};
+
+const PPB_FileIO_1_1 g_ppb_fileio_thunk_1_1 = {
+ &Create,
+ &IsFileIO,
+ &Open,
+ &Query,
+ &Touch,
+ &Read,
+ &Write,
+ &SetLength,
+ &Flush,
+ &Close,
+ &ReadToArray
+};
+
+} // namespace
+
+const PPB_FileIO_1_0* GetPPB_FileIO_1_0_Thunk() {
+ return &g_ppb_fileio_thunk_1_0;
+}
+
+const PPB_FileIO_1_1* GetPPB_FileIO_1_1_Thunk() {
+ return &g_ppb_fileio_thunk_1_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_file_io_trusted_thunk.cc b/chromium/ppapi/thunk/ppb_file_io_trusted_thunk.cc
new file mode 100644
index 00000000000..3336026e8e4
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_file_io_trusted_thunk.cc
@@ -0,0 +1,62 @@
+// 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.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/trusted/ppb_file_io_trusted.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/ppb_file_io_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterResource<PPB_FileIO_API> EnterFileIO;
+
+int32_t GetOSFileDescriptor(PP_Resource file_io) {
+ EnterFileIO enter(file_io, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->GetOSFileDescriptor();
+}
+
+int32_t WillWrite(PP_Resource file_io,
+ int64_t offset,
+ int32_t bytes_to_write,
+ PP_CompletionCallback callback) {
+ EnterFileIO enter(file_io, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->WillWrite(offset, bytes_to_write,
+ enter.callback()));
+}
+
+int32_t WillSetLength(PP_Resource file_io,
+ int64_t length,
+ PP_CompletionCallback callback) {
+ EnterFileIO enter(file_io, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->WillSetLength(length,
+ enter.callback()));
+}
+
+const PPB_FileIOTrusted g_ppb_file_io_trusted_thunk = {
+ &GetOSFileDescriptor,
+ &WillWrite,
+ &WillSetLength
+};
+
+} // namespace
+
+const PPB_FileIOTrusted_0_4* GetPPB_FileIOTrusted_0_4_Thunk() {
+ return &g_ppb_file_io_trusted_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_file_ref_api.h b/chromium/ppapi/thunk/ppb_file_ref_api.h
new file mode 100644
index 00000000000..ba92b63fcc4
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_file_ref_api.h
@@ -0,0 +1,70 @@
+// 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_FILE_REF_API_H_
+#define PPAPI_THUNK_PPB_FILE_REF_API_H_
+
+#include <vector>
+
+#include "base/memory/linked_ptr.h"
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/ppb_file_ref.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+struct PPB_FileRef_CreateInfo;
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_FileRef_API {
+ public:
+ virtual ~PPB_FileRef_API() {}
+
+ virtual PP_FileSystemType GetFileSystemType() const = 0;
+ virtual PP_Var GetName() const = 0;
+ virtual PP_Var GetPath() const = 0;
+ virtual PP_Resource GetParent() = 0;
+ virtual int32_t MakeDirectory(PP_Bool make_ancestors,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t Touch(PP_Time last_access_time,
+ PP_Time last_modified_time,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t Delete(scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t Rename(PP_Resource new_file_ref,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t Query(PP_FileInfo* info,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t ReadDirectoryEntries(
+ const PP_ArrayOutput& output,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ // We define variants of Query and ReadDirectoryEntries because
+ // 1. we need to take linked_ptr instead of raw pointers to avoid
+ // use-after-free, and 2. we don't use PP_ArrayOutput for the
+ // communication between renderers and the browser in
+ // ReadDirectoryEntries. The *InHost functions must not be called in
+ // plugins, and Query and ReadDirectoryEntries must not be called in
+ // renderers.
+ // TODO(hamaji): These functions must be removed when we move
+ // FileRef to the new resource design. http://crbug.com/225441
+ virtual int32_t QueryInHost(linked_ptr<PP_FileInfo> info,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t ReadDirectoryEntriesInHost(
+ linked_ptr<std::vector<ppapi::PPB_FileRef_CreateInfo> > files,
+ linked_ptr<std::vector<PP_FileType> > file_types,
+ scoped_refptr<TrackedCallback> callback) = 0;
+
+ // Internal function for use in proxying. Returns the internal CreateInfo
+ // (the contained resource does not carry a ref on behalf of the caller).
+ virtual const PPB_FileRef_CreateInfo& GetCreateInfo() const = 0;
+
+ // Private API
+ virtual PP_Var GetAbsolutePath() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_FILE_REF_API_H_
diff --git a/chromium/ppapi/thunk/ppb_file_ref_thunk.cc b/chromium/ppapi/thunk/ppb_file_ref_thunk.cc
new file mode 100644
index 00000000000..beb0e41f573
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_file_ref_thunk.cc
@@ -0,0 +1,195 @@
+// 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.
+
+#include "ppapi/c/pp_file_info.h"
+#include "ppapi/c/ppb_file_ref.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_file_ref_private.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/ppb_file_ref_api.h"
+#include "ppapi/thunk/ppb_file_system_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterResource<PPB_FileRef_API> EnterFileRef;
+
+PP_Resource Create(PP_Resource file_system, const char* path) {
+ VLOG(4) << "PPB_FileRef::Create()";
+ ppapi::ProxyAutoLock lock;
+ EnterResourceNoLock<PPB_FileSystem_API> enter_file_system(file_system, true);
+ if (enter_file_system.failed())
+ return 0;
+ PP_Instance instance = enter_file_system.resource()->pp_instance();
+ EnterResourceCreationNoLock enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateFileRef(instance, file_system, path);
+}
+
+PP_Bool IsFileRef(PP_Resource resource) {
+ VLOG(4) << "PPB_FileRef::IsFileRef()";
+ EnterFileRef enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+PP_FileSystemType GetFileSystemType(PP_Resource file_ref) {
+ VLOG(4) << "PPB_FileRef::GetFileSystemType()";
+ EnterFileRef enter(file_ref, true);
+ if (enter.failed())
+ return PP_FILESYSTEMTYPE_INVALID;
+ return enter.object()->GetFileSystemType();
+}
+
+PP_Var GetName(PP_Resource file_ref) {
+ VLOG(4) << "PPB_FileRef::GetName()";
+ EnterFileRef enter(file_ref, true);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.object()->GetName();
+}
+
+PP_Var GetPath(PP_Resource file_ref) {
+ VLOG(4) << "PPB_FileRef::GetPath()";
+ EnterFileRef enter(file_ref, true);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.object()->GetPath();
+}
+
+PP_Resource GetParent(PP_Resource file_ref) {
+ VLOG(4) << "PPB_FileRef::GetParent()";
+ EnterFileRef enter(file_ref, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetParent();
+}
+
+int32_t MakeDirectory(PP_Resource directory_ref,
+ PP_Bool make_ancestors,
+ PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileRef::MakeDirectory()";
+ EnterFileRef enter(directory_ref, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->MakeDirectory(make_ancestors,
+ enter.callback()));
+}
+
+int32_t Touch(PP_Resource file_ref,
+ PP_Time last_access_time,
+ PP_Time last_modified_time,
+ PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileRef::Touch()";
+ EnterFileRef enter(file_ref, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Touch(
+ last_access_time, last_modified_time, enter.callback()));
+}
+
+int32_t Delete(PP_Resource file_ref,
+ PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileRef::Delete()";
+ EnterFileRef enter(file_ref, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Delete(enter.callback()));
+}
+
+int32_t Rename(PP_Resource file_ref,
+ PP_Resource new_file_ref,
+ PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileRef::Rename()";
+ EnterFileRef enter(file_ref, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Rename(new_file_ref,
+ enter.callback()));
+}
+
+int32_t Query(PP_Resource file_ref,
+ PP_FileInfo* info,
+ PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileRef::Query()";
+ EnterFileRef enter(file_ref, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Query(info,
+ enter.callback()));
+}
+
+int32_t ReadDirectoryEntries(PP_Resource file_ref,
+ PP_ArrayOutput output,
+ PP_CompletionCallback callback) {
+ EnterFileRef enter(file_ref, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->ReadDirectoryEntries(
+ output, enter.callback()));
+}
+
+PP_Var GetAbsolutePath(PP_Resource file_ref) {
+ VLOG(4) << "PPB_FileRef::GetAbsolutePath";
+ EnterFileRef enter(file_ref, true);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.object()->GetAbsolutePath();
+}
+
+const PPB_FileRef_1_0 g_ppb_file_ref_thunk_1_0 = {
+ &Create,
+ &IsFileRef,
+ &GetFileSystemType,
+ &GetName,
+ &GetPath,
+ &GetParent,
+ &MakeDirectory,
+ &Touch,
+ &Delete,
+ &Rename
+};
+
+const PPB_FileRef_1_1 g_ppb_file_ref_thunk_1_1 = {
+ &Create,
+ &IsFileRef,
+ &GetFileSystemType,
+ &GetName,
+ &GetPath,
+ &GetParent,
+ &MakeDirectory,
+ &Touch,
+ &Delete,
+ &Rename,
+ &Query,
+ &ReadDirectoryEntries
+};
+
+const PPB_FileRefPrivate g_ppb_file_ref_private_thunk = {
+ &GetAbsolutePath
+};
+
+} // namespace
+
+const PPB_FileRef_1_0* GetPPB_FileRef_1_0_Thunk() {
+ return &g_ppb_file_ref_thunk_1_0;
+}
+
+const PPB_FileRef_1_1* GetPPB_FileRef_1_1_Thunk() {
+ return &g_ppb_file_ref_thunk_1_1;
+}
+
+const PPB_FileRefPrivate_0_1* GetPPB_FileRefPrivate_0_1_Thunk() {
+ return &g_ppb_file_ref_private_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_file_system_api.h b/chromium/ppapi/thunk/ppb_file_system_api.h
new file mode 100644
index 00000000000..f9524dc0fd0
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_file_system_api.h
@@ -0,0 +1,29 @@
+// 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_FILE_SYSTEM_API_H_
+#define PPAPI_THUNK_PPB_FILE_SYSTEM_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/ppb_file_system.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPB_FileSystem_API {
+ public:
+ virtual ~PPB_FileSystem_API() {}
+
+ virtual int32_t Open(int64_t expected_size,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual PP_FileSystemType GetType() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_FILE_SYSTEM_API_H_
diff --git a/chromium/ppapi/thunk/ppb_file_system_thunk.cc b/chromium/ppapi/thunk/ppb_file_system_thunk.cc
new file mode 100644
index 00000000000..8a608ac6293
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_file_system_thunk.cc
@@ -0,0 +1,68 @@
+// 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.
+
+// From ppb_file_system.idl modified Thu Dec 20 13:10:26 2012.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_file_system.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_file_system_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance, PP_FileSystemType type) {
+ VLOG(4) << "PPB_FileSystem::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateFileSystem(instance, type);
+}
+
+PP_Bool IsFileSystem(PP_Resource resource) {
+ VLOG(4) << "PPB_FileSystem::IsFileSystem()";
+ EnterResource<PPB_FileSystem_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Open(PP_Resource file_system,
+ int64_t expected_size,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_FileSystem::Open()";
+ EnterResource<PPB_FileSystem_API> enter(file_system, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Open(expected_size, enter.callback()));
+}
+
+PP_FileSystemType GetType(PP_Resource file_system) {
+ VLOG(4) << "PPB_FileSystem::GetType()";
+ EnterResource<PPB_FileSystem_API> enter(file_system, true);
+ if (enter.failed())
+ return PP_FILESYSTEMTYPE_INVALID;
+ return enter.object()->GetType();
+}
+
+const PPB_FileSystem_1_0 g_ppb_filesystem_thunk_1_0 = {
+ &Create,
+ &IsFileSystem,
+ &Open,
+ &GetType
+};
+
+} // namespace
+
+const PPB_FileSystem_1_0* GetPPB_FileSystem_1_0_Thunk() {
+ return &g_ppb_filesystem_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_find_dev_thunk.cc b/chromium/ppapi/thunk/ppb_find_dev_thunk.cc
new file mode 100644
index 00000000000..79a10854563
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_find_dev_thunk.cc
@@ -0,0 +1,50 @@
+// 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.
+
+// From dev/ppb_find_dev.idl modified Tue Apr 16 11:25:44 2013.
+
+#include "ppapi/c/dev/ppb_find_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void NumberOfFindResultsChanged(PP_Instance instance,
+ int32_t total,
+ PP_Bool final_result) {
+ VLOG(4) << "PPB_Find_Dev::NumberOfFindResultsChanged()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->NumberOfFindResultsChanged(instance, total, final_result);
+}
+
+void SelectedFindResultChanged(PP_Instance instance, int32_t index) {
+ VLOG(4) << "PPB_Find_Dev::SelectedFindResultChanged()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->SelectedFindResultChanged(instance, index);
+}
+
+const PPB_Find_Dev_0_3 g_ppb_find_dev_thunk_0_3 = {
+ &NumberOfFindResultsChanged,
+ &SelectedFindResultChanged
+};
+
+} // namespace
+
+const PPB_Find_Dev_0_3* GetPPB_Find_Dev_0_3_Thunk() {
+ return &g_ppb_find_dev_thunk_0_3;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_flash_clipboard_api.h b/chromium/ppapi/thunk/ppb_flash_clipboard_api.h
new file mode 100644
index 00000000000..4be9aeefed8
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_clipboard_api.h
@@ -0,0 +1,40 @@
+// 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_CLIPBOARD_API_H_
+#define PPAPI_THUNK_PPB_FLASH_CLIPBOARD_API_H_
+
+#include "ppapi/c/private/ppb_flash_clipboard.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPB_Flash_Clipboard_API {
+ public:
+ virtual ~PPB_Flash_Clipboard_API() {}
+
+ // PPB_Flash_Clipboard.
+ virtual uint32_t RegisterCustomFormat(PP_Instance instance,
+ const char* format_name) = 0;
+ virtual PP_Bool IsFormatAvailable(PP_Instance instance,
+ PP_Flash_Clipboard_Type clipboard_type,
+ uint32_t format) = 0;
+ virtual PP_Var ReadData(PP_Instance instance,
+ PP_Flash_Clipboard_Type clipboard_type,
+ uint32_t format) = 0;
+ virtual int32_t WriteData(PP_Instance instance,
+ PP_Flash_Clipboard_Type clipboard_type,
+ uint32_t data_item_count,
+ const uint32_t formats[],
+ const PP_Var data_items[]) = 0;
+
+ static const SingletonResourceID kSingletonResourceID =
+ FLASH_CLIPBOARD_SINGLETON_ID;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_FLASH_CLIPBOARD_API_H_
diff --git a/chromium/ppapi/thunk/ppb_flash_clipboard_thunk.cc b/chromium/ppapi/thunk/ppb_flash_clipboard_thunk.cc
new file mode 100644
index 00000000000..359d78f203f
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_clipboard_thunk.cc
@@ -0,0 +1,104 @@
+// 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.
+
+#include "base/memory/scoped_ptr.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_flash_clipboard.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_flash_clipboard_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+uint32_t RegisterCustomFormat(PP_Instance instance,
+ const char* format_name) {
+ EnterInstanceAPI<PPB_Flash_Clipboard_API> enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->RegisterCustomFormat(instance, format_name);
+}
+
+PP_Bool IsFormatAvailable(PP_Instance instance,
+ PP_Flash_Clipboard_Type clipboard_type,
+ uint32_t format) {
+ EnterInstanceAPI<PPB_Flash_Clipboard_API> enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->IsFormatAvailable(instance, clipboard_type, format);
+}
+
+PP_Var ReadData(PP_Instance instance,
+ PP_Flash_Clipboard_Type clipboard_type,
+ uint32_t format) {
+ EnterInstanceAPI<PPB_Flash_Clipboard_API> enter(instance);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.functions()->ReadData(instance, clipboard_type, format);
+}
+
+int32_t WriteData(PP_Instance instance,
+ PP_Flash_Clipboard_Type clipboard_type,
+ uint32_t data_item_count,
+ const uint32_t formats[],
+ const PP_Var data_items[]) {
+ EnterInstanceAPI<PPB_Flash_Clipboard_API> enter(instance);
+ if (enter.failed())
+ return enter.retval();
+ return enter.functions()->WriteData(
+ instance, clipboard_type, data_item_count, formats, data_items);
+}
+
+PP_Bool IsFormatAvailable_4_0(PP_Instance instance,
+ PP_Flash_Clipboard_Type clipboard_type,
+ PP_Flash_Clipboard_Format format) {
+ return IsFormatAvailable(instance, clipboard_type,
+ static_cast<uint32_t>(format));
+}
+
+PP_Var ReadData_4_0(PP_Instance instance,
+ PP_Flash_Clipboard_Type clipboard_type,
+ PP_Flash_Clipboard_Format format) {
+ return ReadData(instance, clipboard_type, static_cast<uint32_t>(format));
+}
+
+int32_t WriteData_4_0(PP_Instance instance,
+ PP_Flash_Clipboard_Type clipboard_type,
+ uint32_t data_item_count,
+ const PP_Flash_Clipboard_Format formats[],
+ const PP_Var data_items[]) {
+ scoped_ptr<uint32_t[]> new_formats(new uint32_t[data_item_count]);
+ for (uint32_t i = 0; i < data_item_count; ++i)
+ new_formats[i] = static_cast<uint32_t>(formats[i]);
+ return WriteData(instance, clipboard_type, data_item_count,
+ new_formats.get(), data_items);
+}
+
+const PPB_Flash_Clipboard_4_0 g_ppb_flash_clipboard_thunk_4_0 = {
+ &IsFormatAvailable_4_0,
+ &ReadData_4_0,
+ &WriteData_4_0
+};
+
+const PPB_Flash_Clipboard_5_0 g_ppb_flash_clipboard_thunk_5_0 = {
+ &RegisterCustomFormat,
+ &IsFormatAvailable,
+ &ReadData,
+ &WriteData
+};
+
+} // namespace
+
+const PPB_Flash_Clipboard_4_0* GetPPB_Flash_Clipboard_4_0_Thunk() {
+ return &g_ppb_flash_clipboard_thunk_4_0;
+}
+
+const PPB_Flash_Clipboard_5_0* GetPPB_Flash_Clipboard_5_0_Thunk() {
+ return &g_ppb_flash_clipboard_thunk_5_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_flash_device_id_thunk.cc b/chromium/ppapi/thunk/ppb_flash_device_id_thunk.cc
new file mode 100644
index 00000000000..43432a0a8c1
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_device_id_thunk.cc
@@ -0,0 +1,52 @@
+// 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.
+
+// From private/ppb_flash_device_id.idl modified Thu Dec 20 13:10:26 2012.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_flash_device_id.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_flash_drm_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_Flash_DeviceID::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateFlashDRM(instance);
+}
+
+int32_t GetDeviceID(PP_Resource device_id,
+ struct PP_Var* id,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_Flash_DeviceID::GetDeviceID()";
+ EnterResource<PPB_Flash_DRM_API> enter(device_id, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->GetDeviceID(id, enter.callback()));
+}
+
+const PPB_Flash_DeviceID_1_0 g_ppb_flash_deviceid_thunk_1_0 = {
+ &Create,
+ &GetDeviceID
+};
+
+} // namespace
+
+const PPB_Flash_DeviceID_1_0* GetPPB_Flash_DeviceID_1_0_Thunk() {
+ return &g_ppb_flash_deviceid_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_flash_drm_api.h b/chromium/ppapi/thunk/ppb_flash_drm_api.h
new file mode 100644
index 00000000000..87712b916b6
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_drm_api.h
@@ -0,0 +1,27 @@
+// 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.
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_Flash_DRM_API {
+ public:
+ virtual ~PPB_Flash_DRM_API() {}
+
+ virtual int32_t GetDeviceID(PP_Var* id,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual PP_Bool GetHmonitor(int64_t* hmonitor) = 0;
+ virtual int32_t GetVoucherFile(PP_Resource* file_ref,
+ scoped_refptr<TrackedCallback> callback) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
diff --git a/chromium/ppapi/thunk/ppb_flash_drm_thunk.cc b/chromium/ppapi/thunk/ppb_flash_drm_thunk.cc
new file mode 100644
index 00000000000..eff2fdf74d8
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_drm_thunk.cc
@@ -0,0 +1,73 @@
+// 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.
+
+// From private/ppb_flash_drm.idl modified Sat Jun 8 16:45:26 2013.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_flash_drm.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_flash_drm_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_Flash_DRM::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateFlashDRM(instance);
+}
+
+int32_t GetDeviceID(PP_Resource drm,
+ struct PP_Var* id,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_Flash_DRM::GetDeviceID()";
+ EnterResource<PPB_Flash_DRM_API> enter(drm, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->GetDeviceID(id, enter.callback()));
+}
+
+PP_Bool GetHmonitor(PP_Resource drm, int64_t* hmonitor) {
+ VLOG(4) << "PPB_Flash_DRM::GetHmonitor()";
+ EnterResource<PPB_Flash_DRM_API> enter(drm, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->GetHmonitor(hmonitor);
+}
+
+int32_t GetVoucherFile(PP_Resource drm,
+ PP_Resource* file_ref,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_Flash_DRM::GetVoucherFile()";
+ EnterResource<PPB_Flash_DRM_API> enter(drm, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->GetVoucherFile(file_ref,
+ enter.callback()));
+}
+
+const PPB_Flash_DRM_1_0 g_ppb_flash_drm_thunk_1_0 = {
+ &Create,
+ &GetDeviceID,
+ &GetHmonitor,
+ &GetVoucherFile
+};
+
+} // namespace
+
+const PPB_Flash_DRM_1_0* GetPPB_Flash_DRM_1_0_Thunk() {
+ return &g_ppb_flash_drm_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_flash_file_api.h b/chromium/ppapi/thunk/ppb_flash_file_api.h
new file mode 100644
index 00000000000..d75725360dc
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_file_api.h
@@ -0,0 +1,63 @@
+// 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_FILE_API_H_
+#define PPAPI_THUNK_PPB_FLASH_FILE_API_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/private/pp_file_handle.h"
+#include "ppapi/c/private/ppb_flash_file.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+struct PP_FileInfo;
+
+namespace ppapi {
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_Flash_File_API {
+ public:
+ virtual ~PPB_Flash_File_API() {}
+
+ // FlashFile_ModuleLocal.
+ virtual int32_t OpenFile(PP_Instance instance,
+ const char* path,
+ int32_t mode,
+ PP_FileHandle* file) = 0;
+ virtual int32_t RenameFile(PP_Instance instance,
+ const char* path_from,
+ const char* path_to) = 0;
+ virtual int32_t DeleteFileOrDir(PP_Instance instance,
+ const char* path,
+ PP_Bool recursive) = 0;
+ virtual int32_t CreateDir(PP_Instance instance, const char* path) = 0;
+ virtual int32_t QueryFile(PP_Instance instance,
+ const char* path,
+ PP_FileInfo* info) = 0;
+ virtual int32_t GetDirContents(PP_Instance instance,
+ const char* path,
+ PP_DirContents_Dev** contents) = 0;
+ virtual void FreeDirContents(PP_Instance instance,
+ PP_DirContents_Dev* contents) = 0;
+ virtual int32_t CreateTemporaryFile(PP_Instance instance,
+ PP_FileHandle* file) = 0;
+
+ // FlashFile_FileRef.
+ virtual int32_t OpenFileRef(PP_Instance instance,
+ PP_Resource file_ref,
+ int32_t mode,
+ PP_FileHandle* file) = 0;
+ virtual int32_t QueryFileRef(PP_Instance instance,
+ PP_Resource file_ref,
+ PP_FileInfo* info) = 0;
+
+ static const SingletonResourceID kSingletonResourceID =
+ FLASH_FILE_SINGLETON_ID;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_FLASH_FILE_API_H_
diff --git a/chromium/ppapi/thunk/ppb_flash_file_fileref_thunk.cc b/chromium/ppapi/thunk/ppb_flash_file_fileref_thunk.cc
new file mode 100644
index 00000000000..8ea0f2462f8
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_file_fileref_thunk.cc
@@ -0,0 +1,57 @@
+// 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.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_flash_file.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_file_ref_api.h"
+#include "ppapi/thunk/ppb_flash_file_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+// Returns 0 on failure.
+PP_Instance GetInstanceFromFileRef(PP_Resource file_ref) {
+ thunk::EnterResource<thunk::PPB_FileRef_API> enter(file_ref, true);
+ if (enter.failed())
+ return 0;
+ return enter.resource()->pp_instance();
+}
+
+int32_t OpenFile(PP_Resource file_ref_id, int32_t mode, PP_FileHandle* file) {
+ // TODO(brettw): this function should take an instance.
+ // To work around this, use the PP_Instance from the resource.
+ PP_Instance instance = GetInstanceFromFileRef(file_ref_id);
+ EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
+ if (enter.failed())
+ return PP_ERROR_BADARGUMENT;
+ return enter.functions()->OpenFileRef(instance, file_ref_id, mode, file);
+}
+
+int32_t QueryFile(PP_Resource file_ref_id, struct PP_FileInfo* info) {
+ // TODO(brettw): this function should take an instance.
+ // To work around this, use the PP_Instance from the resource.
+ PP_Instance instance = GetInstanceFromFileRef(file_ref_id);
+ EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
+ if (enter.failed())
+ return PP_ERROR_BADARGUMENT;
+ return enter.functions()->QueryFileRef(instance, file_ref_id, info);
+}
+
+const PPB_Flash_File_FileRef g_ppb_flash_file_fileref_thunk = {
+ &OpenFile,
+ &QueryFile
+};
+
+} // namespace
+
+const PPB_Flash_File_FileRef* GetPPB_Flash_File_FileRef_Thunk() {
+ return &g_ppb_flash_file_fileref_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_flash_file_modulelocal_thunk.cc b/chromium/ppapi/thunk/ppb_flash_file_modulelocal_thunk.cc
new file mode 100644
index 00000000000..11962e41edd
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_file_modulelocal_thunk.cc
@@ -0,0 +1,111 @@
+// 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.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_flash_file.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_flash_file_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+bool CreateThreadAdapterForInstance(PP_Instance instance) {
+ return true;
+}
+
+void ClearThreadAdapterForInstance(PP_Instance instance) {
+}
+
+int32_t OpenFile(PP_Instance instance,
+ const char* path,
+ int32_t mode,
+ PP_FileHandle* file) {
+ EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
+ if (enter.failed())
+ return PP_ERROR_BADARGUMENT;
+ return enter.functions()->OpenFile(instance, path, mode, file);
+}
+
+int32_t RenameFile(PP_Instance instance,
+ const char* path_from,
+ const char* path_to) {
+ EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
+ if (enter.failed())
+ return PP_ERROR_BADARGUMENT;
+ return enter.functions()->RenameFile(instance, path_from, path_to);
+}
+
+int32_t DeleteFileOrDir(PP_Instance instance,
+ const char* path,
+ PP_Bool recursive) {
+ EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
+ if (enter.failed())
+ return PP_ERROR_BADARGUMENT;
+ return enter.functions()->DeleteFileOrDir(instance, path, recursive);
+}
+
+int32_t CreateDir(PP_Instance instance, const char* path) {
+ EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
+ if (enter.failed())
+ return PP_ERROR_BADARGUMENT;
+ return enter.functions()->CreateDir(instance, path);
+}
+
+int32_t QueryFile(PP_Instance instance, const char* path, PP_FileInfo* info) {
+ EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
+ if (enter.failed())
+ return PP_ERROR_BADARGUMENT;
+ return enter.functions()->QueryFile(instance, path, info);
+}
+
+int32_t GetDirContents(PP_Instance instance,
+ const char* path,
+ PP_DirContents_Dev** contents) {
+ EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
+ if (enter.failed())
+ return PP_ERROR_BADARGUMENT;
+ return enter.functions()->GetDirContents(instance, path, contents);
+}
+
+void FreeDirContents(PP_Instance instance,
+ PP_DirContents_Dev* contents) {
+ EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
+ if (enter.succeeded())
+ enter.functions()->FreeDirContents(instance, contents);
+}
+
+int32_t CreateTemporaryFile(PP_Instance instance, PP_FileHandle* file) {
+ EnterInstanceAPI<PPB_Flash_File_API> enter(instance);
+ if (enter.failed())
+ return PP_ERROR_BADARGUMENT;
+
+ *file = PP_kInvalidFileHandle;
+ return enter.functions()->CreateTemporaryFile(instance, file);
+}
+
+const PPB_Flash_File_ModuleLocal_3_0 g_ppb_flash_file_modulelocal_thunk_3_0 = {
+ &CreateThreadAdapterForInstance,
+ &ClearThreadAdapterForInstance,
+ &OpenFile,
+ &RenameFile,
+ &DeleteFileOrDir,
+ &CreateDir,
+ &QueryFile,
+ &GetDirContents,
+ &FreeDirContents,
+ &CreateTemporaryFile
+};
+
+} // namespace
+
+const PPB_Flash_File_ModuleLocal_3_0*
+ GetPPB_Flash_File_ModuleLocal_3_0_Thunk() {
+ return &g_ppb_flash_file_modulelocal_thunk_3_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_flash_font_file_api.h b/chromium/ppapi/thunk/ppb_flash_font_file_api.h
new file mode 100644
index 00000000000..9e8ce236bbf
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_font_file_api.h
@@ -0,0 +1,26 @@
+// 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_FONT_FILE_API_H_
+#define PPAPI_THUNK_PPB_FLASH_FONT_FILE_API_H_
+
+#include "ppapi/c/pp_stdint.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPB_Flash_FontFile_API {
+ public:
+ virtual ~PPB_Flash_FontFile_API() {}
+
+ virtual PP_Bool GetFontTable(uint32_t table,
+ void* output,
+ uint32_t* output_length) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_FLASH_FONT_FILE_API_H_
+
diff --git a/chromium/ppapi/thunk/ppb_flash_font_file_thunk.cc b/chromium/ppapi/thunk/ppb_flash_font_file_thunk.cc
new file mode 100644
index 00000000000..3a073657a60
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_font_file_thunk.cc
@@ -0,0 +1,53 @@
+// 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.
+
+#include "ppapi/c/private/ppb_flash_font_file.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_flash_font_file_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance,
+ const PP_BrowserFont_Trusted_Description* description,
+ PP_PrivateFontCharset charset) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateFlashFontFile(instance, description, charset);
+}
+
+PP_Bool IsFlashFontFile(PP_Resource resource) {
+ EnterResource<PPB_Flash_FontFile_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+PP_Bool GetFontTable(PP_Resource font_file,
+ uint32_t table,
+ void* output,
+ uint32_t* output_length) {
+ EnterResource<PPB_Flash_FontFile_API> enter(font_file, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->GetFontTable(table, output, output_length);
+}
+
+const PPB_Flash_FontFile g_ppb_flash_fontfile_thunk = {
+ &Create,
+ &IsFlashFontFile,
+ &GetFontTable
+};
+
+} // namespace
+
+const PPB_Flash_FontFile_0_1* GetPPB_Flash_FontFile_0_1_Thunk() {
+ return &g_ppb_flash_fontfile_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_flash_fullscreen_api.h b/chromium/ppapi/thunk/ppb_flash_fullscreen_api.h
new file mode 100644
index 00000000000..d1435b55f86
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_fullscreen_api.h
@@ -0,0 +1,35 @@
+// 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_FULLSCREEN_API_H_
+#define PPAPI_THUNK_PPB_FLASH_FULLSCREEN_API_H_
+
+#include "ppapi/shared_impl/singleton_resource_id.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_Flash_Fullscreen_API {
+ public:
+ virtual ~PPB_Flash_Fullscreen_API() {}
+
+ virtual PP_Bool IsFullscreen(PP_Instance instance) = 0;
+ virtual PP_Bool SetFullscreen(PP_Instance instance,
+ PP_Bool fullscreen) = 0;
+
+ // Internal function used to update whether or not Flash fullscreen is enabled
+ // in the plugin side. The value is passed with a
+ // PpapiMsg_PPPInstance_DidChangeView message.
+ virtual void SetLocalIsFullscreen(PP_Instance instance,
+ PP_Bool fullscreen) = 0;
+
+ static const SingletonResourceID kSingletonResourceID =
+ FLASH_FULLSCREEN_SINGLETON_ID;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_FLASH_FULLSCREEN_API_H_
diff --git a/chromium/ppapi/thunk/ppb_flash_fullscreen_thunk.cc b/chromium/ppapi/thunk/ppb_flash_fullscreen_thunk.cc
new file mode 100644
index 00000000000..f64ad992fda
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_fullscreen_thunk.cc
@@ -0,0 +1,54 @@
+// 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.
+
+#include "ppapi/c/ppb_fullscreen.h"
+#include "ppapi/c/private/ppb_flash_fullscreen.h"
+#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_flash_fullscreen_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Bool IsFullscreen(PP_Instance instance) {
+ EnterInstanceAPI<PPB_Flash_Fullscreen_API> enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->IsFullscreen(instance);
+}
+
+PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) {
+ EnterInstanceAPI<PPB_Flash_Fullscreen_API> enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->SetFullscreen(instance, fullscreen);
+}
+
+// TODO(raymes): The codepaths for GetScreenSize in PPB_Fullscreen and
+// PPB_Flash_Fullscreen are the same. Consider deprecating the flash version.
+PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->GetScreenSize(instance, size);
+}
+
+const PPB_FlashFullscreen_0_1 g_ppb_flash_fullscreen_thunk = {
+ &IsFullscreen,
+ &SetFullscreen,
+ &GetScreenSize
+};
+
+} // namespace
+
+const PPB_FlashFullscreen_0_1* GetPPB_FlashFullscreen_0_1_Thunk() {
+ return &g_ppb_flash_fullscreen_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_flash_functions_api.h b/chromium/ppapi/thunk/ppb_flash_functions_api.h
new file mode 100644
index 00000000000..b7462432b73
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_functions_api.h
@@ -0,0 +1,57 @@
+// 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 <string>
+
+#include "ppapi/c/private/ppb_flash.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+struct PP_BrowserFont_Trusted_Description;
+
+namespace ppapi {
+namespace thunk {
+
+// This class collects all of the Flash interface-related APIs into one place.
+class PPAPI_THUNK_EXPORT PPB_Flash_Functions_API {
+ public:
+ virtual ~PPB_Flash_Functions_API() {}
+
+ virtual PP_Var GetProxyForURL(PP_Instance instance,
+ const std::string& url) = 0;
+ virtual void UpdateActivity(PP_Instance instance) = 0;
+ virtual PP_Bool SetCrashData(PP_Instance instance, PP_FlashCrashKey key,
+ PP_Var value) = 0;
+ virtual double GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) = 0;
+ virtual PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting) = 0;
+ virtual void SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) = 0;
+ virtual PP_Bool DrawGlyphs(
+ PP_Instance instance,
+ PP_Resource pp_image_data,
+ const PP_BrowserFont_Trusted_Description* font_desc,
+ uint32_t color,
+ 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[]) = 0;
+ virtual int32_t Navigate(PP_Instance instance,
+ PP_Resource request_info,
+ const char* target,
+ PP_Bool from_user_action) = 0;
+ virtual PP_Bool IsRectTopmost(PP_Instance instance, const PP_Rect* rect) = 0;
+ virtual void InvokePrinting(PP_Instance instance) = 0;
+
+ static const SingletonResourceID kSingletonResourceID = FLASH_SINGLETON_ID;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_FLASH_FUNCTIONS_API_H_
diff --git a/chromium/ppapi/thunk/ppb_flash_menu_api.h b/chromium/ppapi/thunk/ppb_flash_menu_api.h
new file mode 100644
index 00000000000..410bda59e0a
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_menu_api.h
@@ -0,0 +1,29 @@
+// 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_MENU_API_H_
+#define PPAPI_THUNK_PPB_FLASH_MENU_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/private/ppb_flash_menu.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPB_Flash_Menu_API {
+ public:
+ virtual ~PPB_Flash_Menu_API() {}
+
+ virtual int32_t Show(const PP_Point* location,
+ int32_t* selected_id,
+ scoped_refptr<TrackedCallback> callback) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_FLASH_MENU_API_H_
diff --git a/chromium/ppapi/thunk/ppb_flash_menu_thunk.cc b/chromium/ppapi/thunk/ppb_flash_menu_thunk.cc
new file mode 100644
index 00000000000..e0d190dbe58
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_menu_thunk.cc
@@ -0,0 +1,55 @@
+// 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.
+
+#include "ppapi/c/private/ppb_flash_menu.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/ppb_flash_menu_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance, const PP_Flash_Menu* menu_data) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateFlashMenu(instance, menu_data);
+}
+
+PP_Bool IsFlashMenu(PP_Resource resource) {
+ EnterResource<PPB_Flash_Menu_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Show(PP_Resource resource,
+ const PP_Point* location,
+ int32_t* selected_id,
+ PP_CompletionCallback callback) {
+ EnterResource<PPB_Flash_Menu_API> enter(resource, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Show(location, selected_id,
+ enter.callback()));
+}
+
+const PPB_Flash_Menu g_ppb_flash_menu_thunk = {
+ &Create,
+ &IsFlashMenu,
+ &Show
+};
+
+} // namespace
+
+const PPB_Flash_Menu_0_2* GetPPB_Flash_Menu_0_2_Thunk() {
+ return &g_ppb_flash_menu_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_flash_message_loop_api.h b/chromium/ppapi/thunk/ppb_flash_message_loop_api.h
new file mode 100644
index 00000000000..618eacee61c
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_message_loop_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_MESSAGE_LOOP_API_H_
+#define PPAPI_THUNK_PPB_FLASH_MESSAGE_LOOP_API_H_
+
+#include "base/callback_forward.h"
+#include "ppapi/c/private/ppb_flash_message_loop.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPB_Flash_MessageLoop_API {
+ public:
+ virtual ~PPB_Flash_MessageLoop_API() {}
+
+ virtual int32_t Run() = 0;
+ virtual void Quit() = 0;
+
+ // This is used by the proxy at the host side to call into the implementation.
+ // |callback| is called when the message loop is signaled to quit but before
+ // the method returns.
+ typedef base::Callback<void (int32_t)> RunFromHostProxyCallback;
+ virtual void RunFromHostProxy(
+ const RunFromHostProxyCallback& callback) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_FLASH_MESSAGE_LOOP_API_H_
diff --git a/chromium/ppapi/thunk/ppb_flash_message_loop_thunk.cc b/chromium/ppapi/thunk/ppb_flash_message_loop_thunk.cc
new file mode 100644
index 00000000000..583bc49a66e
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_message_loop_thunk.cc
@@ -0,0 +1,56 @@
+// 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.
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_flash_message_loop_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateFlashMessageLoop(instance);
+}
+
+PP_Bool IsFlashMessageLoop(PP_Resource resource) {
+ EnterResource<PPB_Flash_MessageLoop_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Run(PP_Resource resource) {
+ EnterResource<PPB_Flash_MessageLoop_API> enter(resource, true);
+ if (enter.failed())
+ return PP_ERROR_BADRESOURCE;
+ return enter.object()->Run();
+}
+
+void Quit(PP_Resource resource) {
+ EnterResource<PPB_Flash_MessageLoop_API> enter(resource, true);
+ if (enter.succeeded())
+ enter.object()->Quit();
+}
+
+const PPB_Flash_MessageLoop g_ppb_flash_message_loop_thunk = {
+ &Create,
+ &IsFlashMessageLoop,
+ &Run,
+ &Quit
+};
+
+} // namespace
+
+const PPB_Flash_MessageLoop_0_1* GetPPB_Flash_MessageLoop_0_1_Thunk() {
+ return &g_ppb_flash_message_loop_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_flash_print_thunk.cc b/chromium/ppapi/thunk/ppb_flash_print_thunk.cc
new file mode 100644
index 00000000000..1316784d6de
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_print_thunk.cc
@@ -0,0 +1,34 @@
+// 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.
+
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/private/ppb_flash_print.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_flash_functions_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void InvokePrinting(PP_Instance instance) {
+ EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->InvokePrinting(instance);
+}
+
+const PPB_Flash_Print_1_0 g_ppb_flash_print_1_0_thunk = {
+ &InvokePrinting,
+};
+
+} // namespace
+
+const PPB_Flash_Print_1_0* GetPPB_Flash_Print_1_0_Thunk() {
+ return &g_ppb_flash_print_1_0_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_flash_thunk.cc b/chromium/ppapi/thunk/ppb_flash_thunk.cc
new file mode 100644
index 00000000000..574df8709eb
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_flash_thunk.cc
@@ -0,0 +1,255 @@
+// 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.
+
+#include "base/logging.h"
+#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"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_flash_functions_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_video_capture_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) {
+ EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->SetInstanceAlwaysOnTop(instance, on_top);
+}
+
+PP_Bool DrawGlyphs(PP_Instance instance,
+ PP_Resource pp_image_data,
+ const PP_BrowserFont_Trusted_Description* font_desc,
+ uint32_t color,
+ 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[]) {
+ EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->DrawGlyphs(
+ instance, pp_image_data, font_desc, color, position, clip, transformation,
+ allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances);
+}
+
+PP_Var GetProxyForURL(PP_Instance instance, const char* url) {
+ EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.functions()->GetProxyForURL(instance, url);
+}
+
+int32_t Navigate(PP_Resource request_id,
+ const char* target,
+ PP_Bool from_user_action) {
+ // TODO(brettw): this function should take an instance.
+ // To work around this, use the PP_Instance from the resource.
+ PP_Instance instance;
+ {
+ EnterResource<PPB_URLRequestInfo_API> enter(request_id, true);
+ if (enter.failed())
+ return PP_ERROR_BADRESOURCE;
+ instance = enter.resource()->pp_instance();
+ }
+
+ EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
+ if (enter.failed())
+ return PP_ERROR_BADARGUMENT;
+ return enter.functions()->Navigate(instance, request_id, target,
+ from_user_action);
+}
+
+void RunMessageLoop(PP_Instance instance) {
+ // Deprecated.
+ NOTREACHED();
+ return;
+}
+
+void QuitMessageLoop(PP_Instance instance) {
+ // Deprecated.
+ NOTREACHED();
+ return;
+}
+
+double GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
+ EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
+ if (enter.failed())
+ return 0.0;
+ return enter.functions()->GetLocalTimeZoneOffset(instance, t);
+}
+
+PP_Var GetCommandLineArgs(PP_Module /* pp_module */) {
+ // There's no instance so we have to reach into the globals without thunking.
+ ProxyAutoLock lock;
+ return StringVar::StringToPPVar(PpapiGlobals::Get()->GetCmdLine());
+}
+
+void PreLoadFontWin(const void* logfontw) {
+ // There's no instance so we have to reach into the delegate without
+ // thunking.
+ ProxyAutoLock lock;
+ PpapiGlobals::Get()->PreCacheFontForFlash(logfontw);
+}
+
+PP_Bool IsRectTopmost(PP_Instance instance, const PP_Rect* rect) {
+ EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->IsRectTopmost(instance, rect);
+}
+
+int32_t InvokePrinting(PP_Instance instance) {
+ // This function is no longer supported, use PPB_Flash_Print instead.
+ return PP_ERROR_NOTSUPPORTED;
+}
+
+void UpdateActivity(PP_Instance instance) {
+ EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->UpdateActivity(instance);
+}
+
+PP_Var GetDeviceID(PP_Instance instance) {
+ // Deprecated.
+ NOTREACHED();
+ return PP_MakeUndefined();
+}
+
+int32_t GetSettingInt(PP_Instance instance, PP_FlashSetting setting) {
+ // Deprecated.
+ NOTREACHED();
+ return -1;
+}
+
+PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting) {
+ EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.functions()->GetSetting(instance, setting);
+}
+
+PP_Bool SetCrashData(PP_Instance instance,
+ PP_FlashCrashKey key,
+ PP_Var value) {
+ EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->SetCrashData(instance, key, value);
+}
+
+int32_t EnumerateVideoCaptureDevices(PP_Instance instance,
+ PP_Resource video_capture,
+ PP_ArrayOutput devices) {
+ EnterResource<PPB_VideoCapture_API> enter(video_capture, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->EnumerateDevicesSync(devices);
+}
+
+const PPB_Flash_12_4 g_ppb_flash_12_4_thunk = {
+ &SetInstanceAlwaysOnTop,
+ &DrawGlyphs,
+ &GetProxyForURL,
+ &Navigate,
+ &RunMessageLoop,
+ &QuitMessageLoop,
+ &GetLocalTimeZoneOffset,
+ &GetCommandLineArgs,
+ &PreLoadFontWin,
+ &IsRectTopmost,
+ &InvokePrinting,
+ &UpdateActivity,
+ &GetDeviceID,
+ &GetSettingInt,
+ &GetSetting
+};
+
+const PPB_Flash_12_5 g_ppb_flash_12_5_thunk = {
+ &SetInstanceAlwaysOnTop,
+ &DrawGlyphs,
+ &GetProxyForURL,
+ &Navigate,
+ &RunMessageLoop,
+ &QuitMessageLoop,
+ &GetLocalTimeZoneOffset,
+ &GetCommandLineArgs,
+ &PreLoadFontWin,
+ &IsRectTopmost,
+ &InvokePrinting,
+ &UpdateActivity,
+ &GetDeviceID,
+ &GetSettingInt,
+ &GetSetting,
+ &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
+};
+
+const PPB_Flash_13_0 g_ppb_flash_13_0_thunk = {
+ &SetInstanceAlwaysOnTop,
+ &DrawGlyphs,
+ &GetProxyForURL,
+ &Navigate,
+ &GetLocalTimeZoneOffset,
+ &GetCommandLineArgs,
+ &PreLoadFontWin,
+ &IsRectTopmost,
+ &UpdateActivity,
+ &GetSetting,
+ &SetCrashData,
+ &EnumerateVideoCaptureDevices
+};
+
+} // namespace
+
+const PPB_Flash_12_4* GetPPB_Flash_12_4_Thunk() {
+ return &g_ppb_flash_12_4_thunk;
+}
+
+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;
+}
+
+const PPB_Flash_13_0* GetPPB_Flash_13_0_Thunk() {
+ return &g_ppb_flash_13_0_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_fullscreen_thunk.cc b/chromium/ppapi/thunk/ppb_fullscreen_thunk.cc
new file mode 100644
index 00000000000..9e07356c918
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_fullscreen_thunk.cc
@@ -0,0 +1,57 @@
+// 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.
+
+// From ppb_fullscreen.idl modified Wed May 1 09:47:29 2013.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_fullscreen.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Bool IsFullscreen(PP_Instance instance) {
+ VLOG(4) << "PPB_Fullscreen::IsFullscreen()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->IsFullscreen(instance);
+}
+
+PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) {
+ VLOG(4) << "PPB_Fullscreen::SetFullscreen()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->SetFullscreen(instance, fullscreen);
+}
+
+PP_Bool GetScreenSize(PP_Instance instance, struct PP_Size* size) {
+ VLOG(4) << "PPB_Fullscreen::GetScreenSize()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->GetScreenSize(instance, size);
+}
+
+const PPB_Fullscreen_1_0 g_ppb_fullscreen_thunk_1_0 = {
+ &IsFullscreen,
+ &SetFullscreen,
+ &GetScreenSize
+};
+
+} // namespace
+
+const PPB_Fullscreen_1_0* GetPPB_Fullscreen_1_0_Thunk() {
+ return &g_ppb_fullscreen_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_gamepad_api.h b/chromium/ppapi/thunk/ppb_gamepad_api.h
new file mode 100644
index 00000000000..88b317c42ff
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_gamepad_api.h
@@ -0,0 +1,29 @@
+// 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_GAMEPAD_API_H_
+#define PPAPI_THUNK_PPB_GAMEPAD_API_H_
+
+#include "ppapi/shared_impl/singleton_resource_id.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+struct PP_GamepadsSampleData;
+
+namespace ppapi {
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_Gamepad_API {
+ public:
+ virtual ~PPB_Gamepad_API() {}
+
+ virtual void Sample(PP_Instance instance,
+ PP_GamepadsSampleData* data) = 0;
+
+ static const SingletonResourceID kSingletonResourceID = GAMEPAD_SINGLETON_ID;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_GAMEPAD_API_H_
diff --git a/chromium/ppapi/thunk/ppb_gamepad_thunk.cc b/chromium/ppapi/thunk/ppb_gamepad_thunk.cc
new file mode 100644
index 00000000000..e36af344106
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_gamepad_thunk.cc
@@ -0,0 +1,44 @@
+// 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.
+
+// From ppb_gamepad.idl modified Wed Apr 17 11:16:00 2013.
+
+#include <string.h>
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_gamepad.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_gamepad_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void Sample(PP_Instance instance, struct PP_GamepadsSampleData* data) {
+ VLOG(4) << "PPB_Gamepad::Sample()";
+ EnterInstanceAPI<PPB_Gamepad_API> enter(instance);
+ if (enter.failed()) {
+ memset(data, 0, sizeof(*data));
+ return;
+ }
+ enter.functions()->Sample(instance, data);
+}
+
+const PPB_Gamepad_1_0 g_ppb_gamepad_thunk_1_0 = {
+ &Sample
+};
+
+} // namespace
+
+const PPB_Gamepad_1_0* GetPPB_Gamepad_1_0_Thunk() {
+ return &g_ppb_gamepad_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_gles_chromium_texture_mapping_thunk.cc b/chromium/ppapi/thunk/ppb_gles_chromium_texture_mapping_thunk.cc
new file mode 100644
index 00000000000..a9ecd05ab5d
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_gles_chromium_texture_mapping_thunk.cc
@@ -0,0 +1,55 @@
+// 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.
+
+#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_graphics_3d_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterResource<PPB_Graphics3D_API> EnterGraphics3D;
+
+void* MapTexSubImage2DCHROMIUM(PP_Resource context,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLenum access) {
+ EnterGraphics3D enter(context, true);
+ if (enter.succeeded()) {
+ return enter.object()->MapTexSubImage2DCHROMIUM(
+ target, level, xoffset, yoffset, width, height, format, type, access);
+ }
+ return NULL;
+}
+
+void UnmapTexSubImage2DCHROMIUM(PP_Resource context, const void* mem) {
+ EnterGraphics3D enter(context, true);
+ if (enter.succeeded())
+ enter.object()->UnmapTexSubImage2DCHROMIUM(mem);
+}
+
+const PPB_GLESChromiumTextureMapping_Dev
+g_ppb_gles_chromium_texture_mapping_thunk = {
+ &MapTexSubImage2DCHROMIUM,
+ &UnmapTexSubImage2DCHROMIUM
+};
+
+} // namespace
+
+const PPB_GLESChromiumTextureMapping_Dev_0_1*
+GetPPB_GLESChromiumTextureMapping_Dev_0_1_Thunk() {
+ return &g_ppb_gles_chromium_texture_mapping_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_graphics_2d_api.h b/chromium/ppapi/thunk/ppb_graphics_2d_api.h
new file mode 100644
index 00000000000..4e1bda398b8
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_graphics_2d_api.h
@@ -0,0 +1,47 @@
+// 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_GRAPHICS_2D_API_H_
+#define PPAPI_THUNK_PPB_GRAPHICS_2D_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_completion_callback.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/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_Graphics2D_API {
+ public:
+ virtual ~PPB_Graphics2D_API() {}
+
+ virtual PP_Bool Describe(PP_Size* size, PP_Bool* is_always_opaque) = 0;
+ virtual void PaintImageData(PP_Resource image_data,
+ const PP_Point* top_left,
+ const PP_Rect* src_rect) = 0;
+ virtual void Scroll(const PP_Rect* clip_rect,
+ const PP_Point* amount) = 0;
+ virtual void ReplaceContents(PP_Resource image_data) = 0;
+ virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) = 0;
+
+ // Dev interface.
+ virtual PP_Bool SetScale(float scale) = 0;
+ virtual float GetScale() = 0;
+
+ // Test only
+ virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_GRAPHICS_2D_API_H_
diff --git a/chromium/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc b/chromium/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc
new file mode 100644
index 00000000000..760ecee2a4d
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc
@@ -0,0 +1,49 @@
+// 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.
+
+// From dev/ppb_graphics_2d_dev.idl modified Fri Apr 26 08:52:02 2013.
+
+#include "ppapi/c/dev/ppb_graphics_2d_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_graphics_2d_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Bool SetScale(PP_Resource resource, float scale) {
+ VLOG(4) << "PPB_Graphics2D_Dev::SetScale()";
+ EnterResource<PPB_Graphics2D_API> enter(resource, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->SetScale(scale);
+}
+
+float GetScale(PP_Resource resource) {
+ VLOG(4) << "PPB_Graphics2D_Dev::GetScale()";
+ EnterResource<PPB_Graphics2D_API> enter(resource, true);
+ if (enter.failed())
+ return 0.0f;
+ return enter.object()->GetScale();
+}
+
+const PPB_Graphics2D_Dev_0_1 g_ppb_graphics2d_dev_thunk_0_1 = {
+ &SetScale,
+ &GetScale
+};
+
+} // namespace
+
+const PPB_Graphics2D_Dev_0_1* GetPPB_Graphics2D_Dev_0_1_Thunk() {
+ return &g_ppb_graphics2d_dev_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_graphics_2d_thunk.cc b/chromium/ppapi/thunk/ppb_graphics_2d_thunk.cc
new file mode 100644
index 00000000000..9eefee2d303
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_graphics_2d_thunk.cc
@@ -0,0 +1,139 @@
+// 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.
+
+// From ppb_graphics_2d.idl modified Fri Apr 26 08:49:08 2013.
+
+#include <string.h>
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_graphics_2d.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_graphics_2d_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance,
+ const struct PP_Size* size,
+ PP_Bool is_always_opaque) {
+ VLOG(4) << "PPB_Graphics2D::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateGraphics2D(instance, size, is_always_opaque);
+}
+
+PP_Bool IsGraphics2D(PP_Resource resource) {
+ VLOG(4) << "PPB_Graphics2D::IsGraphics2D()";
+ EnterResource<PPB_Graphics2D_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+PP_Bool Describe(PP_Resource graphics_2d,
+ struct PP_Size* size,
+ PP_Bool* is_always_opaque) {
+ VLOG(4) << "PPB_Graphics2D::Describe()";
+ EnterResource<PPB_Graphics2D_API> enter(graphics_2d, true);
+ if (enter.failed()) {
+ memset(size, 0, sizeof(*size));
+ memset(is_always_opaque, 0, sizeof(*is_always_opaque));
+ return PP_FALSE;
+ }
+ return enter.object()->Describe(size, is_always_opaque);
+}
+
+void PaintImageData(PP_Resource graphics_2d,
+ PP_Resource image_data,
+ const struct PP_Point* top_left,
+ const struct PP_Rect* src_rect) {
+ VLOG(4) << "PPB_Graphics2D::PaintImageData()";
+ EnterResource<PPB_Graphics2D_API> enter(graphics_2d, true);
+ if (enter.failed())
+ return;
+ enter.object()->PaintImageData(image_data, top_left, src_rect);
+}
+
+void Scroll(PP_Resource graphics_2d,
+ const struct PP_Rect* clip_rect,
+ const struct PP_Point* amount) {
+ VLOG(4) << "PPB_Graphics2D::Scroll()";
+ EnterResource<PPB_Graphics2D_API> enter(graphics_2d, true);
+ if (enter.failed())
+ return;
+ enter.object()->Scroll(clip_rect, amount);
+}
+
+void ReplaceContents(PP_Resource graphics_2d, PP_Resource image_data) {
+ VLOG(4) << "PPB_Graphics2D::ReplaceContents()";
+ EnterResource<PPB_Graphics2D_API> enter(graphics_2d, true);
+ if (enter.failed())
+ return;
+ enter.object()->ReplaceContents(image_data);
+}
+
+int32_t Flush(PP_Resource graphics_2d, struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_Graphics2D::Flush()";
+ EnterResource<PPB_Graphics2D_API> enter(graphics_2d, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Flush(enter.callback()));
+}
+
+PP_Bool SetScale(PP_Resource resource, float scale) {
+ VLOG(4) << "PPB_Graphics2D::SetScale()";
+ EnterResource<PPB_Graphics2D_API> enter(resource, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->SetScale(scale);
+}
+
+float GetScale(PP_Resource resource) {
+ VLOG(4) << "PPB_Graphics2D::GetScale()";
+ EnterResource<PPB_Graphics2D_API> enter(resource, true);
+ if (enter.failed())
+ return 0.0f;
+ return enter.object()->GetScale();
+}
+
+const PPB_Graphics2D_1_0 g_ppb_graphics2d_thunk_1_0 = {
+ &Create,
+ &IsGraphics2D,
+ &Describe,
+ &PaintImageData,
+ &Scroll,
+ &ReplaceContents,
+ &Flush
+};
+
+const PPB_Graphics2D_1_1 g_ppb_graphics2d_thunk_1_1 = {
+ &Create,
+ &IsGraphics2D,
+ &Describe,
+ &PaintImageData,
+ &Scroll,
+ &ReplaceContents,
+ &Flush,
+ &SetScale,
+ &GetScale
+};
+
+} // namespace
+
+const PPB_Graphics2D_1_0* GetPPB_Graphics2D_1_0_Thunk() {
+ return &g_ppb_graphics2d_thunk_1_0;
+}
+
+const PPB_Graphics2D_1_1* GetPPB_Graphics2D_1_1_Thunk() {
+ return &g_ppb_graphics2d_thunk_1_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_graphics_3d_api.h b/chromium/ppapi/thunk/ppb_graphics_3d_api.h
new file mode 100644
index 00000000000..6c6a2417b76
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_graphics_3d_api.h
@@ -0,0 +1,63 @@
+// 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_GRAPHICS_3D_API_H_
+#define PPAPI_THUNK_PPB_GRAPHICS_3D_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "gpu/command_buffer/common/command_buffer.h"
+#include "ppapi/c/ppb_graphics_3d.h"
+#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_Graphics3D_API {
+ public:
+ virtual ~PPB_Graphics3D_API() {}
+
+ // Graphics3D API.
+ virtual int32_t GetAttribs(int32_t attrib_list[]) = 0;
+ virtual int32_t SetAttribs(const int32_t attrib_list[]) = 0;
+ virtual int32_t GetError() = 0;
+ virtual int32_t ResizeBuffers(int32_t width, int32_t height) = 0;
+ virtual int32_t SwapBuffers(scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t GetAttribMaxValue(int32_t attribute, int32_t* value) = 0;
+
+ // Graphics3DTrusted API.
+ virtual PP_Bool SetGetBuffer(int32_t shm_id) = 0;
+ virtual gpu::CommandBuffer::State GetState() = 0;
+ virtual int32_t CreateTransferBuffer(uint32_t size) = 0;
+ virtual PP_Bool DestroyTransferBuffer(int32_t id) = 0;
+ virtual PP_Bool GetTransferBuffer(int32_t id,
+ int* shm_handle,
+ uint32_t* shm_size) = 0;
+ virtual PP_Bool Flush(int32_t put_offset) = 0;
+ virtual gpu::CommandBuffer::State FlushSync(int32_t put_offset) = 0;
+ virtual gpu::CommandBuffer::State FlushSyncFast(int32_t put_offset,
+ int32_t last_known_get) = 0;
+
+ // GLESChromiumTextureMapping.
+ virtual void* MapTexSubImage2DCHROMIUM(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLenum access) = 0;
+ virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) = 0;
+
+ virtual uint32_t InsertSyncPoint() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_GRAPHICS_3D_API_H_
diff --git a/chromium/ppapi/thunk/ppb_graphics_3d_thunk.cc b/chromium/ppapi/thunk/ppb_graphics_3d_thunk.cc
new file mode 100644
index 00000000000..cc006965e05
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_graphics_3d_thunk.cc
@@ -0,0 +1,109 @@
+// 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.
+
+// From ppb_graphics_3d.idl modified Mon Apr 1 08:24:03 2013.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_graphics_3d.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_graphics_3d_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+int32_t GetAttribMaxValue(PP_Resource instance,
+ int32_t attribute,
+ int32_t* value) {
+ VLOG(4) << "PPB_Graphics3D::GetAttribMaxValue()";
+ EnterResource<PPB_Graphics3D_API> enter(instance, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->GetAttribMaxValue(attribute, value);
+}
+
+PP_Resource Create(PP_Instance instance,
+ PP_Resource share_context,
+ const int32_t attrib_list[]) {
+ VLOG(4) << "PPB_Graphics3D::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateGraphics3D(instance,
+ share_context,
+ attrib_list);
+}
+
+PP_Bool IsGraphics3D(PP_Resource resource) {
+ VLOG(4) << "PPB_Graphics3D::IsGraphics3D()";
+ EnterResource<PPB_Graphics3D_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t GetAttribs(PP_Resource context, int32_t attrib_list[]) {
+ VLOG(4) << "PPB_Graphics3D::GetAttribs()";
+ EnterResource<PPB_Graphics3D_API> enter(context, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->GetAttribs(attrib_list);
+}
+
+int32_t SetAttribs(PP_Resource context, const int32_t attrib_list[]) {
+ VLOG(4) << "PPB_Graphics3D::SetAttribs()";
+ EnterResource<PPB_Graphics3D_API> enter(context, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->SetAttribs(attrib_list);
+}
+
+int32_t GetError(PP_Resource context) {
+ VLOG(4) << "PPB_Graphics3D::GetError()";
+ EnterResource<PPB_Graphics3D_API> enter(context, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->GetError();
+}
+
+int32_t ResizeBuffers(PP_Resource context, int32_t width, int32_t height) {
+ VLOG(4) << "PPB_Graphics3D::ResizeBuffers()";
+ EnterResource<PPB_Graphics3D_API> enter(context, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->ResizeBuffers(width, height);
+}
+
+int32_t SwapBuffers(PP_Resource context,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_Graphics3D::SwapBuffers()";
+ EnterResource<PPB_Graphics3D_API> enter(context, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->SwapBuffers(enter.callback()));
+}
+
+const PPB_Graphics3D_1_0 g_ppb_graphics3d_thunk_1_0 = {
+ &GetAttribMaxValue,
+ &Create,
+ &IsGraphics3D,
+ &GetAttribs,
+ &SetAttribs,
+ &GetError,
+ &ResizeBuffers,
+ &SwapBuffers
+};
+
+} // namespace
+
+const PPB_Graphics3D_1_0* GetPPB_Graphics3D_1_0_Thunk() {
+ return &g_ppb_graphics3d_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_host_resolver_api.h b/chromium/ppapi/thunk/ppb_host_resolver_api.h
new file mode 100644
index 00000000000..f2acde20dfa
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_host_resolver_api.h
@@ -0,0 +1,34 @@
+// Copyright 2013 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_HOST_RESOLVER_API_H_
+#define PPAPI_THUNK_PPB_HOST_RESOLVER_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/ppb_host_resolver.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_HostResolver_API {
+ public:
+ virtual ~PPB_HostResolver_API() {}
+
+ virtual int32_t Resolve(const char* host,
+ uint16_t port,
+ const PP_HostResolver_Hint* hint,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual PP_Var GetCanonicalName() = 0;
+ virtual uint32_t GetNetAddressCount() = 0;
+ virtual PP_Resource GetNetAddress(uint32_t index) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_TCP_SOCKET_API_H_
diff --git a/chromium/ppapi/thunk/ppb_host_resolver_private_api.h b/chromium/ppapi/thunk/ppb_host_resolver_private_api.h
new file mode 100644
index 00000000000..446ab205788
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_host_resolver_private_api.h
@@ -0,0 +1,35 @@
+// 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_HOST_RESOLVER_PRIVATE_API_H_
+#define PPAPI_THUNK_PPB_HOST_RESOLVER_PRIVATE_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/private/ppb_host_resolver_private.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_HostResolver_Private_API {
+ public:
+ virtual ~PPB_HostResolver_Private_API() {}
+
+ virtual int32_t Resolve(const char* host,
+ uint16_t port,
+ const PP_HostResolver_Private_Hint* hint,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual PP_Var GetCanonicalName() = 0;
+ virtual uint32_t GetSize() = 0;
+ virtual bool GetNetAddress(uint32_t index,
+ PP_NetAddress_Private* addr) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_TCP_SOCKET_PRIVATE_API_H_
diff --git a/chromium/ppapi/thunk/ppb_host_resolver_private_thunk.cc b/chromium/ppapi/thunk/ppb_host_resolver_private_thunk.cc
new file mode 100644
index 00000000000..9da66564977
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_host_resolver_private_thunk.cc
@@ -0,0 +1,83 @@
+// 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.
+
+#include "ppapi/c/pp_var.h"
+#include "ppapi/c/private/ppb_host_resolver_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_host_resolver_private_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterResource<PPB_HostResolver_Private_API> EnterHostResolver;
+
+PP_Resource Create(PP_Instance instance) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateHostResolverPrivate(instance);
+}
+
+PP_Bool IsHostResolver(PP_Resource resource) {
+ EnterHostResolver enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Resolve(PP_Resource host_resolver,
+ const char* host,
+ uint16_t port,
+ const PP_HostResolver_Private_Hint* hint,
+ PP_CompletionCallback callback) {
+ EnterHostResolver enter(host_resolver, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Resolve(host, port, hint,
+ enter.callback()));
+}
+
+PP_Var GetCanonicalName(PP_Resource host_resolver) {
+ EnterHostResolver enter(host_resolver, true);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.object()->GetCanonicalName();
+}
+
+uint32_t GetSize(PP_Resource host_resolver) {
+ EnterHostResolver enter(host_resolver, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetSize();
+}
+
+PP_Bool GetNetAddress(PP_Resource host_resolver,
+ uint32_t index,
+ PP_NetAddress_Private* addr) {
+ EnterHostResolver enter(host_resolver, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return PP_FromBool(enter.object()->GetNetAddress(index, addr));
+}
+
+const PPB_HostResolver_Private g_ppb_host_resolver_thunk = {
+ &Create,
+ &IsHostResolver,
+ &Resolve,
+ &GetCanonicalName,
+ &GetSize,
+ &GetNetAddress
+};
+
+} // namespace
+
+const PPB_HostResolver_Private_0_1* GetPPB_HostResolver_Private_0_1_Thunk() {
+ return &g_ppb_host_resolver_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_host_resolver_thunk.cc b/chromium/ppapi/thunk/ppb_host_resolver_thunk.cc
new file mode 100644
index 00000000000..03b8d01be45
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_host_resolver_thunk.cc
@@ -0,0 +1,91 @@
+// Copyright 2013 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 ppb_host_resolver.idl modified Thu Jun 20 15:36:07 2013.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_host_resolver.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_host_resolver_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_HostResolver::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateHostResolver(instance);
+}
+
+PP_Bool IsHostResolver(PP_Resource resource) {
+ VLOG(4) << "PPB_HostResolver::IsHostResolver()";
+ EnterResource<PPB_HostResolver_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Resolve(PP_Resource host_resolver,
+ const char* host,
+ uint16_t port,
+ const struct PP_HostResolver_Hint* hint,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_HostResolver::Resolve()";
+ EnterResource<PPB_HostResolver_API> enter(host_resolver, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Resolve(host,
+ port,
+ hint,
+ enter.callback()));
+}
+
+struct PP_Var GetCanonicalName(PP_Resource host_resolver) {
+ VLOG(4) << "PPB_HostResolver::GetCanonicalName()";
+ EnterResource<PPB_HostResolver_API> enter(host_resolver, true);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.object()->GetCanonicalName();
+}
+
+uint32_t GetNetAddressCount(PP_Resource host_resolver) {
+ VLOG(4) << "PPB_HostResolver::GetNetAddressCount()";
+ EnterResource<PPB_HostResolver_API> enter(host_resolver, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetNetAddressCount();
+}
+
+PP_Resource GetNetAddress(PP_Resource host_resolver, uint32_t index) {
+ VLOG(4) << "PPB_HostResolver::GetNetAddress()";
+ EnterResource<PPB_HostResolver_API> enter(host_resolver, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetNetAddress(index);
+}
+
+const PPB_HostResolver_1_0 g_ppb_hostresolver_thunk_1_0 = {
+ &Create,
+ &IsHostResolver,
+ &Resolve,
+ &GetCanonicalName,
+ &GetNetAddressCount,
+ &GetNetAddress
+};
+
+} // namespace
+
+const PPB_HostResolver_1_0* GetPPB_HostResolver_1_0_Thunk() {
+ return &g_ppb_hostresolver_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_image_data_api.h b/chromium/ppapi/thunk/ppb_image_data_api.h
new file mode 100644
index 00000000000..f916ede3c5e
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_image_data_api.h
@@ -0,0 +1,57 @@
+// 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_IMAGE_DATA_API_H_
+#define PPAPI_THUNK_PPB_IMAGE_DATA_API_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/ppb_image_data.h"
+
+class SkCanvas;
+
+namespace ppapi {
+namespace thunk {
+
+class PPB_ImageData_API {
+ public:
+ virtual ~PPB_ImageData_API() {}
+
+ virtual PP_Bool Describe(PP_ImageDataDesc* desc) = 0;
+ virtual void* Map() = 0;
+ virtual void Unmap() = 0;
+
+ // Trusted inteface.
+ virtual int32_t GetSharedMemory(int* handle, uint32_t* byte_count) = 0;
+
+ // Get the platform-specific canvas that backs this ImageData, if there is
+ // one.
+ // The canvas will be NULL:
+ // * If the image is not mapped.
+ // * Within untrusted code (which does not have skia).
+ // * If the ImageData is not backed by a platform-specific image buffer.
+ // This will be the case for ImageDatas created for use in NaCl.
+ // For this last reason, you should prefer GetCanvas any time you don't need
+ // a platform-specific canvas (e.g., for use with platform-specific APIs).
+ // Anything that relies on having a PlatformCanvas will not work for ImageDat
+ // objects created from NaCl.
+ virtual SkCanvas* GetPlatformCanvas() = 0;
+
+ // Get the canvas that backs this ImageData, if there is one.
+ // The canvas will be NULL:
+ // * If the image is not mapped.
+ // * Within untrusted code (which does not have skia).
+ virtual SkCanvas* GetCanvas() = 0;
+
+ // Signal that this image is a good candidate for reuse. Call this from APIs
+ // that receive ImageData resources of a fixed size and where the plugin will
+ // release its reference to the ImageData. If the current implementation
+ // supports image data reuse (only supported out-of-process) then the
+ // ImageData will be marked and potentially cached for re-use.
+ virtual void SetIsCandidateForReuse() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_IMAGE_DATA_API_H_
diff --git a/chromium/ppapi/thunk/ppb_image_data_thunk.cc b/chromium/ppapi/thunk/ppb_image_data_thunk.cc
new file mode 100644
index 00000000000..51daa590457
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_image_data_thunk.cc
@@ -0,0 +1,97 @@
+// 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.
+
+// From ppb_image_data.idl modified Thu Jun 6 18:05:40 2013.
+
+#include <string.h>
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_image_data.h"
+#include "ppapi/shared_impl/ppb_image_data_shared.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_image_data_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_ImageDataFormat GetNativeImageDataFormat(void) {
+ VLOG(4) << "PPB_ImageData::GetNativeImageDataFormat()";
+ return PPB_ImageData_Shared::GetNativeImageDataFormat();
+}
+
+PP_Bool IsImageDataFormatSupported(PP_ImageDataFormat format) {
+ VLOG(4) << "PPB_ImageData::IsImageDataFormatSupported()";
+ return PPB_ImageData_Shared::IsImageDataFormatSupported(format);
+}
+
+PP_Resource Create(PP_Instance instance,
+ PP_ImageDataFormat format,
+ const struct PP_Size* size,
+ PP_Bool init_to_zero) {
+ VLOG(4) << "PPB_ImageData::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateImageData(instance,
+ format,
+ size,
+ init_to_zero);
+}
+
+PP_Bool IsImageData(PP_Resource image_data) {
+ VLOG(4) << "PPB_ImageData::IsImageData()";
+ EnterResource<PPB_ImageData_API> enter(image_data, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+PP_Bool Describe(PP_Resource image_data, struct PP_ImageDataDesc* desc) {
+ VLOG(4) << "PPB_ImageData::Describe()";
+ EnterResource<PPB_ImageData_API> enter(image_data, true);
+ if (enter.failed()) {
+ memset(desc, 0, sizeof(*desc));
+ return PP_FALSE;
+ }
+ return enter.object()->Describe(desc);
+}
+
+void* Map(PP_Resource image_data) {
+ VLOG(4) << "PPB_ImageData::Map()";
+ EnterResource<PPB_ImageData_API> enter(image_data, true);
+ if (enter.failed())
+ return NULL;
+ return enter.object()->Map();
+}
+
+void Unmap(PP_Resource image_data) {
+ VLOG(4) << "PPB_ImageData::Unmap()";
+ EnterResource<PPB_ImageData_API> enter(image_data, true);
+ if (enter.failed())
+ return;
+ enter.object()->Unmap();
+}
+
+const PPB_ImageData_1_0 g_ppb_imagedata_thunk_1_0 = {
+ &GetNativeImageDataFormat,
+ &IsImageDataFormatSupported,
+ &Create,
+ &IsImageData,
+ &Describe,
+ &Map,
+ &Unmap
+};
+
+} // namespace
+
+const PPB_ImageData_1_0* GetPPB_ImageData_1_0_Thunk() {
+ return &g_ppb_imagedata_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_input_event_api.h b/chromium/ppapi/thunk/ppb_input_event_api.h
new file mode 100644
index 00000000000..18bda799a89
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_input_event_api.h
@@ -0,0 +1,57 @@
+// 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_INPUT_EVENT_API_H_
+#define PPAPI_THUNK_PPB_INPUT_EVENT_API_H_
+
+#include "ppapi/c/dev/ppb_ime_input_event_dev.h"
+#include "ppapi/c/dev/ppb_keyboard_input_event_dev.h"
+#include "ppapi/c/ppb_input_event.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+struct InputEventData;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_InputEvent_API {
+ public:
+ virtual ~PPB_InputEvent_API() {}
+
+ // This function is not exposed through the C API, but returns the internal
+ // event data for easy proxying.
+ virtual const InputEventData& GetInputEventData() const = 0;
+
+ virtual PP_InputEvent_Type GetType() = 0;
+ virtual PP_TimeTicks GetTimeStamp() = 0;
+ virtual uint32_t GetModifiers() = 0;
+ virtual PP_InputEvent_MouseButton GetMouseButton() = 0;
+ virtual PP_Point GetMousePosition() = 0;
+ virtual int32_t GetMouseClickCount() = 0;
+ virtual PP_Point GetMouseMovement() = 0;
+ virtual PP_FloatPoint GetWheelDelta() = 0;
+ virtual PP_FloatPoint GetWheelTicks() = 0;
+ virtual PP_Bool GetWheelScrollByPage() = 0;
+ virtual uint32_t GetKeyCode() = 0;
+ virtual PP_Var GetCharacterText() = 0;
+ virtual PP_Bool SetUsbKeyCode(uint32_t) = 0;
+ virtual uint32_t GetUsbKeyCode() = 0;
+ virtual uint32_t GetIMESegmentNumber() = 0;
+ virtual uint32_t GetIMESegmentOffset(uint32_t index) = 0;
+ virtual int32_t GetIMETargetSegment() = 0;
+ virtual void GetIMESelection(uint32_t* start, uint32_t* end) = 0;
+ virtual void AddTouchPoint(PP_TouchListType list,
+ const PP_TouchPoint& point) = 0;
+ virtual uint32_t GetTouchCount(PP_TouchListType list) = 0;
+ virtual PP_TouchPoint GetTouchByIndex(PP_TouchListType list,
+ uint32_t index) = 0;
+ virtual PP_TouchPoint GetTouchById(PP_TouchListType list,
+ uint32_t id) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_INPUT_EVENT_API_H_
diff --git a/chromium/ppapi/thunk/ppb_input_event_thunk.cc b/chromium/ppapi/thunk/ppb_input_event_thunk.cc
new file mode 100644
index 00000000000..f54eefa8a02
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_input_event_thunk.cc
@@ -0,0 +1,540 @@
+// 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.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_input_event_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterResource<PPB_InputEvent_API> EnterInputEvent;
+
+// InputEvent ------------------------------------------------------------------
+
+int32_t RequestInputEvents(PP_Instance instance, uint32_t event_classes) {
+ VLOG(4) << "PPB_InputEvent::RequestInputEvents()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return enter.retval();
+ return enter.functions()->RequestInputEvents(instance, event_classes);
+}
+
+int32_t RequestFilteringInputEvents(PP_Instance instance,
+ uint32_t event_classes) {
+ VLOG(4) << "PPB_InputEvent::RequestFilteringInputEvents()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return enter.retval();
+ return enter.functions()->RequestFilteringInputEvents(instance,
+ event_classes);
+}
+
+void ClearInputEventRequest(PP_Instance instance,
+ uint32_t event_classes) {
+ VLOG(4) << "PPB_InputEvent::ClearInputEventRequest()";
+ EnterInstance enter(instance);
+ if (enter.succeeded())
+ enter.functions()->ClearInputEventRequest(instance, event_classes);
+}
+
+PP_Bool IsInputEvent(PP_Resource resource) {
+ VLOG(4) << "PPB_InputEvent::IsInputEvent()";
+ EnterInputEvent enter(resource, false);
+ return enter.succeeded() ? PP_TRUE : PP_FALSE;
+}
+
+PP_InputEvent_Type GetType(PP_Resource event) {
+ VLOG(4) << "PPB_InputEvent::GetType()";
+ EnterInputEvent enter(event, true);
+ if (enter.failed())
+ return PP_INPUTEVENT_TYPE_UNDEFINED;
+ return enter.object()->GetType();
+}
+
+PP_TimeTicks GetTimeStamp(PP_Resource event) {
+ VLOG(4) << "PPB_InputEvent::GetTimeStamp()";
+ EnterInputEvent enter(event, true);
+ if (enter.failed())
+ return 0.0;
+ return enter.object()->GetTimeStamp();
+}
+
+uint32_t GetModifiers(PP_Resource event) {
+ VLOG(4) << "PPB_InputEvent::GetModifiers()";
+ EnterInputEvent enter(event, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetModifiers();
+}
+
+const PPB_InputEvent g_ppb_input_event_thunk = {
+ &RequestInputEvents,
+ &RequestFilteringInputEvents,
+ &ClearInputEventRequest,
+ &IsInputEvent,
+ &GetType,
+ &GetTimeStamp,
+ &GetModifiers
+};
+
+// Mouse -----------------------------------------------------------------------
+
+PP_Resource CreateMouseInputEvent1_0(PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ PP_InputEvent_MouseButton mouse_button,
+ const PP_Point* mouse_position,
+ int32_t click_count) {
+ VLOG(4) << "PPB_MouseInputEvent::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+
+ PP_Point mouse_movement = PP_MakePoint(0, 0);
+ return enter.functions()->CreateMouseInputEvent(instance, type, time_stamp,
+ modifiers, mouse_button,
+ mouse_position, click_count,
+ &mouse_movement);
+}
+
+PP_Resource CreateMouseInputEvent1_1(PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ PP_InputEvent_MouseButton mouse_button,
+ const PP_Point* mouse_position,
+ int32_t click_count,
+ const PP_Point* mouse_movement) {
+ VLOG(4) << "PPB_MouseInputEvent::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateMouseInputEvent(instance, type, time_stamp,
+ modifiers, mouse_button,
+ mouse_position, click_count,
+ mouse_movement);
+}
+
+PP_Bool IsMouseInputEvent(PP_Resource resource) {
+ VLOG(4) << "PPB_MouseInputEvent::IsMouseInputEvent()";
+ if (!IsInputEvent(resource))
+ return PP_FALSE; // Prevent warning log in GetType.
+ PP_InputEvent_Type type = GetType(resource);
+ return PP_FromBool(type == PP_INPUTEVENT_TYPE_MOUSEDOWN ||
+ type == PP_INPUTEVENT_TYPE_MOUSEUP ||
+ type == PP_INPUTEVENT_TYPE_MOUSEMOVE ||
+ type == PP_INPUTEVENT_TYPE_MOUSEENTER ||
+ type == PP_INPUTEVENT_TYPE_MOUSELEAVE ||
+ type == PP_INPUTEVENT_TYPE_CONTEXTMENU);
+}
+
+PP_InputEvent_MouseButton GetMouseButton(PP_Resource mouse_event) {
+ VLOG(4) << "PPB_MouseInputEvent::GetButton()";
+ EnterInputEvent enter(mouse_event, true);
+ if (enter.failed())
+ return PP_INPUTEVENT_MOUSEBUTTON_NONE;
+ return enter.object()->GetMouseButton();
+}
+
+PP_Point GetMousePosition(PP_Resource mouse_event) {
+ VLOG(4) << "PPB_MouseInputEvent::GetPosition()";
+ EnterInputEvent enter(mouse_event, true);
+ if (enter.failed())
+ return PP_MakePoint(0, 0);
+ return enter.object()->GetMousePosition();
+}
+
+int32_t GetMouseClickCount(PP_Resource mouse_event) {
+ VLOG(4) << "PPB_MouseInputEvent::GetClickCount()";
+ EnterInputEvent enter(mouse_event, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetMouseClickCount();
+}
+
+PP_Point GetMouseMovement(PP_Resource mouse_event) {
+ VLOG(4) << "PPB_MouseInputEvent::GetMovement()";
+ EnterInputEvent enter(mouse_event, true);
+ if (enter.failed())
+ return PP_MakePoint(0, 0);
+ return enter.object()->GetMouseMovement();
+}
+
+const PPB_MouseInputEvent_1_0 g_ppb_mouse_input_event_1_0_thunk = {
+ &CreateMouseInputEvent1_0,
+ &IsMouseInputEvent,
+ &GetMouseButton,
+ &GetMousePosition,
+ &GetMouseClickCount
+};
+
+const PPB_MouseInputEvent g_ppb_mouse_input_event_1_1_thunk = {
+ &CreateMouseInputEvent1_1,
+ &IsMouseInputEvent,
+ &GetMouseButton,
+ &GetMousePosition,
+ &GetMouseClickCount,
+ &GetMouseMovement
+};
+
+// Wheel -----------------------------------------------------------------------
+
+PP_Resource CreateWheelInputEvent(PP_Instance instance,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ const PP_FloatPoint* wheel_delta,
+ const PP_FloatPoint* wheel_ticks,
+ PP_Bool scroll_by_page) {
+ VLOG(4) << "PPB_WheelInputEvent::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateWheelInputEvent(instance, time_stamp,
+ modifiers, wheel_delta,
+ wheel_ticks, scroll_by_page);
+}
+
+PP_Bool IsWheelInputEvent(PP_Resource resource) {
+ VLOG(4) << "PPB_WheelInputEvent::IsWheelInputEvent()";
+ if (!IsInputEvent(resource))
+ return PP_FALSE; // Prevent warning log in GetType.
+ PP_InputEvent_Type type = GetType(resource);
+ return PP_FromBool(type == PP_INPUTEVENT_TYPE_WHEEL);
+}
+
+PP_FloatPoint GetWheelDelta(PP_Resource wheel_event) {
+ VLOG(4) << "PPB_WheelInputEvent::GetDelta()";
+ EnterInputEvent enter(wheel_event, true);
+ if (enter.failed())
+ return PP_MakeFloatPoint(0.0f, 0.0f);
+ return enter.object()->GetWheelDelta();
+}
+
+PP_FloatPoint GetWheelTicks(PP_Resource wheel_event) {
+ VLOG(4) << "PPB_WheelInputEvent::GetTicks()";
+ EnterInputEvent enter(wheel_event, true);
+ if (enter.failed())
+ return PP_MakeFloatPoint(0.0f, 0.0f);
+ return enter.object()->GetWheelTicks();
+}
+
+PP_Bool GetWheelScrollByPage(PP_Resource wheel_event) {
+ VLOG(4) << "PPB_WheelInputEvent::GetScrollByPage()";
+ EnterInputEvent enter(wheel_event, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->GetWheelScrollByPage();
+}
+
+const PPB_WheelInputEvent g_ppb_wheel_input_event_thunk = {
+ &CreateWheelInputEvent,
+ &IsWheelInputEvent,
+ &GetWheelDelta,
+ &GetWheelTicks,
+ &GetWheelScrollByPage
+};
+
+// Keyboard --------------------------------------------------------------------
+
+PP_Resource CreateKeyboardInputEvent(PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ uint32_t key_code,
+ struct PP_Var character_text) {
+ VLOG(4) << "PPB_KeyboardInputEvent::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateKeyboardInputEvent(instance, type, time_stamp,
+ modifiers, key_code,
+ character_text);
+}
+
+PP_Bool IsKeyboardInputEvent(PP_Resource resource) {
+ VLOG(4) << "PPB_KeyboardInputEvent::IsKeyboardInputEvent()";
+ if (!IsInputEvent(resource))
+ return PP_FALSE; // Prevent warning log in GetType.
+ PP_InputEvent_Type type = GetType(resource);
+ return PP_FromBool(type == PP_INPUTEVENT_TYPE_KEYDOWN ||
+ type == PP_INPUTEVENT_TYPE_KEYUP ||
+ type == PP_INPUTEVENT_TYPE_RAWKEYDOWN ||
+ type == PP_INPUTEVENT_TYPE_CHAR);
+}
+
+uint32_t GetKeyCode(PP_Resource key_event) {
+ VLOG(4) << "PPB_KeyboardInputEvent::GetKeyCode()";
+ EnterInputEvent enter(key_event, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetKeyCode();
+}
+
+PP_Var GetCharacterText(PP_Resource character_event) {
+ VLOG(4) << "PPB_KeyboardInputEvent::GetCharacterText()";
+ EnterInputEvent enter(character_event, true);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.object()->GetCharacterText();
+}
+
+const PPB_KeyboardInputEvent g_ppb_keyboard_input_event_thunk = {
+ &CreateKeyboardInputEvent,
+ &IsKeyboardInputEvent,
+ &GetKeyCode,
+ &GetCharacterText
+};
+
+// _Dev interface.
+
+PP_Bool SetUsbKeyCode(PP_Resource key_event, uint32_t usb_key_code) {
+ VLOG(4) << "PPB_KeyboardInputEvent_Dev::SetUsbKeyCode()";
+ EnterInputEvent enter(key_event, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->SetUsbKeyCode(usb_key_code);
+}
+
+uint32_t GetUsbKeyCode(PP_Resource key_event) {
+ VLOG(4) << "PPB_KeyboardInputEvent_Dev::GetUsbKeyCode()";
+ EnterInputEvent enter(key_event, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetUsbKeyCode();
+}
+
+const PPB_KeyboardInputEvent_Dev g_ppb_keyboard_input_event_dev_thunk = {
+ &SetUsbKeyCode,
+ &GetUsbKeyCode,
+};
+
+// Composition -----------------------------------------------------------------
+
+PP_Resource CreateIMEInputEvent(PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ PP_Var text,
+ uint32_t segment_number,
+ const uint32_t segment_offsets[],
+ int32_t target_segment,
+ uint32_t selection_start,
+ uint32_t selection_end) {
+ VLOG(4) << "PPB_IMEInputEvent_Dev::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateIMEInputEvent(instance, type, time_stamp,
+ text, segment_number,
+ segment_offsets,
+ target_segment,
+ selection_start,
+ selection_end);
+}
+
+PP_Bool IsIMEInputEvent(PP_Resource resource) {
+ VLOG(4) << "PPB_IMEInputEvent_Dev::IsIMEInputEvent()";
+ if (!IsInputEvent(resource))
+ return PP_FALSE; // Prevent warning log in GetType.
+ PP_InputEvent_Type type = GetType(resource);
+ return PP_FromBool(type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_START ||
+ type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE ||
+ type == PP_INPUTEVENT_TYPE_IME_COMPOSITION_END ||
+ type == PP_INPUTEVENT_TYPE_IME_TEXT);
+}
+
+PP_Var GetIMEText(PP_Resource ime_event) {
+ VLOG(4) << "PPB_IMEInputEvent_Dev::GetText()";
+ return GetCharacterText(ime_event);
+}
+
+uint32_t GetIMESegmentNumber(PP_Resource ime_event) {
+ VLOG(4) << "PPB_IMEInputEvent_Dev::GetSegmentNumber()";
+ EnterInputEvent enter(ime_event, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetIMESegmentNumber();
+}
+
+uint32_t GetIMESegmentOffset(PP_Resource ime_event, uint32_t index) {
+ VLOG(4) << "PPB_IMEInputEvent_Dev::GetSegmentOffset()";
+ EnterInputEvent enter(ime_event, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetIMESegmentOffset(index);
+}
+
+int32_t GetIMETargetSegment(PP_Resource ime_event) {
+ VLOG(4) << "PPB_IMEInputEvent_Dev::GetTargetSegment()";
+ EnterInputEvent enter(ime_event, true);
+ if (enter.failed())
+ return -1;
+ return enter.object()->GetIMETargetSegment();
+}
+
+void GetIMESelection(PP_Resource ime_event, uint32_t* start, uint32_t* end) {
+ VLOG(4) << "PPB_IMEInputEvent_Dev::GetSelection()";
+ EnterInputEvent enter(ime_event, true);
+ if (enter.failed()) {
+ if (start)
+ *start = 0;
+ if (end)
+ *end = 0;
+ return;
+ }
+ enter.object()->GetIMESelection(start, end);
+}
+
+const PPB_IMEInputEvent_Dev_0_1 g_ppb_ime_input_event_0_1_thunk = {
+ &IsIMEInputEvent,
+ &GetIMEText,
+ &GetIMESegmentNumber,
+ &GetIMESegmentOffset,
+ &GetIMETargetSegment,
+ &GetIMESelection
+};
+
+const PPB_IMEInputEvent_Dev_0_2 g_ppb_ime_input_event_0_2_thunk = {
+ &CreateIMEInputEvent,
+ &IsIMEInputEvent,
+ &GetIMEText,
+ &GetIMESegmentNumber,
+ &GetIMESegmentOffset,
+ &GetIMETargetSegment,
+ &GetIMESelection
+};
+
+const PPB_IMEInputEvent_1_0 g_ppb_ime_input_event_1_0_thunk = {
+ &CreateIMEInputEvent,
+ &IsIMEInputEvent,
+ &GetIMEText,
+ &GetIMESegmentNumber,
+ &GetIMESegmentOffset,
+ &GetIMETargetSegment,
+ &GetIMESelection
+};
+
+// Touch -----------------------------------------------------------------------
+
+PP_Resource CreateTouchInputEvent(PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers) {
+ VLOG(4) << "PPB_TouchInputEvent::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateTouchInputEvent(instance, type, time_stamp,
+ modifiers);
+}
+
+void AddTouchPoint(PP_Resource touch_event,
+ PP_TouchListType list,
+ const PP_TouchPoint* point) {
+ VLOG(4) << "PPB_TouchInputEvent::AddTouchPoint()";
+ EnterInputEvent enter(touch_event, true);
+ if (enter.failed())
+ return;
+ return enter.object()->AddTouchPoint(list, *point);
+}
+
+PP_Bool IsTouchInputEvent(PP_Resource resource) {
+ VLOG(4) << "PPB_TouchInputEvent::IsTouchInputEvent()";
+ if (!IsInputEvent(resource))
+ return PP_FALSE; // Prevent warning log in GetType.
+ PP_InputEvent_Type type = GetType(resource);
+ return PP_FromBool(type == PP_INPUTEVENT_TYPE_TOUCHSTART ||
+ type == PP_INPUTEVENT_TYPE_TOUCHMOVE ||
+ type == PP_INPUTEVENT_TYPE_TOUCHEND ||
+ type == PP_INPUTEVENT_TYPE_TOUCHCANCEL);
+}
+
+uint32_t GetTouchCount(PP_Resource touch_event, PP_TouchListType list) {
+ VLOG(4) << "PPB_TouchInputEvent::GetTouchCount()";
+ EnterInputEvent enter(touch_event, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetTouchCount(list);
+}
+
+struct PP_TouchPoint GetTouchByIndex(PP_Resource touch_event,
+ PP_TouchListType list,
+ uint32_t index) {
+ VLOG(4) << "PPB_TouchInputEvent::GetTouchByIndex()";
+ EnterInputEvent enter(touch_event, true);
+ if (enter.failed())
+ return PP_MakeTouchPoint();
+ return enter.object()->GetTouchByIndex(list, index);
+}
+
+struct PP_TouchPoint GetTouchById(PP_Resource touch_event,
+ PP_TouchListType list,
+ uint32_t id) {
+ VLOG(4) << "PPB_TouchInputEvent::GetTouchById()";
+ EnterInputEvent enter(touch_event, true);
+ if (enter.failed())
+ return PP_MakeTouchPoint();
+ return enter.object()->GetTouchById(list, id);
+}
+
+const PPB_TouchInputEvent_1_0 g_ppb_touch_input_event_thunk = {
+ &CreateTouchInputEvent,
+ &AddTouchPoint,
+ &IsTouchInputEvent,
+ &GetTouchCount,
+ &GetTouchByIndex,
+ &GetTouchById
+};
+
+} // namespace
+
+const PPB_InputEvent_1_0* GetPPB_InputEvent_1_0_Thunk() {
+ return &g_ppb_input_event_thunk;
+}
+
+const PPB_MouseInputEvent_1_0* GetPPB_MouseInputEvent_1_0_Thunk() {
+ return &g_ppb_mouse_input_event_1_0_thunk;
+}
+
+const PPB_MouseInputEvent_1_1* GetPPB_MouseInputEvent_1_1_Thunk() {
+ return &g_ppb_mouse_input_event_1_1_thunk;
+}
+
+const PPB_KeyboardInputEvent_1_0* GetPPB_KeyboardInputEvent_1_0_Thunk() {
+ return &g_ppb_keyboard_input_event_thunk;
+}
+
+const PPB_KeyboardInputEvent_Dev_0_1*
+ GetPPB_KeyboardInputEvent_Dev_0_1_Thunk() {
+ return &g_ppb_keyboard_input_event_dev_thunk;
+}
+
+const PPB_WheelInputEvent_1_0* GetPPB_WheelInputEvent_1_0_Thunk() {
+ return &g_ppb_wheel_input_event_thunk;
+}
+
+const PPB_IMEInputEvent_Dev_0_1* GetPPB_IMEInputEvent_Dev_0_1_Thunk() {
+ return &g_ppb_ime_input_event_0_1_thunk;
+}
+
+const PPB_IMEInputEvent_Dev_0_2* GetPPB_IMEInputEvent_Dev_0_2_Thunk() {
+ return &g_ppb_ime_input_event_0_2_thunk;
+}
+
+const PPB_IMEInputEvent_1_0* GetPPB_IMEInputEvent_1_0_Thunk() {
+ return &g_ppb_ime_input_event_1_0_thunk;
+}
+
+const PPB_TouchInputEvent_1_0* GetPPB_TouchInputEvent_1_0_Thunk() {
+ return &g_ppb_touch_input_event_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_instance_api.h b/chromium/ppapi/thunk/ppb_instance_api.h
new file mode 100644
index 00000000000..c1d024e0d95
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_instance_api.h
@@ -0,0 +1,200 @@
+// 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_INSTANCE_API_H_
+#define PPAPI_THUNK_INSTANCE_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "ppapi/c/dev/ppb_url_util_dev.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_size.h"
+#include "ppapi/c/ppb_audio_config.h"
+#include "ppapi/c/ppb_console.h"
+#include "ppapi/c/ppb_gamepad.h"
+#include "ppapi/c/ppb_instance.h"
+#include "ppapi/c/ppb_mouse_cursor.h"
+#include "ppapi/c/ppb_text_input_controller.h"
+#include "ppapi/c/private/pp_content_decryptor.h"
+#include "ppapi/c/private/ppb_instance_private.h"
+#include "ppapi/shared_impl/api_id.h"
+#include "ppapi/shared_impl/resource.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
+
+// Windows headers interfere with this file.
+#ifdef PostMessage
+#undef PostMessage
+#endif
+
+struct PP_DecryptedBlockInfo;
+struct PP_DecryptedFrameInfo;
+
+namespace ppapi {
+
+class Resource;
+class TrackedCallback;
+struct ViewData;
+
+namespace thunk {
+
+class PPB_Flash_API;
+
+class PPB_Instance_API {
+ public:
+ virtual ~PPB_Instance_API() {}
+
+ virtual PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) = 0;
+ virtual PP_Bool IsFullFrame(PP_Instance instance) = 0;
+
+ // Unexposed PPAPI functions for proxying.
+ // Returns the internal view data struct.
+ virtual const ViewData* GetViewData(PP_Instance instance) = 0;
+ // Returns the flash fullscreen status.
+ virtual PP_Bool FlashIsFullscreen(PP_Instance instance) = 0;
+
+ // InstancePrivate.
+ virtual PP_Var GetWindowObject(PP_Instance instance) = 0;
+ virtual PP_Var GetOwnerElementObject(PP_Instance instance) = 0;
+ virtual PP_Var ExecuteScript(PP_Instance instance,
+ PP_Var script,
+ PP_Var* exception) = 0;
+
+ // Audio.
+ virtual uint32_t GetAudioHardwareOutputSampleRate(PP_Instance instance) = 0;
+ virtual uint32_t GetAudioHardwareOutputBufferSize(PP_Instance instance) = 0;
+
+ // CharSet.
+ virtual PP_Var GetDefaultCharSet(PP_Instance instance) = 0;
+
+ // Console.
+ virtual void Log(PP_Instance instance,
+ PP_LogLevel log_level,
+ PP_Var value) = 0;
+ virtual void LogWithSource(PP_Instance instance,
+ PP_LogLevel log_level,
+ PP_Var source,
+ PP_Var value) = 0;
+
+ // Find.
+ virtual void NumberOfFindResultsChanged(PP_Instance instance,
+ int32_t total,
+ PP_Bool final_result) = 0;
+ virtual void SelectedFindResultChanged(PP_Instance instance,
+ int32_t index) = 0;
+
+ // Fullscreen.
+ virtual PP_Bool IsFullscreen(PP_Instance instance) = 0;
+ virtual PP_Bool SetFullscreen(PP_Instance instance,
+ PP_Bool fullscreen) = 0;
+ virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) = 0;
+
+ // This is an implementation-only function which grabs an instance of a
+ // "singleton resource". These are used to implement instance interfaces
+ // (functions which are associated with the instance itself as opposed to a
+ // resource).
+ virtual Resource* GetSingletonResource(
+ PP_Instance instance, SingletonResourceID id) = 0;
+
+ // InputEvent.
+ virtual int32_t RequestInputEvents(PP_Instance instance,
+ uint32_t event_classes) = 0;
+ virtual int32_t RequestFilteringInputEvents(PP_Instance instance,
+ uint32_t event_classes) = 0;
+ virtual void ClearInputEventRequest(PP_Instance instance,
+ uint32_t event_classes) = 0;
+
+ // Messaging.
+ virtual void PostMessage(PP_Instance instance, PP_Var message) = 0;
+
+ // Mouse cursor.
+ virtual PP_Bool SetCursor(PP_Instance instance,
+ PP_MouseCursor_Type type,
+ PP_Resource image,
+ const PP_Point* hot_spot) = 0;
+
+ // MouseLock.
+ virtual int32_t LockMouse(PP_Instance instance,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual void UnlockMouse(PP_Instance instance) = 0;
+
+ // TextInput.
+ virtual void SetTextInputType(PP_Instance instance,
+ PP_TextInput_Type type) = 0;
+ virtual void UpdateCaretPosition(PP_Instance instance,
+ const PP_Rect& caret,
+ const PP_Rect& bounding_box) = 0;
+ virtual void CancelCompositionText(PP_Instance instance) = 0;
+ virtual void SelectionChanged(PP_Instance instance) = 0;
+ virtual void UpdateSurroundingText(PP_Instance instance,
+ const char* text,
+ uint32_t caret,
+ uint32_t anchor) = 0;
+
+ // Zoom.
+ virtual void ZoomChanged(PP_Instance instance, double factor) = 0;
+ virtual void ZoomLimitsChanged(PP_Instance instance,
+ double minimum_factor,
+ double maximum_factor) = 0;
+ // Testing and URLUtil.
+ virtual PP_Var GetDocumentURL(PP_Instance instance,
+ PP_URLComponents_Dev* components) = 0;
+#if !defined(OS_NACL)
+ // Content Decryptor.
+ virtual void NeedKey(PP_Instance instance,
+ PP_Var key_system,
+ PP_Var session_id,
+ PP_Var init_data) = 0;
+ virtual void KeyAdded(PP_Instance instance,
+ PP_Var key_system,
+ PP_Var session_id) = 0;
+ virtual void KeyMessage(PP_Instance instance,
+ PP_Var key_system,
+ PP_Var session_id,
+ PP_Var message,
+ PP_Var default_url) = 0;
+ virtual void KeyError(PP_Instance instance,
+ PP_Var key_system,
+ PP_Var session_id,
+ int32_t media_error,
+ int32_t system_error) = 0;
+ virtual void DeliverBlock(PP_Instance instance,
+ PP_Resource decrypted_block,
+ const PP_DecryptedBlockInfo* block_info) = 0;
+ virtual void DecoderInitializeDone(PP_Instance instance,
+ PP_DecryptorStreamType decoder_type,
+ uint32_t request_id,
+ PP_Bool success) = 0;
+ virtual void DecoderDeinitializeDone(PP_Instance instance,
+ PP_DecryptorStreamType decoder_type,
+ uint32_t request_id) = 0;
+ virtual void DecoderResetDone(PP_Instance instance,
+ PP_DecryptorStreamType decoder_type,
+ uint32_t request_id) = 0;
+ virtual void DeliverFrame(PP_Instance instance,
+ PP_Resource decrypted_frame,
+ const PP_DecryptedFrameInfo* frame_info) = 0;
+ virtual void DeliverSamples(PP_Instance instance,
+ PP_Resource audio_frames,
+ const PP_DecryptedBlockInfo* block_info) = 0;
+
+ // URLUtil.
+ virtual PP_Var ResolveRelativeToDocument(
+ PP_Instance instance,
+ PP_Var relative,
+ PP_URLComponents_Dev* components) = 0;
+ virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) = 0;
+ virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance,
+ PP_Instance target) = 0;
+ virtual PP_Var GetPluginInstanceURL(PP_Instance instance,
+ PP_URLComponents_Dev* components) = 0;
+#endif // !defined(OS_NACL)
+
+ static const ApiID kApiID = API_ID_PPB_INSTANCE;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_INSTANCE_API_H_
diff --git a/chromium/ppapi/thunk/ppb_instance_private_thunk.cc b/chromium/ppapi/thunk/ppb_instance_private_thunk.cc
new file mode 100644
index 00000000000..0d9c10bcf71
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_instance_private_thunk.cc
@@ -0,0 +1,59 @@
+// 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.
+
+// From private/ppb_instance_private.idl modified Thu Feb 28 11:58:17 2013.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_instance_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+struct PP_Var GetWindowObject(PP_Instance instance) {
+ VLOG(4) << "PPB_Instance_Private::GetWindowObject()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.functions()->GetWindowObject(instance);
+}
+
+struct PP_Var GetOwnerElementObject(PP_Instance instance) {
+ VLOG(4) << "PPB_Instance_Private::GetOwnerElementObject()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.functions()->GetOwnerElementObject(instance);
+}
+
+struct PP_Var ExecuteScript(PP_Instance instance,
+ struct PP_Var script,
+ struct PP_Var* exception) {
+ VLOG(4) << "PPB_Instance_Private::ExecuteScript()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.functions()->ExecuteScript(instance, script, exception);
+}
+
+const PPB_Instance_Private_0_1 g_ppb_instance_private_thunk_0_1 = {
+ &GetWindowObject,
+ &GetOwnerElementObject,
+ &ExecuteScript
+};
+
+} // namespace
+
+const PPB_Instance_Private_0_1* GetPPB_Instance_Private_0_1_Thunk() {
+ return &g_ppb_instance_private_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_instance_thunk.cc b/chromium/ppapi/thunk/ppb_instance_thunk.cc
new file mode 100644
index 00000000000..f55c7ee38bf
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_instance_thunk.cc
@@ -0,0 +1,48 @@
+// 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.
+
+// From ppb_instance.idl modified Thu Feb 28 11:58:17 2013.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_instance.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) {
+ VLOG(4) << "PPB_Instance::BindGraphics()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->BindGraphics(instance, device);
+}
+
+PP_Bool IsFullFrame(PP_Instance instance) {
+ VLOG(4) << "PPB_Instance::IsFullFrame()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->IsFullFrame(instance);
+}
+
+const PPB_Instance_1_0 g_ppb_instance_thunk_1_0 = {
+ &BindGraphics,
+ &IsFullFrame
+};
+
+} // namespace
+
+const PPB_Instance_1_0* GetPPB_Instance_1_0_Thunk() {
+ return &g_ppb_instance_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_message_loop_api.h b/chromium/ppapi/thunk/ppb_message_loop_api.h
new file mode 100644
index 00000000000..efc18627feb
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_message_loop_api.h
@@ -0,0 +1,38 @@
+// 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_MESSAGE_LOOP_API_H_
+#define PPAPI_THUNK_PPB_MESSAGE_LOOP_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_MessageLoop_API {
+ public:
+ virtual ~PPB_MessageLoop_API() {}
+
+ virtual int32_t AttachToCurrentThread() = 0;
+ virtual int32_t Run() = 0;
+ // Note: Most interfaces should use scoped_refptr<TrackedCallback>, in order
+ // to track callbacks and support things like blocking or optional callbacks.
+ // In this case, the callback is really just a way to pass a function pointer,
+ // and those options don't make sense.
+ virtual int32_t PostWork(PP_CompletionCallback callback,
+ int64_t delay_ms) = 0;
+ virtual int32_t PostQuit(PP_Bool should_destroy) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_MESSAGE_LOOP_API_H_
diff --git a/chromium/ppapi/thunk/ppb_messaging_thunk.cc b/chromium/ppapi/thunk/ppb_messaging_thunk.cc
new file mode 100644
index 00000000000..d485b3d8643
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_messaging_thunk.cc
@@ -0,0 +1,39 @@
+// 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.
+
+// From ppb_messaging.idl modified Tue Apr 16 11:25:44 2013.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_messaging.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void PostMessage(PP_Instance instance, struct PP_Var message) {
+ VLOG(4) << "PPB_Messaging::PostMessage()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->PostMessage(instance, message);
+}
+
+const PPB_Messaging_1_0 g_ppb_messaging_thunk_1_0 = {
+ &PostMessage
+};
+
+} // namespace
+
+const PPB_Messaging_1_0* GetPPB_Messaging_1_0_Thunk() {
+ return &g_ppb_messaging_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_mouse_cursor_thunk.cc b/chromium/ppapi/thunk/ppb_mouse_cursor_thunk.cc
new file mode 100644
index 00000000000..beb826302ea
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_mouse_cursor_thunk.cc
@@ -0,0 +1,42 @@
+// 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.
+
+// From ppb_mouse_cursor.idl modified Mon Apr 1 08:24:03 2013.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_mouse_cursor.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Bool SetCursor(PP_Instance instance,
+ enum PP_MouseCursor_Type type,
+ PP_Resource image,
+ const struct PP_Point* hot_spot) {
+ VLOG(4) << "PPB_MouseCursor::SetCursor()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->SetCursor(instance, type, image, hot_spot);
+}
+
+const PPB_MouseCursor_1_0 g_ppb_mousecursor_thunk_1_0 = {
+ &SetCursor
+};
+
+} // namespace
+
+const PPB_MouseCursor_1_0* GetPPB_MouseCursor_1_0_Thunk() {
+ return &g_ppb_mousecursor_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_mouse_lock_thunk.cc b/chromium/ppapi/thunk/ppb_mouse_lock_thunk.cc
new file mode 100644
index 00000000000..d9bfa2d635e
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_mouse_lock_thunk.cc
@@ -0,0 +1,50 @@
+// 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.
+
+// From ppb_mouse_lock.idl modified Mon May 6 13:58:10 2013.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_mouse_lock.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+int32_t LockMouse(PP_Instance instance, struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_MouseLock::LockMouse()";
+ EnterInstance enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.functions()->LockMouse(instance,
+ enter.callback()));
+}
+
+void UnlockMouse(PP_Instance instance) {
+ VLOG(4) << "PPB_MouseLock::UnlockMouse()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->UnlockMouse(instance);
+}
+
+const PPB_MouseLock_1_0 g_ppb_mouselock_thunk_1_0 = {
+ &LockMouse,
+ &UnlockMouse
+};
+
+} // namespace
+
+const PPB_MouseLock_1_0* GetPPB_MouseLock_1_0_Thunk() {
+ return &g_ppb_mouselock_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_net_address_api.h b/chromium/ppapi/thunk/ppb_net_address_api.h
new file mode 100644
index 00000000000..7ae9d7f8787
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_net_address_api.h
@@ -0,0 +1,31 @@
+// Copyright 2013 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_NET_ADDRESS_API_H_
+#define PPAPI_THUNK_PPB_NET_ADDRESS_API_H_
+
+#include "ppapi/c/ppb_net_address.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+struct PP_NetAddress_Private;
+
+namespace ppapi {
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_NetAddress_API {
+ public:
+ virtual ~PPB_NetAddress_API() {}
+
+ virtual PP_NetAddress_Family GetFamily() = 0;
+ virtual PP_Var DescribeAsString(PP_Bool include_port) = 0;
+ virtual PP_Bool DescribeAsIPv4Address(PP_NetAddress_IPv4* ipv4_addr) = 0;
+ virtual PP_Bool DescribeAsIPv6Address(PP_NetAddress_IPv6* ipv6_addr) = 0;
+
+ virtual const PP_NetAddress_Private& GetNetAddressPrivate() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_NET_ADDRESS_API_H_
diff --git a/chromium/ppapi/thunk/ppb_net_address_thunk.cc b/chromium/ppapi/thunk/ppb_net_address_thunk.cc
new file mode 100644
index 00000000000..f8916fe9716
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_net_address_thunk.cc
@@ -0,0 +1,98 @@
+// Copyright 2013 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.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_net_address.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_net_address_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource CreateFromIPv4Address(
+ PP_Instance instance,
+ const struct PP_NetAddress_IPv4* ipv4_addr) {
+ VLOG(4) << "PPB_NetAddress::CreateFromIPv4Address()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateNetAddressFromIPv4Address(instance,
+ ipv4_addr);
+}
+
+PP_Resource CreateFromIPv6Address(
+ PP_Instance instance,
+ const struct PP_NetAddress_IPv6* ipv6_addr) {
+ VLOG(4) << "PPB_NetAddress::CreateFromIPv6Address()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateNetAddressFromIPv6Address(instance,
+ ipv6_addr);
+}
+
+PP_Bool IsNetAddress(PP_Resource resource) {
+ VLOG(4) << "PPB_NetAddress::IsNetAddress()";
+ EnterResource<PPB_NetAddress_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+PP_NetAddress_Family GetFamily(PP_Resource addr) {
+ VLOG(4) << "PPB_NetAddress::GetFamily()";
+ EnterResource<PPB_NetAddress_API> enter(addr, true);
+ if (enter.failed())
+ return PP_NETADDRESS_FAMILY_UNSPECIFIED;
+ return enter.object()->GetFamily();
+}
+
+struct PP_Var DescribeAsString(PP_Resource addr, PP_Bool include_port) {
+ VLOG(4) << "PPB_NetAddress::DescribeAsString()";
+ EnterResource<PPB_NetAddress_API> enter(addr, true);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.object()->DescribeAsString(include_port);
+}
+
+PP_Bool DescribeAsIPv4Address(PP_Resource addr,
+ struct PP_NetAddress_IPv4* ipv4_addr) {
+ VLOG(4) << "PPB_NetAddress::DescribeAsIPv4Address()";
+ EnterResource<PPB_NetAddress_API> enter(addr, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->DescribeAsIPv4Address(ipv4_addr);
+}
+
+PP_Bool DescribeAsIPv6Address(PP_Resource addr,
+ struct PP_NetAddress_IPv6* ipv6_addr) {
+ VLOG(4) << "PPB_NetAddress::DescribeAsIPv6Address()";
+ EnterResource<PPB_NetAddress_API> enter(addr, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->DescribeAsIPv6Address(ipv6_addr);
+}
+
+const PPB_NetAddress_1_0 g_ppb_netaddress_thunk_1_0 = {
+ &CreateFromIPv4Address,
+ &CreateFromIPv6Address,
+ &IsNetAddress,
+ &GetFamily,
+ &DescribeAsString,
+ &DescribeAsIPv4Address,
+ &DescribeAsIPv6Address
+};
+
+} // namespace
+
+const PPB_NetAddress_1_0* GetPPB_NetAddress_1_0_Thunk() {
+ return &g_ppb_netaddress_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_network_list_api.h b/chromium/ppapi/thunk/ppb_network_list_api.h
new file mode 100644
index 00000000000..bbadded6f75
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_network_list_api.h
@@ -0,0 +1,43 @@
+// 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_NETWORK_LIST_API_H_
+#define PPAPI_THUNK_PPB_NETWORK_LIST_API_H_
+
+#include <vector>
+
+#include "ppapi/c/private/ppb_network_list_private.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+struct NetworkInfo;
+typedef std::vector<NetworkInfo> NetworkList;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_NetworkList_API {
+ public:
+ virtual ~PPB_NetworkList_API() {}
+
+ // This function is not exposed through the C API, but returns the
+ // internal data for easy proxying.
+ virtual const NetworkList& GetNetworkListData() const = 0;
+
+ // Private API
+ virtual uint32_t GetCount() = 0;
+ virtual PP_Var GetName(uint32_t index) = 0;
+ virtual PP_NetworkListType_Private GetType(uint32_t index) = 0;
+ virtual PP_NetworkListState_Private GetState(uint32_t index) = 0;
+ virtual int32_t GetIpAddresses(uint32_t index,
+ PP_NetAddress_Private addresses[],
+ uint32_t count) = 0;
+ virtual PP_Var GetDisplayName(uint32_t index) = 0;
+ virtual uint32_t GetMTU(uint32_t index) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_NETWORK_LIST_API_H_
diff --git a/chromium/ppapi/thunk/ppb_network_list_private_thunk.cc b/chromium/ppapi/thunk/ppb_network_list_private_thunk.cc
new file mode 100644
index 00000000000..211c79364f3
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_network_list_private_thunk.cc
@@ -0,0 +1,105 @@
+// 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.
+
+// From private/ppb_network_list_private.idl,
+// modified Tue Apr 16 11:25:45 2013.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_network_list_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_network_list_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Bool IsNetworkList(PP_Resource resource) {
+ VLOG(4) << "PPB_NetworkList_Private::IsNetworkList()";
+ EnterResource<PPB_NetworkList_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+uint32_t GetCount(PP_Resource resource) {
+ VLOG(4) << "PPB_NetworkList_Private::GetCount()";
+ EnterResource<PPB_NetworkList_API> enter(resource, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetCount();
+}
+
+struct PP_Var GetName(PP_Resource resource, uint32_t index) {
+ VLOG(4) << "PPB_NetworkList_Private::GetName()";
+ EnterResource<PPB_NetworkList_API> enter(resource, true);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.object()->GetName(index);
+}
+
+PP_NetworkListType_Private GetType(PP_Resource resource, uint32_t index) {
+ VLOG(4) << "PPB_NetworkList_Private::GetType()";
+ EnterResource<PPB_NetworkList_API> enter(resource, true);
+ if (enter.failed())
+ return PP_NETWORKLIST_UNKNOWN;
+ return enter.object()->GetType(index);
+}
+
+PP_NetworkListState_Private GetState(PP_Resource resource, uint32_t index) {
+ VLOG(4) << "PPB_NetworkList_Private::GetState()";
+ EnterResource<PPB_NetworkList_API> enter(resource, true);
+ if (enter.failed())
+ return PP_NETWORKLIST_DOWN;
+ return enter.object()->GetState(index);
+}
+
+int32_t GetIpAddresses(PP_Resource resource,
+ uint32_t index,
+ struct PP_NetAddress_Private addresses[],
+ uint32_t count) {
+ VLOG(4) << "PPB_NetworkList_Private::GetIpAddresses()";
+ EnterResource<PPB_NetworkList_API> enter(resource, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->GetIpAddresses(index, addresses, count);
+}
+
+struct PP_Var GetDisplayName(PP_Resource resource, uint32_t index) {
+ VLOG(4) << "PPB_NetworkList_Private::GetDisplayName()";
+ EnterResource<PPB_NetworkList_API> enter(resource, true);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.object()->GetDisplayName(index);
+}
+
+uint32_t GetMTU(PP_Resource resource, uint32_t index) {
+ VLOG(4) << "PPB_NetworkList_Private::GetMTU()";
+ EnterResource<PPB_NetworkList_API> enter(resource, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetMTU(index);
+}
+
+const PPB_NetworkList_Private_0_2 g_ppb_networklist_private_thunk_0_2 = {
+ &IsNetworkList,
+ &GetCount,
+ &GetName,
+ &GetType,
+ &GetState,
+ &GetIpAddresses,
+ &GetDisplayName,
+ &GetMTU
+};
+
+} // namespace
+
+const PPB_NetworkList_Private_0_2* GetPPB_NetworkList_Private_0_2_Thunk() {
+ return &g_ppb_networklist_private_thunk_0_2;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_network_monitor_private_api.h b/chromium/ppapi/thunk/ppb_network_monitor_private_api.h
new file mode 100644
index 00000000000..124f6446c22
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_network_monitor_private_api.h
@@ -0,0 +1,22 @@
+// 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_NETWORK_MONITOR_PRIVATE_API_H_
+#define PPAPI_THUNK_PPB_NETWORK_MONITOR_PRIVATE_API_H_
+
+#include "ppapi/c/private/ppb_network_monitor_private.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_NetworkMonitor_Private_API {
+ public:
+ virtual ~PPB_NetworkMonitor_Private_API() {}
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_NETWORK_MONITOR_PRIVATE_API_H_
diff --git a/chromium/ppapi/thunk/ppb_network_monitor_private_thunk.cc b/chromium/ppapi/thunk/ppb_network_monitor_private_thunk.cc
new file mode 100644
index 00000000000..0382e923990
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_network_monitor_private_thunk.cc
@@ -0,0 +1,45 @@
+// 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.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/ppb_network_monitor_private_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterResource<PPB_NetworkMonitor_Private_API> EnterNetworkMonitor;
+
+PP_Resource Create(PP_Instance instance,
+ PPB_NetworkMonitor_Callback callback,
+ void* user_data) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateNetworkMonitor(instance, callback, user_data);
+}
+
+PP_Bool IsNetworkMonitor(PP_Resource resource) {
+ EnterNetworkMonitor enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+const PPB_NetworkMonitor_Private g_ppb_network_monitor_private_thunk = {
+ &Create,
+ &IsNetworkMonitor,
+};
+
+} // namespace
+
+const PPB_NetworkMonitor_Private_0_2*
+GetPPB_NetworkMonitor_Private_0_2_Thunk() {
+ return &g_ppb_network_monitor_private_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_network_proxy_api.h b/chromium/ppapi/thunk/ppb_network_proxy_api.h
new file mode 100644
index 00000000000..3cefaa070bc
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_network_proxy_api.h
@@ -0,0 +1,38 @@
+// Copyright (c) 2013 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_NETWORK_PROXY_API_H_
+#define PPAPI_THUNK_PPB_NETWORK_PROXY_API_H_
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+struct PP_Var;
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_NetworkProxy_API {
+ public:
+ virtual ~PPB_NetworkProxy_API() {}
+
+ virtual int32_t GetProxyForURL(PP_Instance instance,
+ PP_Var url,
+ PP_Var* proxy_string,
+ scoped_refptr<TrackedCallback> callback) = 0;
+
+ static const SingletonResourceID kSingletonResourceID =
+ NETWORK_PROXY_SINGLETON_ID;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_NETWORK_PROXY_API_H_
diff --git a/chromium/ppapi/thunk/ppb_network_proxy_thunk.cc b/chromium/ppapi/thunk/ppb_network_proxy_thunk.cc
new file mode 100644
index 00000000000..20c14ade989
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_network_proxy_thunk.cc
@@ -0,0 +1,47 @@
+// Copyright 2013 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 ppb_network_proxy.idl modified Thu Jun 20 22:03:12 2013.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_network_proxy.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_network_proxy_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+int32_t GetProxyForURL(PP_Instance instance,
+ struct PP_Var url,
+ struct PP_Var* proxy_string,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_NetworkProxy::GetProxyForURL()";
+ EnterInstanceAPI<PPB_NetworkProxy_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.functions()->GetProxyForURL(instance,
+ url,
+ proxy_string,
+ enter.callback()));
+}
+
+const PPB_NetworkProxy_1_0 g_ppb_networkproxy_thunk_1_0 = {
+ &GetProxyForURL
+};
+
+} // namespace
+
+const PPB_NetworkProxy_1_0* GetPPB_NetworkProxy_1_0_Thunk() {
+ return &g_ppb_networkproxy_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_pdf_api.h b/chromium/ppapi/thunk/ppb_pdf_api.h
new file mode 100644
index 00000000000..c5d276a4bfe
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_pdf_api.h
@@ -0,0 +1,41 @@
+// 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_THUNK_PPB_PDF_API_H_
+#define PPAPI_THUNK_PPB_PDF_API_H_
+
+#include "ppapi/c/private/ppb_pdf.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPB_PDF_API {
+ public:
+ virtual PP_Var GetLocalizedString(PP_ResourceString string_id) = 0;
+ virtual PP_Resource GetResourceImage(PP_ResourceImage image_id) = 0;
+ virtual void SearchString(const unsigned short* input_string,
+ const unsigned short* input_term,
+ bool case_sensitive,
+ PP_PrivateFindResult** results,
+ int* count) = 0;
+ virtual void DidStartLoading() = 0;
+ virtual void DidStopLoading() = 0;
+ virtual void SetContentRestriction(int restrictions) = 0;
+ virtual void HistogramPDFPageCount(int count) = 0;
+ virtual void UserMetricsRecordAction(const PP_Var& action) = 0;
+ virtual void HasUnsupportedFeature() = 0;
+ virtual void SaveAs() = 0;
+ virtual PP_Bool IsFeatureEnabled(PP_PDFFeature feature) = 0;
+ virtual void Print() = 0;
+ virtual PP_Resource GetResourceImageForScale(PP_ResourceImage image_id,
+ float scale) = 0;
+
+ static const SingletonResourceID kSingletonResourceID = PDF_SINGLETON_ID;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_PDF_API_H_
diff --git a/chromium/ppapi/thunk/ppb_pdf_thunk.cc b/chromium/ppapi/thunk/ppb_pdf_thunk.cc
new file mode 100644
index 00000000000..94334d143a9
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_pdf_thunk.cc
@@ -0,0 +1,161 @@
+// Copyright (c) 2013 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.
+
+#include "base/logging.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_pdf.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_flash_font_file_api.h"
+#include "ppapi/thunk/ppb_pdf_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Var GetLocalizedString(PP_Instance instance, PP_ResourceString string_id) {
+ EnterInstanceAPI<PPB_PDF_API> enter(instance);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.functions()->GetLocalizedString(string_id);
+}
+
+PP_Resource GetResourceImage(PP_Instance instance,
+ PP_ResourceImage image_id) {
+ EnterInstanceAPI<PPB_PDF_API> enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->GetResourceImage(image_id);
+}
+
+PP_Resource GetFontFileWithFallback(
+ PP_Instance instance,
+ const PP_BrowserFont_Trusted_Description* description,
+ PP_PrivateFontCharset charset) {
+ // TODO(raymes): Eventually we should replace the use of this function with
+ // either PPB_Flash_Font_File or PPB_TrueType_Font directly in the PDF code.
+ // For now just call into PPB_Flash_Font_File which has the exact same API.
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateFlashFontFile(instance, description, charset);
+}
+
+bool GetFontTableForPrivateFontFile(PP_Resource font_file,
+ uint32_t table,
+ void* output,
+ uint32_t* output_length) {
+ // TODO(raymes): Eventually we should replace the use of this function with
+ // either PPB_Flash_Font_File or PPB_TrueType_Font directly in the PDF code.
+ // For now just call into PPB_Flash_Font_File which has the exact same API.
+ EnterResource<PPB_Flash_FontFile_API> enter(font_file, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return PP_ToBool(enter.object()->GetFontTable(table, output, output_length));
+}
+
+void SearchString(PP_Instance instance,
+ const unsigned short* string,
+ const unsigned short* term,
+ bool case_sensitive,
+ PP_PrivateFindResult** results,
+ int* count) {
+ EnterInstanceAPI<PPB_PDF_API> enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->SearchString(string, term, case_sensitive, results, count);
+}
+
+void DidStartLoading(PP_Instance instance) {
+ EnterInstanceAPI<PPB_PDF_API> enter(instance);
+ if (enter.succeeded())
+ enter.functions()->DidStartLoading();
+}
+
+void DidStopLoading(PP_Instance instance) {
+ EnterInstanceAPI<PPB_PDF_API> enter(instance);
+ if (enter.succeeded())
+ enter.functions()->DidStopLoading();
+}
+
+void SetContentRestriction(PP_Instance instance, int restrictions) {
+ EnterInstanceAPI<PPB_PDF_API> enter(instance);
+ if (enter.succeeded())
+ enter.functions()->SetContentRestriction(restrictions);
+}
+
+void HistogramPDFPageCount(PP_Instance instance, int count) {
+ EnterInstanceAPI<PPB_PDF_API> enter(instance);
+ if (enter.succeeded())
+ enter.functions()->HistogramPDFPageCount(count);
+}
+
+void UserMetricsRecordAction(PP_Instance instance, PP_Var action) {
+ EnterInstanceAPI<PPB_PDF_API> enter(instance);
+ if (enter.succeeded())
+ enter.functions()->UserMetricsRecordAction(action);
+}
+
+void HasUnsupportedFeature(PP_Instance instance) {
+ EnterInstanceAPI<PPB_PDF_API> enter(instance);
+ if (enter.succeeded())
+ enter.functions()->HasUnsupportedFeature();
+}
+
+void SaveAs(PP_Instance instance) {
+ EnterInstanceAPI<PPB_PDF_API> enter(instance);
+ if (enter.succeeded())
+ enter.functions()->SaveAs();
+}
+
+void Print(PP_Instance instance) {
+ EnterInstanceAPI<PPB_PDF_API> enter(instance);
+ if (enter.succeeded())
+ enter.functions()->Print();
+}
+
+PP_Bool IsFeatureEnabled(PP_Instance instance, PP_PDFFeature feature) {
+ EnterInstanceAPI<PPB_PDF_API> enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->IsFeatureEnabled(feature);
+}
+
+PP_Resource GetResourceImageForScale(PP_Instance instance,
+ PP_ResourceImage image_id,
+ float scale) {
+ EnterInstanceAPI<PPB_PDF_API> enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->GetResourceImageForScale(image_id, scale);
+}
+
+const PPB_PDF g_ppb_pdf_thunk = {
+ &GetLocalizedString,
+ &GetResourceImage,
+ &GetFontFileWithFallback,
+ &GetFontTableForPrivateFontFile,
+ &SearchString,
+ &DidStartLoading,
+ &DidStopLoading,
+ &SetContentRestriction,
+ &HistogramPDFPageCount,
+ &UserMetricsRecordAction,
+ &HasUnsupportedFeature,
+ &SaveAs,
+ &Print,
+ &IsFeatureEnabled,
+ &GetResourceImageForScale
+};
+
+} // namespace
+
+const PPB_PDF* GetPPB_PDF_Thunk() {
+ return &g_ppb_pdf_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_printing_api.h b/chromium/ppapi/thunk/ppb_printing_api.h
new file mode 100644
index 00000000000..ac604ef0bd2
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_printing_api.h
@@ -0,0 +1,29 @@
+// 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_PRINTING_API_H_
+#define PPAPI_THUNK_PPB_PRINTING_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/dev/ppb_printing_dev.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPB_Printing_API {
+ public:
+ virtual ~PPB_Printing_API() {}
+
+ virtual int32_t GetDefaultPrintSettings(
+ PP_PrintSettings_Dev *print_settings,
+ scoped_refptr<TrackedCallback> callback) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_PRINTING_API_H_
diff --git a/chromium/ppapi/thunk/ppb_printing_dev_thunk.cc b/chromium/ppapi/thunk/ppb_printing_dev_thunk.cc
new file mode 100644
index 00000000000..117ef17ca75
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_printing_dev_thunk.cc
@@ -0,0 +1,54 @@
+// 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.
+
+// From dev/ppb_printing_dev.idl modified Fri Apr 19 10:45:09 2013.
+
+#include "ppapi/c/dev/ppb_printing_dev.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_printing_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_Printing_Dev::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreatePrinting(instance);
+}
+
+int32_t GetDefaultPrintSettings(PP_Resource resource,
+ struct PP_PrintSettings_Dev* print_settings,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_Printing_Dev::GetDefaultPrintSettings()";
+ EnterResource<PPB_Printing_API> enter(resource, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->GetDefaultPrintSettings(
+ print_settings,
+ enter.callback()));
+}
+
+const PPB_Printing_Dev_0_7 g_ppb_printing_dev_thunk_0_7 = {
+ &Create,
+ &GetDefaultPrintSettings
+};
+
+} // namespace
+
+const PPB_Printing_Dev_0_7* GetPPB_Printing_Dev_0_7_Thunk() {
+ return &g_ppb_printing_dev_thunk_0_7;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_resource_array_api.h b/chromium/ppapi/thunk/ppb_resource_array_api.h
new file mode 100644
index 00000000000..ec37f9e0fc3
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_resource_array_api.h
@@ -0,0 +1,25 @@
+// 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_RESOURCE_ARRAY_API_H_
+#define PPAPI_THUNK_PPB_RESOURCE_ARRAY_API_H_
+
+#include "ppapi/c/dev/ppb_resource_array_dev.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_ResourceArray_API {
+ public:
+ virtual ~PPB_ResourceArray_API() {}
+
+ virtual uint32_t GetSize() = 0;
+ virtual PP_Resource GetAt(uint32_t index) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_RESOURCE_ARRAY_API_H_
diff --git a/chromium/ppapi/thunk/ppb_resource_array_dev_thunk.cc b/chromium/ppapi/thunk/ppb_resource_array_dev_thunk.cc
new file mode 100644
index 00000000000..6d51a564d8a
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_resource_array_dev_thunk.cc
@@ -0,0 +1,67 @@
+// 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.
+
+// From dev/ppb_resource_array_dev.idl modified Thu Dec 20 13:10:26 2012.
+
+#include "ppapi/c/dev/ppb_resource_array_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_resource_array_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance,
+ const PP_Resource elements[],
+ uint32_t size) {
+ VLOG(4) << "PPB_ResourceArray_Dev::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateResourceArray(instance, elements, size);
+}
+
+PP_Bool IsResourceArray(PP_Resource resource) {
+ VLOG(4) << "PPB_ResourceArray_Dev::IsResourceArray()";
+ EnterResource<PPB_ResourceArray_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+uint32_t GetSize(PP_Resource resource_array) {
+ VLOG(4) << "PPB_ResourceArray_Dev::GetSize()";
+ EnterResource<PPB_ResourceArray_API> enter(resource_array, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetSize();
+}
+
+PP_Resource GetAt(PP_Resource resource_array, uint32_t index) {
+ VLOG(4) << "PPB_ResourceArray_Dev::GetAt()";
+ EnterResource<PPB_ResourceArray_API> enter(resource_array, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetAt(index);
+}
+
+const PPB_ResourceArray_Dev_0_1 g_ppb_resourcearray_dev_thunk_0_1 = {
+ &Create,
+ &IsResourceArray,
+ &GetSize,
+ &GetAt
+};
+
+} // namespace
+
+const PPB_ResourceArray_Dev_0_1* GetPPB_ResourceArray_Dev_0_1_Thunk() {
+ return &g_ppb_resourcearray_dev_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_scrollbar_api.h b/chromium/ppapi/thunk/ppb_scrollbar_api.h
new file mode 100644
index 00000000000..042eec8d3ec
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_scrollbar_api.h
@@ -0,0 +1,29 @@
+// 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_THUNK_PPB_SCROLLBAR_API_H_
+#define PPAPI_THUNK_PPB_SCROLLBAR_API_H_
+
+#include "ppapi/c/dev/ppb_scrollbar_dev.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPB_Scrollbar_API {
+ public:
+ virtual ~PPB_Scrollbar_API() {}
+
+ virtual uint32_t GetThickness() = 0;
+ virtual bool IsOverlay() = 0;
+ virtual uint32_t GetValue() = 0;
+ virtual void SetValue(uint32_t value) = 0;
+ virtual void SetDocumentSize(uint32_t size) = 0;
+ virtual void SetTickMarks(const PP_Rect* tick_marks, uint32_t count) = 0;
+ virtual void ScrollBy(PP_ScrollBy_Dev unit, int32_t multiplier) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_SCROLLBAR_API_H_
diff --git a/chromium/ppapi/thunk/ppb_scrollbar_thunk.cc b/chromium/ppapi/thunk/ppb_scrollbar_thunk.cc
new file mode 100644
index 00000000000..589948c1653
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_scrollbar_thunk.cc
@@ -0,0 +1,95 @@
+// 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.
+
+#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_scrollbar_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+typedef EnterResource<PPB_Scrollbar_API> EnterScrollbar;
+
+namespace {
+
+PP_Resource Create(PP_Instance instance, PP_Bool vertical) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateScrollbar(instance, vertical);
+}
+
+PP_Bool IsScrollbar(PP_Resource resource) {
+ EnterScrollbar enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+uint32_t GetThickness(PP_Resource scrollbar) {
+ EnterScrollbar enter(scrollbar, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetThickness();
+}
+
+PP_Bool IsOverlay(PP_Resource scrollbar) {
+ EnterScrollbar enter(scrollbar, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return PP_FromBool(enter.object()->IsOverlay());
+}
+
+uint32_t GetValue(PP_Resource scrollbar) {
+ EnterScrollbar enter(scrollbar, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetValue();
+}
+
+void SetValue(PP_Resource scrollbar, uint32_t value) {
+ EnterScrollbar enter(scrollbar, true);
+ if (enter.succeeded())
+ enter.object()->SetValue(value);
+}
+
+void SetDocumentSize(PP_Resource scrollbar, uint32_t size) {
+ EnterScrollbar enter(scrollbar, true);
+ if (enter.succeeded())
+ enter.object()->SetDocumentSize(size);
+}
+
+void SetTickMarks(PP_Resource scrollbar,
+ const PP_Rect* tick_marks,
+ uint32_t count) {
+ EnterScrollbar enter(scrollbar, true);
+ if (enter.succeeded())
+ enter.object()->SetTickMarks(tick_marks, count);
+}
+
+void ScrollBy(PP_Resource scrollbar, PP_ScrollBy_Dev unit, int32_t multiplier) {
+ EnterScrollbar enter(scrollbar, true);
+ if (enter.succeeded())
+ enter.object()->ScrollBy(unit, multiplier);
+}
+
+const PPB_Scrollbar_Dev g_ppb_scrollbar_thunk = {
+ &Create,
+ &IsScrollbar,
+ &GetThickness,
+ &IsOverlay,
+ &GetValue,
+ &SetValue,
+ &SetDocumentSize,
+ &SetTickMarks,
+ &ScrollBy
+};
+
+} // namespace
+
+const PPB_Scrollbar_Dev_0_5* GetPPB_Scrollbar_Dev_0_5_Thunk() {
+ return &g_ppb_scrollbar_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_talk_private_api.h b/chromium/ppapi/thunk/ppb_talk_private_api.h
new file mode 100644
index 00000000000..a31cf9dcc14
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_talk_private_api.h
@@ -0,0 +1,36 @@
+// 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_TALK_PRIVATE_API_H_
+#define PPAPI_THUNK_PPB_TALK_PRIVATE_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/private/ppb_talk_private.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_Talk_Private_API {
+ public:
+ virtual ~PPB_Talk_Private_API() {}
+
+ virtual int32_t RequestPermission(
+ PP_TalkPermission permission,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t StartRemoting(
+ PP_TalkEventCallback event_callback,
+ void* user_data,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t StopRemoting(
+ scoped_refptr<TrackedCallback> callback) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_TALK_PRIVATE_API_H_
diff --git a/chromium/ppapi/thunk/ppb_talk_private_thunk.cc b/chromium/ppapi/thunk/ppb_talk_private_thunk.cc
new file mode 100644
index 00000000000..6d2325de6eb
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_talk_private_thunk.cc
@@ -0,0 +1,87 @@
+// 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.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_talk_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_talk_private_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateTalk(instance);
+}
+
+int32_t GetPermission(PP_Resource resource,
+ PP_CompletionCallback callback) {
+ EnterResource<PPB_Talk_Private_API> enter(resource, callback, true);
+ if (enter.failed())
+ return PP_ERROR_BADRESOURCE;
+ return enter.SetResult(enter.object()->RequestPermission(
+ PP_TALKPERMISSION_SCREENCAST, enter.callback()));
+}
+
+int32_t RequestPermission(PP_Resource resource,
+ PP_TalkPermission permission,
+ PP_CompletionCallback callback) {
+ EnterResource<PPB_Talk_Private_API> enter(resource, callback, true);
+ if (enter.failed())
+ return PP_ERROR_BADRESOURCE;
+ return enter.SetResult(
+ enter.object()->RequestPermission(permission, enter.callback()));
+}
+
+int32_t StartRemoting(PP_Resource resource,
+ PP_TalkEventCallback event_callback,
+ void* user_data,
+ PP_CompletionCallback callback) {
+ EnterResource<PPB_Talk_Private_API> enter(resource, callback, true);
+ if (enter.failed())
+ return PP_ERROR_BADRESOURCE;
+ return enter.SetResult(
+ enter.object()->StartRemoting(event_callback, user_data,
+ enter.callback()));
+}
+
+int32_t StopRemoting(PP_Resource resource,
+ PP_CompletionCallback callback) {
+ EnterResource<PPB_Talk_Private_API> enter(resource, callback, true);
+ if (enter.failed())
+ return PP_ERROR_BADRESOURCE;
+ return enter.SetResult(
+ enter.object()->StopRemoting(enter.callback()));
+}
+
+const PPB_Talk_Private_1_0 g_ppb_talk_private_thunk_1_0 = {
+ &Create,
+ &GetPermission
+};
+
+const PPB_Talk_Private_2_0 g_ppb_talk_private_thunk_2_0 = {
+ &Create,
+ &RequestPermission,
+ &StartRemoting,
+ &StopRemoting
+};
+
+} // namespace
+
+const PPB_Talk_Private_1_0* GetPPB_Talk_Private_1_0_Thunk() {
+ return &g_ppb_talk_private_thunk_1_0;
+}
+
+const PPB_Talk_Private_2_0* GetPPB_Talk_Private_2_0_Thunk() {
+ return &g_ppb_talk_private_thunk_2_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_tcp_server_socket_private_api.h b/chromium/ppapi/thunk/ppb_tcp_server_socket_private_api.h
new file mode 100644
index 00000000000..0ca23d1afe5
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_tcp_server_socket_private_api.h
@@ -0,0 +1,34 @@
+// 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_TCP_SERVER_SOCKET_PRIVATE_API_H_
+#define PPAPI_THUNK_PPB_TCP_SERVER_SOCKET_PRIVATE_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/private/ppb_tcp_server_socket_private.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_TCPServerSocket_Private_API {
+public:
+ virtual ~PPB_TCPServerSocket_Private_API() {}
+
+ virtual int32_t Listen(const PP_NetAddress_Private* addr,
+ int32_t backlog,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t Accept(PP_Resource* tcp_socket,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t GetLocalAddress(PP_NetAddress_Private* addr) = 0;
+ virtual void StopListening() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_TCP_SERVER_SOCKET_PRIVATE_API_H_
diff --git a/chromium/ppapi/thunk/ppb_tcp_server_socket_private_thunk.cc b/chromium/ppapi/thunk/ppb_tcp_server_socket_private_thunk.cc
new file mode 100644
index 00000000000..bbfe16dade4
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_tcp_server_socket_private_thunk.cc
@@ -0,0 +1,96 @@
+// 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.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_tcp_server_socket_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_tcp_server_socket_private_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterResource<PPB_TCPServerSocket_Private_API> EnterTCPServer;
+
+PP_Resource Create(PP_Instance instance) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateTCPServerSocketPrivate(instance);
+}
+
+PP_Bool IsTCPServerSocket(PP_Resource resource) {
+ EnterTCPServer enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Listen(PP_Resource tcp_server_socket,
+ const PP_NetAddress_Private* addr,
+ int32_t backlog,
+ PP_CompletionCallback callback) {
+ EnterTCPServer enter(tcp_server_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Listen(addr, backlog,
+ enter.callback()));
+}
+
+int32_t Accept(PP_Resource tcp_server_socket,
+ PP_Resource* tcp_socket,
+ PP_CompletionCallback callback) {
+ EnterTCPServer enter(tcp_server_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Accept(tcp_socket, enter.callback()));
+}
+
+int32_t GetLocalAddress(PP_Resource tcp_server_socket,
+ PP_NetAddress_Private* addr) {
+ EnterTCPServer enter(tcp_server_socket, true);
+ if (enter.failed())
+ return PP_ERROR_BADRESOURCE;
+ return enter.object()->GetLocalAddress(addr);
+}
+
+void StopListening(PP_Resource tcp_server_socket) {
+ EnterTCPServer enter(tcp_server_socket, true);
+ if (enter.succeeded())
+ enter.object()->StopListening();
+}
+
+const PPB_TCPServerSocket_Private_0_1 g_ppb_tcp_server_socket_thunk_0_1 = {
+ Create,
+ IsTCPServerSocket,
+ Listen,
+ Accept,
+ StopListening
+};
+
+const PPB_TCPServerSocket_Private_0_2 g_ppb_tcp_server_socket_thunk_0_2 = {
+ Create,
+ IsTCPServerSocket,
+ Listen,
+ Accept,
+ GetLocalAddress,
+ StopListening,
+};
+
+} // namespace
+
+const PPB_TCPServerSocket_Private_0_1*
+GetPPB_TCPServerSocket_Private_0_1_Thunk() {
+ return &g_ppb_tcp_server_socket_thunk_0_1;
+}
+
+const PPB_TCPServerSocket_Private_0_2*
+GetPPB_TCPServerSocket_Private_0_2_Thunk() {
+ return &g_ppb_tcp_server_socket_thunk_0_2;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_tcp_socket_api.h b/chromium/ppapi/thunk/ppb_tcp_socket_api.h
new file mode 100644
index 00000000000..d33685fd97f
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_tcp_socket_api.h
@@ -0,0 +1,41 @@
+// Copyright 2013 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_TCP_SOCKET_API_H_
+#define PPAPI_THUNK_PPB_TCP_SOCKET_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/ppb_tcp_socket.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_TCPSocket_API {
+ public:
+ virtual ~PPB_TCPSocket_API() {}
+
+ virtual int32_t Connect(PP_Resource addr,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual PP_Resource GetLocalAddress() = 0;
+ virtual PP_Resource GetRemoteAddress() = 0;
+ virtual int32_t Read(char* buffer,
+ int32_t bytes_to_read,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t Write(const char* buffer,
+ int32_t bytes_to_write,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual void Close() = 0;
+ virtual int32_t SetOption(PP_TCPSocket_Option name,
+ const PP_Var& value,
+ scoped_refptr<TrackedCallback> callback) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_TCP_SOCKET_API_H_
diff --git a/chromium/ppapi/thunk/ppb_tcp_socket_private_api.h b/chromium/ppapi/thunk/ppb_tcp_socket_private_api.h
new file mode 100644
index 00000000000..ebc8070dd45
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_tcp_socket_private_api.h
@@ -0,0 +1,51 @@
+// 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_TCP_SOCKET_PRIVATE_API_H_
+#define PPAPI_THUNK_PPB_TCP_SOCKET_PRIVATE_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/private/ppb_tcp_socket_private.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_TCPSocket_Private_API {
+ public:
+ virtual ~PPB_TCPSocket_Private_API() {}
+
+ virtual int32_t Connect(const char* host,
+ uint16_t port,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t ConnectWithNetAddress(
+ const PP_NetAddress_Private* addr,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual PP_Bool GetLocalAddress(PP_NetAddress_Private* local_addr) = 0;
+ virtual PP_Bool GetRemoteAddress(PP_NetAddress_Private* remote_addr) = 0;
+ virtual int32_t SSLHandshake(const char* server_name,
+ uint16_t server_port,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual PP_Resource GetServerCertificate() = 0;
+ virtual PP_Bool AddChainBuildingCertificate(PP_Resource certificate,
+ PP_Bool trusted) = 0;
+ virtual int32_t Read(char* buffer,
+ int32_t bytes_to_read,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t Write(const char* buffer,
+ int32_t bytes_to_write,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual void Disconnect() = 0;
+ virtual int32_t SetOption(PP_TCPSocketOption_Private name,
+ const PP_Var& value,
+ scoped_refptr<TrackedCallback> callback) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_TCP_SOCKET_PRIVATE_API_H_
diff --git a/chromium/ppapi/thunk/ppb_tcp_socket_private_thunk.cc b/chromium/ppapi/thunk/ppb_tcp_socket_private_thunk.cc
new file mode 100644
index 00000000000..928f07381c8
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_tcp_socket_private_thunk.cc
@@ -0,0 +1,194 @@
+// 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.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_tcp_socket_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/ppb_tcp_socket_private_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterResource<PPB_TCPSocket_Private_API> EnterTCP;
+
+PP_Resource Create(PP_Instance instance) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateTCPSocketPrivate(instance);
+}
+
+PP_Bool IsTCPSocket(PP_Resource resource) {
+ EnterTCP enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Connect(PP_Resource tcp_socket,
+ const char* host,
+ uint16_t port,
+ PP_CompletionCallback callback) {
+ EnterTCP enter(tcp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Connect(host, port, enter.callback()));
+}
+
+int32_t ConnectWithNetAddress(PP_Resource tcp_socket,
+ const PP_NetAddress_Private* addr,
+ PP_CompletionCallback callback) {
+ EnterTCP enter(tcp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(
+ enter.object()->ConnectWithNetAddress(addr, enter.callback()));
+}
+
+PP_Bool GetLocalAddress(PP_Resource tcp_socket,
+ PP_NetAddress_Private* local_addr) {
+ EnterTCP enter(tcp_socket, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->GetLocalAddress(local_addr);
+}
+
+PP_Bool GetRemoteAddress(PP_Resource tcp_socket,
+ PP_NetAddress_Private* remote_addr) {
+ EnterTCP enter(tcp_socket, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->GetRemoteAddress(remote_addr);
+}
+
+int32_t SSLHandshake(PP_Resource tcp_socket,
+ const char* server_name,
+ uint16_t server_port,
+ PP_CompletionCallback callback) {
+ EnterTCP enter(tcp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->SSLHandshake(server_name, server_port,
+ enter.callback()));
+}
+
+PP_Resource GetServerCertificate(PP_Resource tcp_socket) {
+ EnterTCP enter(tcp_socket, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetServerCertificate();
+}
+
+PP_Bool AddChainBuildingCertificate(PP_Resource tcp_socket,
+ PP_Resource certificate,
+ PP_Bool trusted) {
+ EnterTCP enter(tcp_socket, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->AddChainBuildingCertificate(certificate, trusted);
+}
+
+int32_t Read(PP_Resource tcp_socket,
+ char* buffer,
+ int32_t bytes_to_read,
+ PP_CompletionCallback callback) {
+ EnterTCP enter(tcp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Read(buffer, bytes_to_read,
+ enter.callback()));
+}
+
+int32_t Write(PP_Resource tcp_socket,
+ const char* buffer,
+ int32_t bytes_to_write,
+ PP_CompletionCallback callback) {
+ EnterTCP enter(tcp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Write(buffer, bytes_to_write,
+ enter.callback()));
+}
+
+void Disconnect(PP_Resource tcp_socket) {
+ EnterTCP enter(tcp_socket, true);
+ if (enter.succeeded())
+ enter.object()->Disconnect();
+}
+
+int32_t SetOption(PP_Resource tcp_socket,
+ PP_TCPSocketOption_Private name,
+ PP_Var value,
+ PP_CompletionCallback callback) {
+ EnterTCP enter(tcp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(
+ enter.object()->SetOption(name, value, enter.callback()));
+}
+
+const PPB_TCPSocket_Private_0_3 g_ppb_tcp_socket_thunk_0_3 = {
+ &Create,
+ &IsTCPSocket,
+ &Connect,
+ &ConnectWithNetAddress,
+ &GetLocalAddress,
+ &GetRemoteAddress,
+ &SSLHandshake,
+ &Read,
+ &Write,
+ &Disconnect
+};
+
+const PPB_TCPSocket_Private_0_4 g_ppb_tcp_socket_thunk_0_4 = {
+ &Create,
+ &IsTCPSocket,
+ &Connect,
+ &ConnectWithNetAddress,
+ &GetLocalAddress,
+ &GetRemoteAddress,
+ &SSLHandshake,
+ &GetServerCertificate,
+ &AddChainBuildingCertificate,
+ &Read,
+ &Write,
+ &Disconnect
+};
+
+const PPB_TCPSocket_Private_0_5 g_ppb_tcp_socket_thunk_0_5 = {
+ &Create,
+ &IsTCPSocket,
+ &Connect,
+ &ConnectWithNetAddress,
+ &GetLocalAddress,
+ &GetRemoteAddress,
+ &SSLHandshake,
+ &GetServerCertificate,
+ &AddChainBuildingCertificate,
+ &Read,
+ &Write,
+ &Disconnect,
+ &SetOption
+};
+
+} // namespace
+
+const PPB_TCPSocket_Private_0_3* GetPPB_TCPSocket_Private_0_3_Thunk() {
+ return &g_ppb_tcp_socket_thunk_0_3;
+}
+
+const PPB_TCPSocket_Private_0_4* GetPPB_TCPSocket_Private_0_4_Thunk() {
+ return &g_ppb_tcp_socket_thunk_0_4;
+}
+
+const PPB_TCPSocket_Private_0_5* GetPPB_TCPSocket_Private_0_5_Thunk() {
+ return &g_ppb_tcp_socket_thunk_0_5;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_tcp_socket_thunk.cc b/chromium/ppapi/thunk/ppb_tcp_socket_thunk.cc
new file mode 100644
index 00000000000..ff612fb54db
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_tcp_socket_thunk.cc
@@ -0,0 +1,128 @@
+// Copyright 2013 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 ppb_tcp_socket.idl modified Thu Jun 20 16:36:53 2013.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_tcp_socket.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_tcp_socket_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_TCPSocket::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateTCPSocket(instance);
+}
+
+PP_Bool IsTCPSocket(PP_Resource resource) {
+ VLOG(4) << "PPB_TCPSocket::IsTCPSocket()";
+ EnterResource<PPB_TCPSocket_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Connect(PP_Resource tcp_socket,
+ PP_Resource addr,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_TCPSocket::Connect()";
+ EnterResource<PPB_TCPSocket_API> enter(tcp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Connect(addr, enter.callback()));
+}
+
+PP_Resource GetLocalAddress(PP_Resource tcp_socket) {
+ VLOG(4) << "PPB_TCPSocket::GetLocalAddress()";
+ EnterResource<PPB_TCPSocket_API> enter(tcp_socket, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetLocalAddress();
+}
+
+PP_Resource GetRemoteAddress(PP_Resource tcp_socket) {
+ VLOG(4) << "PPB_TCPSocket::GetRemoteAddress()";
+ EnterResource<PPB_TCPSocket_API> enter(tcp_socket, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetRemoteAddress();
+}
+
+int32_t Read(PP_Resource tcp_socket,
+ char* buffer,
+ int32_t bytes_to_read,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_TCPSocket::Read()";
+ EnterResource<PPB_TCPSocket_API> enter(tcp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Read(buffer,
+ bytes_to_read,
+ enter.callback()));
+}
+
+int32_t Write(PP_Resource tcp_socket,
+ const char* buffer,
+ int32_t bytes_to_write,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_TCPSocket::Write()";
+ EnterResource<PPB_TCPSocket_API> enter(tcp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Write(buffer,
+ bytes_to_write,
+ enter.callback()));
+}
+
+void Close(PP_Resource tcp_socket) {
+ VLOG(4) << "PPB_TCPSocket::Close()";
+ EnterResource<PPB_TCPSocket_API> enter(tcp_socket, true);
+ if (enter.failed())
+ return;
+ enter.object()->Close();
+}
+
+int32_t SetOption(PP_Resource tcp_socket,
+ PP_TCPSocket_Option name,
+ struct PP_Var value,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_TCPSocket::SetOption()";
+ EnterResource<PPB_TCPSocket_API> enter(tcp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->SetOption(name,
+ value,
+ enter.callback()));
+}
+
+const PPB_TCPSocket_1_0 g_ppb_tcpsocket_thunk_1_0 = {
+ &Create,
+ &IsTCPSocket,
+ &Connect,
+ &GetLocalAddress,
+ &GetRemoteAddress,
+ &Read,
+ &Write,
+ &Close,
+ &SetOption
+};
+
+} // namespace
+
+const PPB_TCPSocket_1_0* GetPPB_TCPSocket_1_0_Thunk() {
+ return &g_ppb_tcpsocket_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_text_input_thunk.cc b/chromium/ppapi/thunk/ppb_text_input_thunk.cc
new file mode 100644
index 00000000000..a59146bd1f7
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_text_input_thunk.cc
@@ -0,0 +1,133 @@
+// 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.
+
+#include "base/basictypes.h"
+#include "ppapi/c/dev/ppb_text_input_dev.h"
+#include "ppapi/c/ppb_text_input_controller.h"
+#include "ppapi/shared_impl/var.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+COMPILE_ASSERT(int(PP_TEXTINPUT_TYPE_DEV_NONE) == int(PP_TEXTINPUT_TYPE_NONE),
+ mismatching_enums);
+COMPILE_ASSERT(int(PP_TEXTINPUT_TYPE_DEV_TEXT) == int(PP_TEXTINPUT_TYPE_TEXT),
+ mismatching_enums);
+COMPILE_ASSERT(
+ int(PP_TEXTINPUT_TYPE_DEV_PASSWORD) == int(PP_TEXTINPUT_TYPE_PASSWORD),
+ mismatching_enums);
+COMPILE_ASSERT(
+ int(PP_TEXTINPUT_TYPE_DEV_SEARCH) == int(PP_TEXTINPUT_TYPE_SEARCH),
+ mismatching_enums);
+COMPILE_ASSERT(int(PP_TEXTINPUT_TYPE_DEV_EMAIL) == int(PP_TEXTINPUT_TYPE_EMAIL),
+ mismatching_enums);
+COMPILE_ASSERT(
+ int(PP_TEXTINPUT_TYPE_DEV_NUMBER) == int(PP_TEXTINPUT_TYPE_NUMBER),
+ mismatching_enums);
+COMPILE_ASSERT(
+ int(PP_TEXTINPUT_TYPE_DEV_TELEPHONE) == int(PP_TEXTINPUT_TYPE_TELEPHONE),
+ mismatching_enums);
+COMPILE_ASSERT(int(PP_TEXTINPUT_TYPE_DEV_URL) == int(PP_TEXTINPUT_TYPE_URL),
+ mismatching_enums);
+
+void SetTextInputType(PP_Instance instance, PP_TextInput_Type type) {
+ EnterInstance enter(instance);
+ if (enter.succeeded())
+ enter.functions()->SetTextInputType(instance, type);
+}
+
+void SetTextInputType_0_2(PP_Instance instance, PP_TextInput_Type_Dev type) {
+ EnterInstance enter(instance);
+ if (enter.succeeded())
+ enter.functions()->SetTextInputType(instance,
+ static_cast<PP_TextInput_Type>(type));
+}
+
+void UpdateCaretPosition_0_2(PP_Instance instance,
+ const PP_Rect* caret,
+ const PP_Rect* bounding_box) {
+ EnterInstance enter(instance);
+ if (enter.succeeded() && caret && bounding_box)
+ enter.functions()->UpdateCaretPosition(instance, *caret, *bounding_box);
+}
+
+void UpdateCaretPosition(PP_Instance instance,
+ const PP_Rect* caret) {
+ EnterInstance enter(instance);
+ if (enter.succeeded() && caret)
+ enter.functions()->UpdateCaretPosition(instance, *caret, PP_Rect());
+}
+
+void CancelCompositionText(PP_Instance instance) {
+ EnterInstance enter(instance);
+ if (enter.succeeded())
+ enter.functions()->CancelCompositionText(instance);
+}
+
+void UpdateSurroundingText_0_2(PP_Instance instance, const char* text,
+ uint32_t caret, uint32_t anchor) {
+ EnterInstance enter(instance);
+ if (enter.succeeded())
+ enter.functions()->UpdateSurroundingText(instance, text, caret, anchor);
+}
+
+void UpdateSurroundingText_1_0(PP_Instance instance, PP_Var text,
+ uint32_t caret, uint32_t anchor) {
+ EnterInstance enter(instance);
+ StringVar* var = StringVar::FromPPVar(text);
+ if (enter.succeeded() && var)
+ enter.functions()->UpdateSurroundingText(instance,
+ var->value().c_str(),
+ caret,
+ anchor);
+}
+
+void SelectionChanged(PP_Instance instance) {
+ EnterInstance enter(instance);
+ if (enter.succeeded())
+ enter.functions()->SelectionChanged(instance);
+}
+
+const PPB_TextInput_Dev_0_1 g_ppb_textinput_0_1_thunk = {
+ &SetTextInputType_0_2,
+ &UpdateCaretPosition_0_2,
+ &CancelCompositionText,
+};
+
+const PPB_TextInput_Dev_0_2 g_ppb_textinput_0_2_thunk = {
+ &SetTextInputType_0_2,
+ &UpdateCaretPosition_0_2,
+ &CancelCompositionText,
+ &UpdateSurroundingText_0_2,
+ &SelectionChanged,
+};
+
+const PPB_TextInputController_1_0 g_ppb_textinputcontroller_1_0_thunk = {
+ &SetTextInputType,
+ &UpdateCaretPosition,
+ &CancelCompositionText,
+ &UpdateSurroundingText_1_0,
+};
+
+} // namespace
+
+const PPB_TextInput_Dev_0_1* GetPPB_TextInput_Dev_0_1_Thunk() {
+ return &g_ppb_textinput_0_1_thunk;
+}
+
+const PPB_TextInput_Dev_0_2* GetPPB_TextInput_Dev_0_2_Thunk() {
+ return &g_ppb_textinput_0_2_thunk;
+}
+
+const PPB_TextInputController_1_0* GetPPB_TextInputController_1_0_Thunk() {
+ return &g_ppb_textinputcontroller_1_0_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_truetype_font_api.h b/chromium/ppapi/thunk/ppb_truetype_font_api.h
new file mode 100644
index 00000000000..9df6c9878f5
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_truetype_font_api.h
@@ -0,0 +1,36 @@
+// Copyright (c) 2013 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_TRUETYPE_FONT_API_H_
+#define PPAPI_THUNK_PPB_TRUETYPE_FONT_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/dev/ppb_truetype_font_dev.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_TrueTypeFont_API {
+ public:
+ virtual ~PPB_TrueTypeFont_API() {}
+
+ virtual int32_t Describe(PP_TrueTypeFontDesc_Dev* desc,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t GetTableTags(const PP_ArrayOutput& output,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t GetTable(uint32_t table,
+ int32_t offset,
+ int32_t max_data_length,
+ const PP_ArrayOutput& output,
+ scoped_refptr<TrackedCallback> callback) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_TRUETYPE_FONT_API_H_
diff --git a/chromium/ppapi/thunk/ppb_truetype_font_dev_thunk.cc b/chromium/ppapi/thunk/ppb_truetype_font_dev_thunk.cc
new file mode 100644
index 00000000000..afed58e7b6b
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_truetype_font_dev_thunk.cc
@@ -0,0 +1,121 @@
+// Copyright (c) 2013 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 dev/ppb_truetype_font_dev.idl modified Wed Apr 17 15:38:46 2013.
+
+#include "ppapi/c/dev/ppb_truetype_font_dev.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_truetype_font_api.h"
+#include "ppapi/thunk/ppb_truetype_font_singleton_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+int32_t GetFontFamilies(PP_Instance instance,
+ struct PP_ArrayOutput output,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_TrueTypeFont_Dev::GetFontFamilies()";
+ EnterInstanceAPI<PPB_TrueTypeFont_Singleton_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.functions()->GetFontFamilies(
+ instance,
+ output,
+ enter.callback()));
+}
+
+int32_t GetFontsInFamily(PP_Instance instance,
+ struct PP_Var family,
+ struct PP_ArrayOutput output,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_TrueTypeFont_Dev::GetFontsInFamily()";
+ EnterInstanceAPI<PPB_TrueTypeFont_Singleton_API> enter(instance, callback);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.functions()->GetFontsInFamily(
+ instance,
+ family,
+ output,
+ enter.callback()));
+}
+
+PP_Resource Create(PP_Instance instance,
+ const struct PP_TrueTypeFontDesc_Dev* desc) {
+ VLOG(4) << "PPB_TrueTypeFont_Dev::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateTrueTypeFont(instance, desc);
+}
+
+PP_Bool IsTrueTypeFont(PP_Resource resource) {
+ VLOG(4) << "PPB_TrueTypeFont_Dev::IsTrueTypeFont()";
+ EnterResource<PPB_TrueTypeFont_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Describe(PP_Resource font,
+ struct PP_TrueTypeFontDesc_Dev* desc,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_TrueTypeFont_Dev::Describe()";
+ EnterResource<PPB_TrueTypeFont_API> enter(font, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Describe(desc, enter.callback()));
+}
+
+int32_t GetTableTags(PP_Resource font,
+ struct PP_ArrayOutput output,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_TrueTypeFont_Dev::GetTableTags()";
+ EnterResource<PPB_TrueTypeFont_API> enter(font, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->GetTableTags(output,
+ enter.callback()));
+}
+
+int32_t GetTable(PP_Resource font,
+ uint32_t table,
+ int32_t offset,
+ int32_t max_data_length,
+ struct PP_ArrayOutput output,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_TrueTypeFont_Dev::GetTable()";
+ EnterResource<PPB_TrueTypeFont_API> enter(font, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->GetTable(table,
+ offset,
+ max_data_length,
+ output,
+ enter.callback()));
+}
+
+const PPB_TrueTypeFont_Dev_0_1 g_ppb_truetypefont_dev_thunk_0_1 = {
+ &GetFontFamilies,
+ &GetFontsInFamily,
+ &Create,
+ &IsTrueTypeFont,
+ &Describe,
+ &GetTableTags,
+ &GetTable
+};
+
+} // namespace
+
+const PPB_TrueTypeFont_Dev_0_1* GetPPB_TrueTypeFont_Dev_0_1_Thunk() {
+ return &g_ppb_truetypefont_dev_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_truetype_font_singleton_api.h b/chromium/ppapi/thunk/ppb_truetype_font_singleton_api.h
new file mode 100644
index 00000000000..97c727dc2bb
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_truetype_font_singleton_api.h
@@ -0,0 +1,40 @@
+// Copyright (c) 2013 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_TRUETYPE_FONT_SINGLETON_API_H_
+#define PPAPI_THUNK_PPB_TRUETYPE_FONT_SINGLETON_API_H_
+
+#include "ppapi/c/pp_array_output.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/singleton_resource_id.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPB_TrueTypeFont_Singleton_API {
+ public:
+ virtual ~PPB_TrueTypeFont_Singleton_API() {}
+
+ virtual int32_t GetFontFamilies(
+ PP_Instance instance,
+ const PP_ArrayOutput& output,
+ const scoped_refptr<TrackedCallback>& callback) = 0;
+
+ virtual int32_t GetFontsInFamily(
+ PP_Instance instance,
+ PP_Var family,
+ const PP_ArrayOutput& output,
+ const scoped_refptr<TrackedCallback>& callback) = 0;
+
+ static const SingletonResourceID kSingletonResourceID =
+ TRUETYPE_FONT_SINGLETON_ID;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_TRUETYPE_FONT_SINGLETON_API_H_
diff --git a/chromium/ppapi/thunk/ppb_udp_socket_api.h b/chromium/ppapi/thunk/ppb_udp_socket_api.h
new file mode 100644
index 00000000000..adc2799116f
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_udp_socket_api.h
@@ -0,0 +1,42 @@
+// Copyright 2013 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_UDP_SOCKET_API_H_
+#define PPAPI_THUNK_PPB_UDP_SOCKET_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/ppb_udp_socket.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_UDPSocket_API {
+ public:
+ virtual ~PPB_UDPSocket_API() {}
+
+ virtual int32_t Bind(PP_Resource addr,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual PP_Resource GetBoundAddress() = 0;
+ virtual int32_t RecvFrom(char* buffer,
+ int32_t num_bytes,
+ PP_Resource* addr,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t SendTo(const char* buffer,
+ int32_t num_bytes,
+ PP_Resource addr,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual void Close() = 0;
+ virtual int32_t SetOption(PP_UDPSocket_Option name,
+ const PP_Var& value,
+ scoped_refptr<TrackedCallback> callback) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_UDP_SOCKET_API_H_
diff --git a/chromium/ppapi/thunk/ppb_udp_socket_private_api.h b/chromium/ppapi/thunk/ppb_udp_socket_private_api.h
new file mode 100644
index 00000000000..9c403a05205
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_udp_socket_private_api.h
@@ -0,0 +1,41 @@
+// 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_UDP_SOCKET_PRIVATE_API_H_
+#define PPAPI_THUNK_PPB_UDP_SOCKET_PRIVATE_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/private/ppb_udp_socket_private.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_UDPSocket_Private_API {
+ public:
+ virtual ~PPB_UDPSocket_Private_API() {}
+
+ virtual int32_t SetSocketFeature(PP_UDPSocketFeature_Private name,
+ PP_Var value) = 0;
+ virtual int32_t Bind(const PP_NetAddress_Private* addr,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual PP_Bool GetBoundAddress(PP_NetAddress_Private* addr) = 0;
+ virtual int32_t RecvFrom(char* buffer,
+ int32_t num_bytes,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual PP_Bool GetRecvFromAddress(PP_NetAddress_Private* addr) = 0;
+ virtual int32_t SendTo(const char* buffer,
+ int32_t num_bytes,
+ const PP_NetAddress_Private* addr,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual void Close() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_UDP_SOCKET_PRIVATE_API_H_
diff --git a/chromium/ppapi/thunk/ppb_udp_socket_private_thunk.cc b/chromium/ppapi/thunk/ppb_udp_socket_private_thunk.cc
new file mode 100644
index 00000000000..a4936667d3c
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_udp_socket_private_thunk.cc
@@ -0,0 +1,148 @@
+// 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.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_udp_socket_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_udp_socket_private_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterResource<PPB_UDPSocket_Private_API> EnterUDP;
+
+PP_Resource Create(PP_Instance instance) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateUDPSocketPrivate(instance);
+}
+
+PP_Bool IsUDPSocket(PP_Resource resource) {
+ EnterUDP enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t SetSocketFeature(PP_Resource udp_socket,
+ PP_UDPSocketFeature_Private name,
+ PP_Var value) {
+ EnterUDP enter(udp_socket, true);
+ if (enter.failed())
+ return PP_ERROR_BADRESOURCE;
+ return enter.object()->SetSocketFeature(name, value);
+}
+
+int32_t Bind(PP_Resource udp_socket,
+ const PP_NetAddress_Private *addr,
+ PP_CompletionCallback callback) {
+ EnterUDP enter(udp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Bind(addr, enter.callback()));
+}
+
+PP_Bool GetBoundAddress(PP_Resource udp_socket,
+ PP_NetAddress_Private* addr) {
+ EnterUDP enter(udp_socket, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->GetBoundAddress(addr);
+}
+
+int32_t RecvFrom(PP_Resource udp_socket,
+ char* buffer,
+ int32_t num_bytes,
+ PP_CompletionCallback callback) {
+#ifdef NDEBUG
+ EnterUDP enter(udp_socket, callback, false);
+#else
+ EnterUDP enter(udp_socket, callback, true);
+#endif
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->RecvFrom(buffer, num_bytes,
+ enter.callback()));
+}
+
+PP_Bool GetRecvFromAddress(PP_Resource udp_socket,
+ PP_NetAddress_Private* addr) {
+ EnterUDP enter(udp_socket, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->GetRecvFromAddress(addr);
+}
+
+int32_t SendTo(PP_Resource udp_socket,
+ const char* buffer,
+ int32_t num_bytes,
+ const PP_NetAddress_Private* addr,
+ PP_CompletionCallback callback) {
+ EnterUDP enter(udp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->SendTo(buffer, num_bytes, addr,
+ enter.callback()));
+}
+
+void Close(PP_Resource udp_socket) {
+ EnterUDP enter(udp_socket, true);
+ if (enter.succeeded())
+ enter.object()->Close();
+}
+
+const PPB_UDPSocket_Private_0_2 g_ppb_udp_socket_thunk_0_2 = {
+ &Create,
+ &IsUDPSocket,
+ &Bind,
+ &RecvFrom,
+ &GetRecvFromAddress,
+ &SendTo,
+ &Close
+};
+
+const PPB_UDPSocket_Private_0_3 g_ppb_udp_socket_thunk_0_3 = {
+ &Create,
+ &IsUDPSocket,
+ &Bind,
+ &GetBoundAddress,
+ &RecvFrom,
+ &GetRecvFromAddress,
+ &SendTo,
+ &Close
+};
+
+const PPB_UDPSocket_Private_0_4 g_ppb_udp_socket_thunk_0_4 = {
+ &Create,
+ &IsUDPSocket,
+ &SetSocketFeature,
+ &Bind,
+ &GetBoundAddress,
+ &RecvFrom,
+ &GetRecvFromAddress,
+ &SendTo,
+ &Close
+};
+
+} // namespace
+
+const PPB_UDPSocket_Private_0_2* GetPPB_UDPSocket_Private_0_2_Thunk() {
+ return &g_ppb_udp_socket_thunk_0_2;
+}
+
+const PPB_UDPSocket_Private_0_3* GetPPB_UDPSocket_Private_0_3_Thunk() {
+ return &g_ppb_udp_socket_thunk_0_3;
+}
+
+const PPB_UDPSocket_Private_0_4* GetPPB_UDPSocket_Private_0_4_Thunk() {
+ return &g_ppb_udp_socket_thunk_0_4;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_udp_socket_thunk.cc b/chromium/ppapi/thunk/ppb_udp_socket_thunk.cc
new file mode 100644
index 00000000000..8343d2f8629
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_udp_socket_thunk.cc
@@ -0,0 +1,123 @@
+// Copyright 2013 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 ppb_udp_socket.idl modified Thu Jun 20 14:03:55 2013.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_udp_socket.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_udp_socket_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_UDPSocket::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateUDPSocket(instance);
+}
+
+PP_Bool IsUDPSocket(PP_Resource resource) {
+ VLOG(4) << "PPB_UDPSocket::IsUDPSocket()";
+ EnterResource<PPB_UDPSocket_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Bind(PP_Resource udp_socket,
+ PP_Resource addr,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_UDPSocket::Bind()";
+ EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Bind(addr, enter.callback()));
+}
+
+PP_Resource GetBoundAddress(PP_Resource udp_socket) {
+ VLOG(4) << "PPB_UDPSocket::GetBoundAddress()";
+ EnterResource<PPB_UDPSocket_API> enter(udp_socket, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetBoundAddress();
+}
+
+int32_t RecvFrom(PP_Resource udp_socket,
+ char* buffer,
+ int32_t num_bytes,
+ PP_Resource* addr,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_UDPSocket::RecvFrom()";
+ EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->RecvFrom(buffer,
+ num_bytes,
+ addr,
+ enter.callback()));
+}
+
+int32_t SendTo(PP_Resource udp_socket,
+ const char* buffer,
+ int32_t num_bytes,
+ PP_Resource addr,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_UDPSocket::SendTo()";
+ EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->SendTo(buffer,
+ num_bytes,
+ addr,
+ enter.callback()));
+}
+
+void Close(PP_Resource udp_socket) {
+ VLOG(4) << "PPB_UDPSocket::Close()";
+ EnterResource<PPB_UDPSocket_API> enter(udp_socket, true);
+ if (enter.failed())
+ return;
+ enter.object()->Close();
+}
+
+int32_t SetOption(PP_Resource udp_socket,
+ PP_UDPSocket_Option name,
+ struct PP_Var value,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_UDPSocket::SetOption()";
+ EnterResource<PPB_UDPSocket_API> enter(udp_socket, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->SetOption(name,
+ value,
+ enter.callback()));
+}
+
+const PPB_UDPSocket_1_0 g_ppb_udpsocket_thunk_1_0 = {
+ &Create,
+ &IsUDPSocket,
+ &Bind,
+ &GetBoundAddress,
+ &RecvFrom,
+ &SendTo,
+ &Close,
+ &SetOption
+};
+
+} // namespace
+
+const PPB_UDPSocket_1_0* GetPPB_UDPSocket_1_0_Thunk() {
+ return &g_ppb_udpsocket_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_url_loader_api.h b/chromium/ppapi/thunk/ppb_url_loader_api.h
new file mode 100644
index 00000000000..df9b6aa0fe8
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_url_loader_api.h
@@ -0,0 +1,57 @@
+// 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_URL_LOADER_API_H_
+#define PPAPI_THUNK_URL_LOADER_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/ppb_url_loader.h"
+#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+struct URLRequestInfoData;
+struct URLResponseInfoData;
+
+namespace thunk {
+
+class PPB_URLLoader_API {
+ public:
+ virtual ~PPB_URLLoader_API() {}
+
+ // Open given the resource ID of a PPB_URLRequestInfo resource.
+ virtual int32_t Open(PP_Resource request_id,
+ scoped_refptr<TrackedCallback> callback) = 0;
+
+ // Internal open given a URLRequestInfoData and requestor_pid, which
+ // indicates the process that requested and will consume the data.
+ // Pass 0 for requestor_pid to indicate the current process.
+ virtual int32_t Open(const URLRequestInfoData& data,
+ int requestor_pid,
+ scoped_refptr<TrackedCallback> callback) = 0;
+
+ virtual int32_t FollowRedirect(scoped_refptr<TrackedCallback> callback) = 0;
+ virtual PP_Bool GetUploadProgress(int64_t* bytes_sent,
+ int64_t* total_bytes_to_be_sent) = 0;
+ virtual PP_Bool GetDownloadProgress(int64_t* bytes_received,
+ int64_t* total_bytes_to_be_received) = 0;
+ virtual PP_Resource GetResponseInfo() = 0;
+ virtual int32_t ReadResponseBody(void* buffer,
+ int32_t bytes_to_read,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t FinishStreamingToFile(
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual void Close() = 0;
+
+ // Trusted API.
+ virtual void GrantUniversalAccess() = 0;
+ virtual void RegisterStatusCallback(
+ PP_URLLoaderTrusted_StatusCallback cb) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_URL_LOADER_API_H_
diff --git a/chromium/ppapi/thunk/ppb_url_loader_thunk.cc b/chromium/ppapi/thunk/ppb_url_loader_thunk.cc
new file mode 100644
index 00000000000..7df78b9177c
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_url_loader_thunk.cc
@@ -0,0 +1,143 @@
+// 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.
+
+// From ppb_url_loader.idl modified Wed Apr 17 11:16:00 2013.
+
+#include <string.h>
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_url_loader.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_url_loader_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_URLLoader::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateURLLoader(instance);
+}
+
+PP_Bool IsURLLoader(PP_Resource resource) {
+ VLOG(4) << "PPB_URLLoader::IsURLLoader()";
+ EnterResource<PPB_URLLoader_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Open(PP_Resource loader,
+ PP_Resource request_info,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_URLLoader::Open()";
+ EnterResource<PPB_URLLoader_API> enter(loader, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Open(request_info, enter.callback()));
+}
+
+int32_t FollowRedirect(PP_Resource loader,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_URLLoader::FollowRedirect()";
+ EnterResource<PPB_URLLoader_API> enter(loader, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->FollowRedirect(enter.callback()));
+}
+
+PP_Bool GetUploadProgress(PP_Resource loader,
+ int64_t* bytes_sent,
+ int64_t* total_bytes_to_be_sent) {
+ VLOG(4) << "PPB_URLLoader::GetUploadProgress()";
+ EnterResource<PPB_URLLoader_API> enter(loader, true);
+ if (enter.failed()) {
+ memset(bytes_sent, 0, sizeof(*bytes_sent));
+ memset(total_bytes_to_be_sent, 0, sizeof(*total_bytes_to_be_sent));
+ return PP_FALSE;
+ }
+ return enter.object()->GetUploadProgress(bytes_sent, total_bytes_to_be_sent);
+}
+
+PP_Bool GetDownloadProgress(PP_Resource loader,
+ int64_t* bytes_received,
+ int64_t* total_bytes_to_be_received) {
+ VLOG(4) << "PPB_URLLoader::GetDownloadProgress()";
+ EnterResource<PPB_URLLoader_API> enter(loader, true);
+ if (enter.failed()) {
+ memset(bytes_received, 0, sizeof(*bytes_received));
+ memset(total_bytes_to_be_received, 0, sizeof(*total_bytes_to_be_received));
+ return PP_FALSE;
+ }
+ return enter.object()->GetDownloadProgress(bytes_received,
+ total_bytes_to_be_received);
+}
+
+PP_Resource GetResponseInfo(PP_Resource loader) {
+ VLOG(4) << "PPB_URLLoader::GetResponseInfo()";
+ EnterResource<PPB_URLLoader_API> enter(loader, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetResponseInfo();
+}
+
+int32_t ReadResponseBody(PP_Resource loader,
+ void* buffer,
+ int32_t bytes_to_read,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_URLLoader::ReadResponseBody()";
+ EnterResource<PPB_URLLoader_API> enter(loader, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->ReadResponseBody(buffer,
+ bytes_to_read,
+ enter.callback()));
+}
+
+int32_t FinishStreamingToFile(PP_Resource loader,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_URLLoader::FinishStreamingToFile()";
+ EnterResource<PPB_URLLoader_API> enter(loader, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->FinishStreamingToFile(
+ enter.callback()));
+}
+
+void Close(PP_Resource loader) {
+ VLOG(4) << "PPB_URLLoader::Close()";
+ EnterResource<PPB_URLLoader_API> enter(loader, true);
+ if (enter.failed())
+ return;
+ enter.object()->Close();
+}
+
+const PPB_URLLoader_1_0 g_ppb_urlloader_thunk_1_0 = {
+ &Create,
+ &IsURLLoader,
+ &Open,
+ &FollowRedirect,
+ &GetUploadProgress,
+ &GetDownloadProgress,
+ &GetResponseInfo,
+ &ReadResponseBody,
+ &FinishStreamingToFile,
+ &Close
+};
+
+} // namespace
+
+const PPB_URLLoader_1_0* GetPPB_URLLoader_1_0_Thunk() {
+ return &g_ppb_urlloader_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_url_loader_trusted_thunk.cc b/chromium/ppapi/thunk/ppb_url_loader_trusted_thunk.cc
new file mode 100644
index 00000000000..3082f36ed6a
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_url_loader_trusted_thunk.cc
@@ -0,0 +1,50 @@
+// 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.
+
+// From trusted/ppb_url_loader_trusted.idl modified Wed Apr 17 11:16:00 2013.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_url_loader_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void GrantUniversalAccess(PP_Resource loader) {
+ VLOG(4) << "PPB_URLLoaderTrusted::GrantUniversalAccess()";
+ EnterResource<PPB_URLLoader_API> enter(loader, true);
+ if (enter.failed())
+ return;
+ enter.object()->GrantUniversalAccess();
+}
+
+void RegisterStatusCallback(PP_Resource loader,
+ PP_URLLoaderTrusted_StatusCallback cb) {
+ VLOG(4) << "PPB_URLLoaderTrusted::RegisterStatusCallback()";
+ EnterResource<PPB_URLLoader_API> enter(loader, true);
+ if (enter.failed())
+ return;
+ enter.object()->RegisterStatusCallback(cb);
+}
+
+const PPB_URLLoaderTrusted_0_3 g_ppb_urlloadertrusted_thunk_0_3 = {
+ &GrantUniversalAccess,
+ &RegisterStatusCallback
+};
+
+} // namespace
+
+const PPB_URLLoaderTrusted_0_3* GetPPB_URLLoaderTrusted_0_3_Thunk() {
+ return &g_ppb_urlloadertrusted_thunk_0_3;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_url_request_info_api.h b/chromium/ppapi/thunk/ppb_url_request_info_api.h
new file mode 100644
index 00000000000..d9fc8c3d6eb
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_url_request_info_api.h
@@ -0,0 +1,36 @@
+// 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_THUNK_URL_REQUEST_INFO_API_H_
+#define PPAPI_THUNK_URL_REQUEST_INFO_API_H_
+
+#include "ppapi/c/ppb_url_request_info.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+struct URLRequestInfoData;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_URLRequestInfo_API {
+ public:
+ virtual ~PPB_URLRequestInfo_API() {}
+
+ virtual PP_Bool SetProperty(PP_URLRequestProperty property,
+ PP_Var var) = 0;
+ virtual PP_Bool AppendDataToBody(const void* data, uint32_t len) = 0;
+ virtual PP_Bool AppendFileToBody(PP_Resource file_ref,
+ int64_t start_offset,
+ int64_t number_of_bytes,
+ PP_Time expected_last_modified_time) = 0;
+
+ // Internal-only function for retrieving the current config.
+ virtual const URLRequestInfoData& GetData() const = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_URL_REQUEST_INFO_API_H_
diff --git a/chromium/ppapi/thunk/ppb_url_request_info_thunk.cc b/chromium/ppapi/thunk/ppb_url_request_info_thunk.cc
new file mode 100644
index 00000000000..c6a73972160
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_url_request_info_thunk.cc
@@ -0,0 +1,83 @@
+// 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.
+
+// From ppb_url_request_info.idl modified Mon Apr 1 08:24:03 2013.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_url_request_info.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_url_request_info_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_URLRequestInfo::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateURLRequestInfo(instance);
+}
+
+PP_Bool IsURLRequestInfo(PP_Resource resource) {
+ VLOG(4) << "PPB_URLRequestInfo::IsURLRequestInfo()";
+ EnterResource<PPB_URLRequestInfo_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+PP_Bool SetProperty(PP_Resource request,
+ PP_URLRequestProperty property,
+ struct PP_Var value) {
+ VLOG(4) << "PPB_URLRequestInfo::SetProperty()";
+ EnterResource<PPB_URLRequestInfo_API> enter(request, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->SetProperty(property, value);
+}
+
+PP_Bool AppendDataToBody(PP_Resource request, const void* data, uint32_t len) {
+ VLOG(4) << "PPB_URLRequestInfo::AppendDataToBody()";
+ EnterResource<PPB_URLRequestInfo_API> enter(request, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->AppendDataToBody(data, len);
+}
+
+PP_Bool AppendFileToBody(PP_Resource request,
+ PP_Resource file_ref,
+ int64_t start_offset,
+ int64_t number_of_bytes,
+ PP_Time expected_last_modified_time) {
+ VLOG(4) << "PPB_URLRequestInfo::AppendFileToBody()";
+ EnterResource<PPB_URLRequestInfo_API> enter(request, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->AppendFileToBody(file_ref,
+ start_offset,
+ number_of_bytes,
+ expected_last_modified_time);
+}
+
+const PPB_URLRequestInfo_1_0 g_ppb_urlrequestinfo_thunk_1_0 = {
+ &Create,
+ &IsURLRequestInfo,
+ &SetProperty,
+ &AppendDataToBody,
+ &AppendFileToBody
+};
+
+} // namespace
+
+const PPB_URLRequestInfo_1_0* GetPPB_URLRequestInfo_1_0_Thunk() {
+ return &g_ppb_urlrequestinfo_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_url_response_info_api.h b/chromium/ppapi/thunk/ppb_url_response_info_api.h
new file mode 100644
index 00000000000..5fea9a39c79
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_url_response_info_api.h
@@ -0,0 +1,25 @@
+// 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_THUNK_PPB_URL_RESPONSE_INFO_API_H_
+#define PPAPI_THUNK_PPB_URL_RESPONSE_INFO_API_H_
+
+#include "ppapi/c/ppb_url_response_info.h"
+#include "ppapi/shared_impl/url_response_info_data.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPB_URLResponseInfo_API {
+ public:
+ virtual ~PPB_URLResponseInfo_API() {}
+
+ virtual PP_Var GetProperty(PP_URLResponseProperty property) = 0;
+ virtual PP_Resource GetBodyAsFileRef() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_URL_LOADER_API_H_
diff --git a/chromium/ppapi/thunk/ppb_url_response_info_thunk.cc b/chromium/ppapi/thunk/ppb_url_response_info_thunk.cc
new file mode 100644
index 00000000000..fe6ef08ed3a
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_url_response_info_thunk.cc
@@ -0,0 +1,57 @@
+// 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.
+
+// From ppb_url_response_info.idl modified Thu Apr 25 13:21:08 2013.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_url_response_info.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_url_response_info_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Bool IsURLResponseInfo(PP_Resource resource) {
+ VLOG(4) << "PPB_URLResponseInfo::IsURLResponseInfo()";
+ EnterResource<PPB_URLResponseInfo_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+struct PP_Var GetProperty(PP_Resource response,
+ PP_URLResponseProperty property) {
+ VLOG(4) << "PPB_URLResponseInfo::GetProperty()";
+ EnterResource<PPB_URLResponseInfo_API> enter(response, true);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.object()->GetProperty(property);
+}
+
+PP_Resource GetBodyAsFileRef(PP_Resource response) {
+ VLOG(4) << "PPB_URLResponseInfo::GetBodyAsFileRef()";
+ EnterResource<PPB_URLResponseInfo_API> enter(response, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetBodyAsFileRef();
+}
+
+const PPB_URLResponseInfo_1_0 g_ppb_urlresponseinfo_thunk_1_0 = {
+ &IsURLResponseInfo,
+ &GetProperty,
+ &GetBodyAsFileRef
+};
+
+} // namespace
+
+const PPB_URLResponseInfo_1_0* GetPPB_URLResponseInfo_1_0_Thunk() {
+ return &g_ppb_urlresponseinfo_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_url_util_thunk.cc b/chromium/ppapi/thunk/ppb_url_util_thunk.cc
new file mode 100644
index 00000000000..3dc9f3aa4bb
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_url_util_thunk.cc
@@ -0,0 +1,74 @@
+// 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.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/ppb_url_util_shared.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Var ResolveRelativeToDocument(PP_Instance instance,
+ PP_Var relative,
+ PP_URLComponents_Dev* components) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.functions()->ResolveRelativeToDocument(instance, relative,
+ components);
+}
+
+PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->DocumentCanRequest(instance, url);
+}
+
+PP_Bool DocumentCanAccessDocument(PP_Instance active, PP_Instance target) {
+ EnterInstance enter(active);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->DocumentCanAccessDocument(active, target);
+}
+
+PP_Var GetDocumentURL(PP_Instance instance,
+ PP_URLComponents_Dev* components) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.functions()->GetDocumentURL(instance, components);
+}
+
+PP_Var GetPluginInstanceURL(PP_Instance instance,
+ PP_URLComponents_Dev* components) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.functions()->GetPluginInstanceURL(instance, components);
+}
+
+const PPB_URLUtil_Dev g_ppb_url_util = {
+ &PPB_URLUtil_Shared::Canonicalize,
+ &PPB_URLUtil_Shared::ResolveRelativeToURL,
+ &ResolveRelativeToDocument,
+ &PPB_URLUtil_Shared::IsSameSecurityOrigin,
+ &DocumentCanRequest,
+ &DocumentCanAccessDocument,
+ &GetDocumentURL,
+ &GetPluginInstanceURL
+};
+
+} // namespace
+
+const PPB_URLUtil_Dev_0_6* GetPPB_URLUtil_Dev_0_6_Thunk() {
+ return &g_ppb_url_util;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_var_array_thunk.cc b/chromium/ppapi/thunk/ppb_var_array_thunk.cc
new file mode 100644
index 00000000000..9ab52ac6ccd
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_var_array_thunk.cc
@@ -0,0 +1,74 @@
+// Copyright (c) 2013 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.
+
+#include "ppapi/c/ppb_var_array.h"
+#include "ppapi/shared_impl/array_var.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Var Create() {
+ ProxyAutoLock lock;
+
+ // Var tracker will hold a reference to this object.
+ ArrayVar* var = new ArrayVar();
+ return var->GetPPVar();
+}
+
+PP_Var Get(PP_Var array, uint32_t index) {
+ ProxyAutoLock lock;
+
+ ArrayVar* array_var = ArrayVar::FromPPVar(array);
+ if (!array_var)
+ return PP_MakeUndefined();
+ return array_var->Get(index);
+}
+
+PP_Bool Set(PP_Var array, uint32_t index, PP_Var value) {
+ ProxyAutoLock lock;
+
+ ArrayVar* array_var = ArrayVar::FromPPVar(array);
+ if (!array_var)
+ return PP_FALSE;
+ return array_var->Set(index, value);
+}
+
+uint32_t GetLength(PP_Var array) {
+ ProxyAutoLock lock;
+
+ ArrayVar* array_var = ArrayVar::FromPPVar(array);
+ if (!array_var)
+ return 0;
+ return array_var->GetLength();
+}
+
+PP_Bool SetLength(PP_Var array, uint32_t length) {
+ ProxyAutoLock lock;
+
+ ArrayVar* array_var = ArrayVar::FromPPVar(array);
+ if (!array_var)
+ return PP_FALSE;
+ return array_var->SetLength(length);
+}
+
+const PPB_VarArray_1_0 g_ppb_vararray_1_0_thunk = {
+ &Create,
+ &Get,
+ &Set,
+ &GetLength,
+ &SetLength
+};
+
+} // namespace
+
+const PPB_VarArray_1_0* GetPPB_VarArray_1_0_Thunk() {
+ return &g_ppb_vararray_1_0_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_var_dictionary_thunk.cc b/chromium/ppapi/thunk/ppb_var_dictionary_thunk.cc
new file mode 100644
index 00000000000..f2ace6516f1
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_var_dictionary_thunk.cc
@@ -0,0 +1,86 @@
+// Copyright (c) 2013 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.
+
+#include "ppapi/c/ppb_var_dictionary.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/dictionary_var.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Var Create() {
+ ProxyAutoLock lock;
+
+ // Var tracker will hold a reference to this object.
+ DictionaryVar* var = new DictionaryVar();
+ return var->GetPPVar();
+}
+
+PP_Var Get(PP_Var dict, PP_Var key) {
+ ProxyAutoLock lock;
+
+ DictionaryVar* dict_var = DictionaryVar::FromPPVar(dict);
+ if (!dict_var)
+ return PP_MakeUndefined();
+ return dict_var->Get(key);
+}
+
+PP_Bool Set(PP_Var dict, PP_Var key, PP_Var value) {
+ ProxyAutoLock lock;
+
+ DictionaryVar* dict_var = DictionaryVar::FromPPVar(dict);
+ if (!dict_var)
+ return PP_FALSE;
+
+ return dict_var->Set(key, value);
+}
+
+void Delete(PP_Var dict, PP_Var key) {
+ ProxyAutoLock lock;
+
+ DictionaryVar* dict_var = DictionaryVar::FromPPVar(dict);
+ if (dict_var)
+ dict_var->Delete(key);
+}
+
+PP_Bool HasKey(PP_Var dict, PP_Var key) {
+ ProxyAutoLock lock;
+
+ DictionaryVar* dict_var = DictionaryVar::FromPPVar(dict);
+ if (!dict_var)
+ return PP_FALSE;
+ return dict_var->HasKey(key);
+}
+
+PP_Var GetKeys(PP_Var dict) {
+ ProxyAutoLock lock;
+
+ DictionaryVar* dict_var = DictionaryVar::FromPPVar(dict);
+ if (!dict_var)
+ return PP_MakeNull();
+ return dict_var->GetKeys();
+}
+
+const PPB_VarDictionary_1_0 g_ppb_vardictionary_1_0_thunk = {
+ &Create,
+ &Get,
+ &Set,
+ &Delete,
+ &HasKey,
+ &GetKeys
+};
+
+} // namespace
+
+const PPB_VarDictionary_1_0* GetPPB_VarDictionary_1_0_Thunk() {
+ return &g_ppb_vardictionary_1_0_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_video_capture_api.h b/chromium/ppapi/thunk/ppb_video_capture_api.h
new file mode 100644
index 00000000000..baa7e00e641
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_video_capture_api.h
@@ -0,0 +1,50 @@
+// 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_VIDEO_CAPTURE_API_H_
+#define PPAPI_THUNK_VIDEO_CAPTURE_API_H_
+
+#include <string>
+#include <vector>
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/dev/ppb_video_capture_dev.h"
+#include "ppapi/c/pp_array_output.h"
+#include "ppapi/c/pp_resource.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPB_VideoCapture_API {
+ public:
+ virtual ~PPB_VideoCapture_API() {}
+
+ virtual int32_t EnumerateDevices0_2(
+ PP_Resource* devices,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t EnumerateDevices(const PP_ArrayOutput& output,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback,
+ void* user_data) = 0;
+ virtual int32_t Open(const std::string& device_id,
+ const PP_VideoCaptureDeviceInfo_Dev& requested_info,
+ uint32_t buffer_count,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t StartCapture() = 0;
+ virtual int32_t ReuseBuffer(uint32_t buffer) = 0;
+ virtual int32_t StopCapture() = 0;
+ virtual void Close() = 0;
+
+ // This function is not exposed through the C API. It is only used by flash
+ // to make synchronous device enumeration.
+ virtual int32_t EnumerateDevicesSync(const PP_ArrayOutput& devices) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_VIDEO_CAPTURE_API_H_
diff --git a/chromium/ppapi/thunk/ppb_video_capture_thunk.cc b/chromium/ppapi/thunk/ppb_video_capture_thunk.cc
new file mode 100644
index 00000000000..9d6571e8d2c
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_video_capture_thunk.cc
@@ -0,0 +1,149 @@
+// 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.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/ppb_device_ref_shared.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_device_ref_api.h"
+#include "ppapi/thunk/ppb_video_capture_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterResource<PPB_VideoCapture_API> EnterVideoCapture;
+
+PP_Resource Create(PP_Instance instance) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateVideoCapture(instance);
+}
+
+PP_Bool IsVideoCapture(PP_Resource resource) {
+ EnterVideoCapture enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t EnumerateDevices0_2(PP_Resource video_capture,
+ PP_Resource* devices,
+ PP_CompletionCallback callback) {
+ EnterVideoCapture enter(video_capture, callback, true);
+ if (enter.failed())
+ return enter.retval();
+
+ return enter.SetResult(enter.object()->EnumerateDevices0_2(devices,
+ enter.callback()));
+}
+
+int32_t EnumerateDevices(PP_Resource video_capture,
+ PP_ArrayOutput output,
+ PP_CompletionCallback callback) {
+ EnterVideoCapture enter(video_capture, callback, true);
+ if (enter.failed())
+ return enter.retval();
+
+ return enter.SetResult(enter.object()->EnumerateDevices(output,
+ enter.callback()));
+}
+
+int32_t MonitorDeviceChange(PP_Resource video_capture,
+ PP_MonitorDeviceChangeCallback callback,
+ void* user_data) {
+ EnterVideoCapture enter(video_capture, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->MonitorDeviceChange(callback, user_data);
+}
+
+int32_t Open(PP_Resource video_capture,
+ PP_Resource device_ref,
+ const PP_VideoCaptureDeviceInfo_Dev* requested_info,
+ uint32_t buffer_count,
+ PP_CompletionCallback callback) {
+ EnterVideoCapture enter(video_capture, callback, true);
+ if (enter.failed())
+ return enter.retval();
+
+ std::string device_id;
+ // |device_id| remains empty if |device_ref| is 0, which means the default
+ // device.
+ if (device_ref != 0) {
+ EnterResourceNoLock<PPB_DeviceRef_API> enter_device_ref(device_ref, true);
+ if (enter_device_ref.failed())
+ return enter.SetResult(PP_ERROR_BADRESOURCE);
+ device_id = enter_device_ref.object()->GetDeviceRefData().id;
+ }
+
+ return enter.SetResult(enter.object()->Open(
+ device_id, *requested_info, buffer_count, enter.callback()));
+}
+
+int32_t StartCapture(PP_Resource video_capture) {
+ EnterVideoCapture enter(video_capture, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->StartCapture();
+}
+
+int32_t ReuseBuffer(PP_Resource video_capture,
+ uint32_t buffer) {
+ EnterVideoCapture enter(video_capture, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->ReuseBuffer(buffer);
+}
+
+int32_t StopCapture(PP_Resource video_capture) {
+ EnterVideoCapture enter(video_capture, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->StopCapture();
+}
+
+void Close(PP_Resource video_capture) {
+ EnterVideoCapture enter(video_capture, true);
+ if (enter.succeeded())
+ enter.object()->Close();
+}
+
+const PPB_VideoCapture_Dev_0_2 g_ppb_video_capture_0_2_thunk = {
+ &Create,
+ &IsVideoCapture,
+ &EnumerateDevices0_2,
+ &Open,
+ &StartCapture,
+ &ReuseBuffer,
+ &StopCapture,
+ &Close
+};
+
+const PPB_VideoCapture_Dev_0_3 g_ppb_video_capture_0_3_thunk = {
+ &Create,
+ &IsVideoCapture,
+ &EnumerateDevices,
+ &MonitorDeviceChange,
+ &Open,
+ &StartCapture,
+ &ReuseBuffer,
+ &StopCapture,
+ &Close
+};
+
+} // namespace
+
+const PPB_VideoCapture_Dev_0_2* GetPPB_VideoCapture_Dev_0_2_Thunk() {
+ return &g_ppb_video_capture_0_2_thunk;
+}
+
+const PPB_VideoCapture_Dev_0_3* GetPPB_VideoCapture_Dev_0_3_Thunk() {
+ return &g_ppb_video_capture_0_3_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_video_decoder_api.h b/chromium/ppapi/thunk/ppb_video_decoder_api.h
new file mode 100644
index 00000000000..e26c887ebcc
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_video_decoder_api.h
@@ -0,0 +1,34 @@
+// 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_VIDEO_DECODER_API_H_
+#define PPAPI_THUNK_VIDEO_DECODER_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/dev/ppb_video_decoder_dev.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPB_VideoDecoder_API {
+ public:
+ virtual ~PPB_VideoDecoder_API() {}
+
+ virtual int32_t Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual void AssignPictureBuffers(uint32_t no_of_buffers,
+ const PP_PictureBuffer_Dev* buffers) = 0;
+ virtual void ReusePictureBuffer(int32_t picture_buffer_id) = 0;
+ virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t Reset(scoped_refptr<TrackedCallback> callback) = 0;
+ virtual void Destroy() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_VIDEO_DECODER_API_H_
diff --git a/chromium/ppapi/thunk/ppb_video_decoder_thunk.cc b/chromium/ppapi/thunk/ppb_video_decoder_thunk.cc
new file mode 100644
index 00000000000..2472d8ab321
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_video_decoder_thunk.cc
@@ -0,0 +1,96 @@
+// 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.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/thunk.h"
+#include "ppapi/thunk/ppb_video_decoder_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterResource<PPB_VideoDecoder_API> EnterVideoDecoder;
+
+PP_Resource Create(PP_Instance instance,
+ PP_Resource graphics_3d,
+ PP_VideoDecoder_Profile profile) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateVideoDecoder(instance, graphics_3d, profile);
+}
+
+PP_Bool IsVideoDecoder(PP_Resource resource) {
+ EnterVideoDecoder enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Decode(PP_Resource video_decoder,
+ const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
+ PP_CompletionCallback callback) {
+ EnterVideoDecoder enter(video_decoder, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Decode(bitstream_buffer,
+ enter.callback()));
+}
+
+void AssignPictureBuffers(PP_Resource video_decoder,
+ uint32_t no_of_buffers,
+ const PP_PictureBuffer_Dev* buffers) {
+ EnterVideoDecoder enter(video_decoder, true);
+ if (enter.succeeded())
+ enter.object()->AssignPictureBuffers(no_of_buffers, buffers);
+}
+
+void ReusePictureBuffer(PP_Resource video_decoder, int32_t picture_buffer_id) {
+ EnterVideoDecoder enter(video_decoder, true);
+ if (enter.succeeded())
+ enter.object()->ReusePictureBuffer(picture_buffer_id);
+}
+
+int32_t Flush(PP_Resource video_decoder, PP_CompletionCallback callback) {
+ EnterVideoDecoder enter(video_decoder, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Flush(enter.callback()));
+}
+
+int32_t Reset(PP_Resource video_decoder,
+ PP_CompletionCallback callback) {
+ EnterVideoDecoder enter(video_decoder, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Reset(enter.callback()));
+}
+
+void Destroy(PP_Resource video_decoder) {
+ EnterVideoDecoder enter(video_decoder, true);
+ if (enter.succeeded())
+ enter.object()->Destroy();
+}
+
+const PPB_VideoDecoder_Dev g_ppb_videodecoder_thunk = {
+ &Create,
+ &IsVideoDecoder,
+ &Decode,
+ &AssignPictureBuffers,
+ &ReusePictureBuffer,
+ &Flush,
+ &Reset,
+ &Destroy
+};
+
+} // namespace
+
+const PPB_VideoDecoder_Dev_0_16* GetPPB_VideoDecoder_Dev_0_16_Thunk() {
+ return &g_ppb_videodecoder_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_video_destination_private_api.h b/chromium/ppapi/thunk/ppb_video_destination_private_api.h
new file mode 100644
index 00000000000..49a696abac9
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_video_destination_private_api.h
@@ -0,0 +1,32 @@
+// Copyright (c) 2013 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_VIDEO_DESTINATION_PRIVATE_API_H_
+#define PPAPI_THUNK_PPB_VIDEO_DESTINATION_PRIVATE_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+struct PP_VideoFrame_Private;
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_VideoDestination_Private_API {
+ public:
+ virtual ~PPB_VideoDestination_Private_API() {}
+
+ virtual int32_t Open(const PP_Var& stream_url,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t PutFrame(const PP_VideoFrame_Private& frame) = 0;
+ virtual void Close() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_VIDEO_DESTINATION_PRIVATE_API_H_
diff --git a/chromium/ppapi/thunk/ppb_video_destination_private_thunk.cc b/chromium/ppapi/thunk/ppb_video_destination_private_thunk.cc
new file mode 100644
index 00000000000..325f0bcae23
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_video_destination_private_thunk.cc
@@ -0,0 +1,74 @@
+// Copyright (c) 2013 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.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/pp_video_frame_private.h"
+#include "ppapi/c/private/ppb_video_destination_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_video_destination_private_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateVideoDestination(instance);
+}
+
+PP_Bool IsVideoDestination(PP_Resource resource) {
+ EnterResource<PPB_VideoDestination_Private_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Open(PP_Resource destination,
+ PP_Var stream_url,
+ PP_CompletionCallback callback) {
+ EnterResource<PPB_VideoDestination_Private_API> enter(destination,
+ callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Open(stream_url, enter.callback()));
+}
+
+int32_t PutFrame(PP_Resource destination,
+ const PP_VideoFrame_Private* frame) {
+ EnterResource<PPB_VideoDestination_Private_API> enter(destination, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->PutFrame(*frame);
+}
+
+void Close(PP_Resource destination) {
+ EnterResource<PPB_VideoDestination_Private_API> enter(destination, true);
+ if (enter.succeeded())
+ enter.object()->Close();
+}
+
+const PPB_VideoDestination_Private_0_1
+ g_ppb_video_destination_private_thunk_0_1 = {
+ &Create,
+ &IsVideoDestination,
+ &Open,
+ &PutFrame,
+ &Close
+};
+
+} // namespace
+
+const PPB_VideoDestination_Private_0_1*
+ GetPPB_VideoDestination_Private_0_1_Thunk() {
+ return &g_ppb_video_destination_private_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_video_source_private_api.h b/chromium/ppapi/thunk/ppb_video_source_private_api.h
new file mode 100644
index 00000000000..c7320515134
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_video_source_private_api.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2013 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_VIDEO_SOURCE_PRIVATE_API_H_
+#define PPAPI_THUNK_PPB_VIDEO_SOURCE_PRIVATE_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+struct PP_VideoFrame_Private;
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_VideoSource_Private_API {
+ public:
+ virtual ~PPB_VideoSource_Private_API() {}
+
+ virtual int32_t Open(const PP_Var& stream_url,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t GetFrame(PP_VideoFrame_Private* frame,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual void Close() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_VIDEO_SOURCE_PRIVATE_API_H_
diff --git a/chromium/ppapi/thunk/ppb_video_source_private_thunk.cc b/chromium/ppapi/thunk/ppb_video_source_private_thunk.cc
new file mode 100644
index 00000000000..a2910a5ae5f
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_video_source_private_thunk.cc
@@ -0,0 +1,71 @@
+// Copyright (c) 2013 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.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/pp_video_frame_private.h"
+#include "ppapi/c/private/ppb_video_source_private.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_video_source_private_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateVideoSource(instance);
+}
+
+PP_Bool IsVideoSource(PP_Resource resource) {
+ EnterResource<PPB_VideoSource_Private_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Open(PP_Resource source,
+ PP_Var stream_url,
+ PP_CompletionCallback callback) {
+ EnterResource<PPB_VideoSource_Private_API> enter(source, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Open(stream_url, enter.callback()));
+}
+
+int32_t GetFrame(PP_Resource source,
+ PP_VideoFrame_Private* frame,
+ PP_CompletionCallback callback) {
+ EnterResource<PPB_VideoSource_Private_API> enter(source, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->GetFrame(frame, enter.callback()));
+}
+
+void Close(PP_Resource source) {
+ EnterResource<PPB_VideoSource_Private_API> enter(source, true);
+ if (enter.succeeded())
+ enter.object()->Close();
+}
+
+const PPB_VideoSource_Private_0_1 g_ppb_video_source_private_thunk_0_1 = {
+ &Create,
+ &IsVideoSource,
+ &Open,
+ &GetFrame,
+ &Close
+};
+
+} // namespace
+
+const PPB_VideoSource_Private_0_1* GetPPB_VideoSource_Private_0_1_Thunk() {
+ return &g_ppb_video_source_private_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_view_api.h b/chromium/ppapi/thunk/ppb_view_api.h
new file mode 100644
index 00000000000..756134422cb
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_view_api.h
@@ -0,0 +1,35 @@
+// 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_THUNK_PPB_VIEW_API_H_
+#define PPAPI_THUNK_PPB_VIEW_API_H_
+
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+struct ViewData;
+
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_View_API {
+ public:
+ virtual ~PPB_View_API() {}
+
+ // Returns the view data struct.
+ virtual const ViewData& GetData() const = 0;
+
+ virtual PP_Bool GetRect(PP_Rect* viewport) const = 0;
+ virtual PP_Bool IsFullscreen() const = 0;
+ virtual PP_Bool IsVisible() const = 0;
+ virtual PP_Bool IsPageVisible() const = 0;
+ virtual PP_Bool GetClipRect(PP_Rect* clip) const = 0;
+ virtual float GetDeviceScale() const = 0;
+ virtual float GetCSSScale() const = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_VIEW_API_H_
diff --git a/chromium/ppapi/thunk/ppb_view_dev_thunk.cc b/chromium/ppapi/thunk/ppb_view_dev_thunk.cc
new file mode 100644
index 00000000000..d3a637451ae
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_view_dev_thunk.cc
@@ -0,0 +1,49 @@
+// 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.
+
+// From dev/ppb_view_dev.idl modified Thu Mar 28 11:12:59 2013.
+
+#include "ppapi/c/dev/ppb_view_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_view_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+float GetDeviceScale(PP_Resource resource) {
+ VLOG(4) << "PPB_View_Dev::GetDeviceScale()";
+ EnterResource<PPB_View_API> enter(resource, true);
+ if (enter.failed())
+ return 0.0f;
+ return enter.object()->GetDeviceScale();
+}
+
+float GetCSSScale(PP_Resource resource) {
+ VLOG(4) << "PPB_View_Dev::GetCSSScale()";
+ EnterResource<PPB_View_API> enter(resource, true);
+ if (enter.failed())
+ return 0.0f;
+ return enter.object()->GetCSSScale();
+}
+
+const PPB_View_Dev_0_1 g_ppb_view_dev_thunk_0_1 = {
+ &GetDeviceScale,
+ &GetCSSScale
+};
+
+} // namespace
+
+const PPB_View_Dev_0_1* GetPPB_View_Dev_0_1_Thunk() {
+ return &g_ppb_view_dev_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_view_thunk.cc b/chromium/ppapi/thunk/ppb_view_thunk.cc
new file mode 100644
index 00000000000..3014099dda8
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_view_thunk.cc
@@ -0,0 +1,114 @@
+// 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.
+
+// From ppb_view.idl modified Wed Apr 10 14:15:15 2013.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_view.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_view_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Bool IsView(PP_Resource resource) {
+ VLOG(4) << "PPB_View::IsView()";
+ EnterResource<PPB_View_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+PP_Bool GetRect(PP_Resource resource, struct PP_Rect* rect) {
+ VLOG(4) << "PPB_View::GetRect()";
+ EnterResource<PPB_View_API> enter(resource, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->GetRect(rect);
+}
+
+PP_Bool IsFullscreen(PP_Resource resource) {
+ VLOG(4) << "PPB_View::IsFullscreen()";
+ EnterResource<PPB_View_API> enter(resource, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->IsFullscreen();
+}
+
+PP_Bool IsVisible(PP_Resource resource) {
+ VLOG(4) << "PPB_View::IsVisible()";
+ EnterResource<PPB_View_API> enter(resource, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->IsVisible();
+}
+
+PP_Bool IsPageVisible(PP_Resource resource) {
+ VLOG(4) << "PPB_View::IsPageVisible()";
+ EnterResource<PPB_View_API> enter(resource, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->IsPageVisible();
+}
+
+PP_Bool GetClipRect(PP_Resource resource, struct PP_Rect* clip) {
+ VLOG(4) << "PPB_View::GetClipRect()";
+ EnterResource<PPB_View_API> enter(resource, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->GetClipRect(clip);
+}
+
+float GetDeviceScale(PP_Resource resource) {
+ VLOG(4) << "PPB_View::GetDeviceScale()";
+ EnterResource<PPB_View_API> enter(resource, true);
+ if (enter.failed())
+ return 0.0f;
+ return enter.object()->GetDeviceScale();
+}
+
+float GetCSSScale(PP_Resource resource) {
+ VLOG(4) << "PPB_View::GetCSSScale()";
+ EnterResource<PPB_View_API> enter(resource, true);
+ if (enter.failed())
+ return 0.0f;
+ return enter.object()->GetCSSScale();
+}
+
+const PPB_View_1_0 g_ppb_view_thunk_1_0 = {
+ &IsView,
+ &GetRect,
+ &IsFullscreen,
+ &IsVisible,
+ &IsPageVisible,
+ &GetClipRect
+};
+
+const PPB_View_1_1 g_ppb_view_thunk_1_1 = {
+ &IsView,
+ &GetRect,
+ &IsFullscreen,
+ &IsVisible,
+ &IsPageVisible,
+ &GetClipRect,
+ &GetDeviceScale,
+ &GetCSSScale
+};
+
+} // namespace
+
+const PPB_View_1_0* GetPPB_View_1_0_Thunk() {
+ return &g_ppb_view_thunk_1_0;
+}
+
+const PPB_View_1_1* GetPPB_View_1_1_Thunk() {
+ return &g_ppb_view_thunk_1_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_websocket_api.h b/chromium/ppapi/thunk/ppb_websocket_api.h
new file mode 100644
index 00000000000..546ed99b7c8
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_websocket_api.h
@@ -0,0 +1,84 @@
+// 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_WEBSOCKET_API_H_
+#define PPAPI_THUNK_WEBSOCKET_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/ppb_websocket.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace thunk {
+
+// Some arguments and attributes are based on The WebSocket Protocol and The
+// WebSocket API. See also following official specifications.
+// - The WebSocket Protocol http://tools.ietf.org/html/rfc6455
+// - The WebSocket API http://dev.w3.org/html5/websockets/
+class PPAPI_THUNK_EXPORT PPB_WebSocket_API {
+ public:
+ virtual ~PPB_WebSocket_API() {}
+
+ // Connects to the specified WebSocket server with |protocols| argument
+ // defined by the WebSocket API. Returns an int32_t error code from
+ // pp_errors.h.
+ virtual int32_t Connect(const PP_Var& url,
+ const PP_Var protocols[],
+ uint32_t protocol_count,
+ scoped_refptr<TrackedCallback> callback) = 0;
+
+ // Closes the established connection with specified |code| and |reason|.
+ // Returns an int32_t error code from pp_errors.h.
+ virtual int32_t Close(uint16_t code,
+ const PP_Var& reason,
+ scoped_refptr<TrackedCallback> callback) = 0;
+
+ // Receives a message from the WebSocket server. Caller must keep specified
+ // |message| object as valid until completion callback is invoked. Returns an
+ // int32_t error code from pp_errors.h.
+ virtual int32_t ReceiveMessage(PP_Var* message,
+ scoped_refptr<TrackedCallback> callback) = 0;
+
+ // Sends a message to the WebSocket server. Returns an int32_t error code
+ // from pp_errors.h.
+ virtual int32_t SendMessage(const PP_Var& message) = 0;
+
+ // Returns the bufferedAmount attribute of The WebSocket API.
+ virtual uint64_t GetBufferedAmount() = 0;
+
+ // Returns the CloseEvent code attribute of The WebSocket API. Returned code
+ // is valid if the connection is already closed and wasClean attribute is
+ // true.
+ virtual uint16_t GetCloseCode() = 0;
+
+ // Returns the CloseEvent reason attribute of The WebSocket API. Returned
+ // code is valid if the connection is already closed and wasClean attribute
+ // is true.
+ virtual PP_Var GetCloseReason() = 0;
+
+ // Returns the CloseEvent wasClean attribute of The WebSocket API. Returned
+ // code is valid if the connection is already closed.
+ virtual PP_Bool GetCloseWasClean() = 0;
+
+ // Returns the extensions attribute of The WebSocket API.
+ virtual PP_Var GetExtensions() = 0;
+
+ // Returns the protocol attribute of The WebSocket API.
+ virtual PP_Var GetProtocol() = 0;
+
+ // Returns the readState attribute of The WebSocket API.
+ virtual PP_WebSocketReadyState GetReadyState() = 0;
+
+ // Returns the url attribute of The WebSocket API.
+ virtual PP_Var GetURL() = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_WEBSOCKET_API_H_
diff --git a/chromium/ppapi/thunk/ppb_websocket_thunk.cc b/chromium/ppapi/thunk/ppb_websocket_thunk.cc
new file mode 100644
index 00000000000..10406657383
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_websocket_thunk.cc
@@ -0,0 +1,169 @@
+// 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.
+
+// From ppb_websocket.idl modified Thu Feb 28 11:58:17 2013.
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_websocket.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_websocket_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ VLOG(4) << "PPB_WebSocket::Create()";
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateWebSocket(instance);
+}
+
+PP_Bool IsWebSocket(PP_Resource resource) {
+ VLOG(4) << "PPB_WebSocket::IsWebSocket()";
+ EnterResource<PPB_WebSocket_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+int32_t Connect(PP_Resource web_socket,
+ struct PP_Var url,
+ const struct PP_Var protocols[],
+ uint32_t protocol_count,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_WebSocket::Connect()";
+ EnterResource<PPB_WebSocket_API> enter(web_socket, callback, false);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Connect(url,
+ protocols,
+ protocol_count,
+ enter.callback()));
+}
+
+int32_t Close(PP_Resource web_socket,
+ uint16_t code,
+ struct PP_Var reason,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_WebSocket::Close()";
+ EnterResource<PPB_WebSocket_API> enter(web_socket, callback, false);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Close(code, reason, enter.callback()));
+}
+
+int32_t ReceiveMessage(PP_Resource web_socket,
+ struct PP_Var* message,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_WebSocket::ReceiveMessage()";
+ EnterResource<PPB_WebSocket_API> enter(web_socket, callback, false);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->ReceiveMessage(message,
+ enter.callback()));
+}
+
+int32_t SendMessage(PP_Resource web_socket, struct PP_Var message) {
+ VLOG(4) << "PPB_WebSocket::SendMessage()";
+ EnterResource<PPB_WebSocket_API> enter(web_socket, false);
+ if (enter.failed())
+ return enter.retval();
+ return enter.object()->SendMessage(message);
+}
+
+uint64_t GetBufferedAmount(PP_Resource web_socket) {
+ VLOG(4) << "PPB_WebSocket::GetBufferedAmount()";
+ EnterResource<PPB_WebSocket_API> enter(web_socket, false);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetBufferedAmount();
+}
+
+uint16_t GetCloseCode(PP_Resource web_socket) {
+ VLOG(4) << "PPB_WebSocket::GetCloseCode()";
+ EnterResource<PPB_WebSocket_API> enter(web_socket, false);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetCloseCode();
+}
+
+struct PP_Var GetCloseReason(PP_Resource web_socket) {
+ VLOG(4) << "PPB_WebSocket::GetCloseReason()";
+ EnterResource<PPB_WebSocket_API> enter(web_socket, false);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.object()->GetCloseReason();
+}
+
+PP_Bool GetCloseWasClean(PP_Resource web_socket) {
+ VLOG(4) << "PPB_WebSocket::GetCloseWasClean()";
+ EnterResource<PPB_WebSocket_API> enter(web_socket, false);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->GetCloseWasClean();
+}
+
+struct PP_Var GetExtensions(PP_Resource web_socket) {
+ VLOG(4) << "PPB_WebSocket::GetExtensions()";
+ EnterResource<PPB_WebSocket_API> enter(web_socket, false);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.object()->GetExtensions();
+}
+
+struct PP_Var GetProtocol(PP_Resource web_socket) {
+ VLOG(4) << "PPB_WebSocket::GetProtocol()";
+ EnterResource<PPB_WebSocket_API> enter(web_socket, false);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.object()->GetProtocol();
+}
+
+PP_WebSocketReadyState GetReadyState(PP_Resource web_socket) {
+ VLOG(4) << "PPB_WebSocket::GetReadyState()";
+ EnterResource<PPB_WebSocket_API> enter(web_socket, false);
+ if (enter.failed())
+ return PP_WEBSOCKETREADYSTATE_INVALID;
+ return enter.object()->GetReadyState();
+}
+
+struct PP_Var GetURL(PP_Resource web_socket) {
+ VLOG(4) << "PPB_WebSocket::GetURL()";
+ EnterResource<PPB_WebSocket_API> enter(web_socket, false);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.object()->GetURL();
+}
+
+const PPB_WebSocket_1_0 g_ppb_websocket_thunk_1_0 = {
+ &Create,
+ &IsWebSocket,
+ &Connect,
+ &Close,
+ &ReceiveMessage,
+ &SendMessage,
+ &GetBufferedAmount,
+ &GetCloseCode,
+ &GetCloseReason,
+ &GetCloseWasClean,
+ &GetExtensions,
+ &GetProtocol,
+ &GetReadyState,
+ &GetURL
+};
+
+} // namespace
+
+const PPB_WebSocket_1_0* GetPPB_WebSocket_1_0_Thunk() {
+ return &g_ppb_websocket_thunk_1_0;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_widget_api.h b/chromium/ppapi/thunk/ppb_widget_api.h
new file mode 100644
index 00000000000..26d02217e7c
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_widget_api.h
@@ -0,0 +1,27 @@
+// 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_THUNK_PPB_WIDGET_API_H_
+#define PPAPI_THUNK_PPB_WIDGET_API_H_
+
+#include "ppapi/c/dev/ppb_widget_dev.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPB_Widget_API {
+ public:
+ virtual ~PPB_Widget_API() {}
+
+ virtual PP_Bool Paint(const PP_Rect* rect, PP_Resource image_id) = 0;
+ virtual PP_Bool HandleEvent(PP_Resource pp_input_event) = 0;
+ virtual PP_Bool GetLocation(PP_Rect* location) = 0;
+ virtual void SetLocation(const PP_Rect* location) = 0;
+ virtual void SetScale(float scale) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_WIDGET_API_H_
diff --git a/chromium/ppapi/thunk/ppb_widget_dev_thunk.cc b/chromium/ppapi/thunk/ppb_widget_dev_thunk.cc
new file mode 100644
index 00000000000..2232371a69e
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_widget_dev_thunk.cc
@@ -0,0 +1,97 @@
+// 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.
+
+// From dev/ppb_widget_dev.idl modified Tue Apr 16 11:25:44 2013.
+
+#include "ppapi/c/dev/ppb_widget_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/ppb_widget_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Bool IsWidget(PP_Resource resource) {
+ VLOG(4) << "PPB_Widget_Dev::IsWidget()";
+ EnterResource<PPB_Widget_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+PP_Bool Paint(PP_Resource widget,
+ const struct PP_Rect* rect,
+ PP_Resource image) {
+ VLOG(4) << "PPB_Widget_Dev::Paint()";
+ EnterResource<PPB_Widget_API> enter(widget, false);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->Paint(rect, image);
+}
+
+PP_Bool HandleEvent(PP_Resource widget, PP_Resource input_event) {
+ VLOG(4) << "PPB_Widget_Dev::HandleEvent()";
+ EnterResource<PPB_Widget_API> enter(widget, false);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->HandleEvent(input_event);
+}
+
+PP_Bool GetLocation(PP_Resource widget, struct PP_Rect* location) {
+ VLOG(4) << "PPB_Widget_Dev::GetLocation()";
+ EnterResource<PPB_Widget_API> enter(widget, false);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->GetLocation(location);
+}
+
+void SetLocation(PP_Resource widget, const struct PP_Rect* location) {
+ VLOG(4) << "PPB_Widget_Dev::SetLocation()";
+ EnterResource<PPB_Widget_API> enter(widget, false);
+ if (enter.failed())
+ return;
+ enter.object()->SetLocation(location);
+}
+
+void SetScale(PP_Resource widget, float scale) {
+ VLOG(4) << "PPB_Widget_Dev::SetScale()";
+ EnterResource<PPB_Widget_API> enter(widget, false);
+ if (enter.failed())
+ return;
+ enter.object()->SetScale(scale);
+}
+
+const PPB_Widget_Dev_0_3 g_ppb_widget_dev_thunk_0_3 = {
+ &IsWidget,
+ &Paint,
+ &HandleEvent,
+ &GetLocation,
+ &SetLocation
+};
+
+const PPB_Widget_Dev_0_4 g_ppb_widget_dev_thunk_0_4 = {
+ &IsWidget,
+ &Paint,
+ &HandleEvent,
+ &GetLocation,
+ &SetLocation,
+ &SetScale
+};
+
+} // namespace
+
+const PPB_Widget_Dev_0_3* GetPPB_Widget_Dev_0_3_Thunk() {
+ return &g_ppb_widget_dev_thunk_0_3;
+}
+
+const PPB_Widget_Dev_0_4* GetPPB_Widget_Dev_0_4_Thunk() {
+ return &g_ppb_widget_dev_thunk_0_4;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_x509_certificate_private_api.h b/chromium/ppapi/thunk/ppb_x509_certificate_private_api.h
new file mode 100644
index 00000000000..00d0cfdd05e
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_x509_certificate_private_api.h
@@ -0,0 +1,25 @@
+// 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_X509_CERTIFICATE_PRIVATE_API_H_
+#define PPAPI_THUNK_PPB_X509_CERTIFICATE_PRIVATE_API_H_
+
+#include "ppapi/c/private/ppb_x509_certificate_private.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPAPI_THUNK_EXPORT PPB_X509Certificate_Private_API {
+ public:
+ virtual ~PPB_X509Certificate_Private_API() {}
+
+ virtual PP_Bool Initialize(const char* bytes, uint32_t length) = 0;
+ virtual PP_Var GetField(PP_X509Certificate_Private_Field field) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_PPB_X509_CERTIFICATE_PRIVATE_API_H_
diff --git a/chromium/ppapi/thunk/ppb_x509_certificate_private_thunk.cc b/chromium/ppapi/thunk/ppb_x509_certificate_private_thunk.cc
new file mode 100644
index 00000000000..50e07083341
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_x509_certificate_private_thunk.cc
@@ -0,0 +1,63 @@
+// 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.
+
+#include "ppapi/c/private/ppb_x509_certificate_private.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_x509_certificate_private_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterResource<PPB_X509Certificate_Private_API>
+ EnterX509CertificatePrivate;
+
+PP_Resource Create(PP_Instance instance) {
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateX509CertificatePrivate(instance);
+}
+
+PP_Bool IsX509CertificatePrivate(PP_Resource resource) {
+ EnterX509CertificatePrivate enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+PP_Bool Initialize(PP_Resource certificate,
+ const char *bytes,
+ uint32_t length) {
+ EnterX509CertificatePrivate enter(certificate, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->Initialize(bytes, length);
+}
+
+PP_Var GetField(PP_Resource certificate,
+ PP_X509Certificate_Private_Field field) {
+ EnterX509CertificatePrivate enter(certificate, true);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.object()->GetField(field);
+}
+
+const PPB_X509Certificate_Private g_ppb_x509_certificate_thunk = {
+ &Create,
+ &IsX509CertificatePrivate,
+ &Initialize,
+ &GetField
+};
+
+} // namespace
+
+const PPB_X509Certificate_Private_0_1*
+GetPPB_X509Certificate_Private_0_1_Thunk() {
+ return &g_ppb_x509_certificate_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/ppb_zoom_dev_thunk.cc b/chromium/ppapi/thunk/ppb_zoom_dev_thunk.cc
new file mode 100644
index 00000000000..ab0c874d107
--- /dev/null
+++ b/chromium/ppapi/thunk/ppb_zoom_dev_thunk.cc
@@ -0,0 +1,52 @@
+// 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.
+
+// From dev/ppb_zoom_dev.idl modified Wed Apr 24 13:31:08 2013.
+
+#include "ppapi/c/dev/ppb_zoom_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+void ZoomChanged(PP_Instance instance, double factor) {
+ VLOG(4) << "PPB_Zoom_Dev::ZoomChanged()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->ZoomChanged(instance, factor);
+}
+
+void ZoomLimitsChanged(PP_Instance instance,
+ double minimum_factor,
+ double maximum_factor) {
+ VLOG(4) << "PPB_Zoom_Dev::ZoomLimitsChanged()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->ZoomLimitsChanged(instance,
+ minimum_factor,
+ maximum_factor);
+}
+
+const PPB_Zoom_Dev_0_2 g_ppb_zoom_dev_thunk_0_2 = {
+ &ZoomChanged,
+ &ZoomLimitsChanged
+};
+
+} // namespace
+
+const PPB_Zoom_Dev_0_2* GetPPB_Zoom_Dev_0_2_Thunk() {
+ return &g_ppb_zoom_dev_thunk_0_2;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/chromium/ppapi/thunk/resource_creation_api.h b/chromium/ppapi/thunk/resource_creation_api.h
new file mode 100644
index 00000000000..082f1ccb070
--- /dev/null
+++ b/chromium/ppapi/thunk/resource_creation_api.h
@@ -0,0 +1,197 @@
+// 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_RESOURCE_CREATION_API_H_
+#define PPAPI_THUNK_RESOURCE_CREATION_API_H_
+
+#include "ppapi/c/dev/ppb_file_chooser_dev.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/ppb_audio.h"
+#include "ppapi/c/ppb_audio_config.h"
+#include "ppapi/c/ppb_file_system.h"
+#include "ppapi/c/ppb_graphics_3d.h"
+#include "ppapi/c/ppb_image_data.h"
+#include "ppapi/c/ppb_input_event.h"
+#include "ppapi/c/ppb_websocket.h"
+#include "ppapi/c/dev/pp_video_dev.h"
+#include "ppapi/c/dev/ppb_truetype_font_dev.h"
+#include "ppapi/c/private/pp_private_font_charset.h"
+#include "ppapi/c/private/ppb_network_monitor_private.h"
+#include "ppapi/shared_impl/api_id.h"
+#include "ppapi/shared_impl/ppb_image_data_shared.h"
+
+struct PP_Flash_Menu;
+struct PP_FontDescription_Dev;
+struct PP_BrowserFont_Trusted_Description;
+struct PP_NetAddress_IPv4;
+struct PP_NetAddress_IPv6;
+struct PP_NetAddress_Private;
+struct PP_Size;
+
+namespace ppapi {
+
+struct PPB_FileRef_CreateInfo;
+struct URLRequestInfoData;
+struct URLResponseInfoData;
+
+namespace thunk {
+
+// A functional API for creating resource types. Separating out the creation
+// functions here allows us to implement most resources as a pure "resource
+// API", meaning all calls are routed on a per-resource-object basis. The
+// creation functions are not per-object (since there's no object during
+// creation) so need functional routing based on the instance ID.
+class ResourceCreationAPI {
+ public:
+ virtual ~ResourceCreationAPI() {}
+
+ virtual PP_Resource CreateFileIO(PP_Instance instance) = 0;
+ virtual PP_Resource CreateFileRef(PP_Instance instance,
+ PP_Resource file_system,
+ const char* path) = 0;
+ // Like the above version but takes a serialized file ref. The resource
+ // in the serialized file ref is passed into this, which takes ownership of
+ // the reference. In the proxy, the return value will be a plugin resource.
+ // In the impl, the return value will be the same resource ID.
+ virtual PP_Resource CreateFileRef(
+ const PPB_FileRef_CreateInfo& serialized) = 0;
+ virtual PP_Resource CreateFileSystem(PP_Instance instance,
+ PP_FileSystemType type) = 0;
+ virtual PP_Resource CreateIsolatedFileSystem(PP_Instance instance,
+ const char* fsid) = 0;
+ virtual PP_Resource CreateIMEInputEvent(PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ struct PP_Var text,
+ uint32_t segment_number,
+ const uint32_t* segment_offsets,
+ int32_t target_segment,
+ uint32_t selection_start,
+ uint32_t selection_end) = 0;
+ virtual PP_Resource CreateKeyboardInputEvent(
+ PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ uint32_t key_code,
+ struct PP_Var character_text) = 0;
+ virtual PP_Resource CreateMouseInputEvent(
+ PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ PP_InputEvent_MouseButton mouse_button,
+ const PP_Point* mouse_position,
+ int32_t click_count,
+ const PP_Point* mouse_movement) = 0;
+ virtual PP_Resource CreateTouchInputEvent(
+ PP_Instance instance,
+ PP_InputEvent_Type type,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers) = 0;
+ virtual PP_Resource CreateResourceArray(PP_Instance instance,
+ const PP_Resource elements[],
+ uint32_t size) = 0;
+ virtual PP_Resource CreateTrueTypeFont(
+ PP_Instance instance,
+ const PP_TrueTypeFontDesc_Dev* desc) = 0;
+ virtual PP_Resource CreateURLLoader(PP_Instance instance) = 0;
+ virtual PP_Resource CreateURLRequestInfo(
+ PP_Instance instance) = 0;
+
+ virtual PP_Resource CreateWheelInputEvent(
+ PP_Instance instance,
+ PP_TimeTicks time_stamp,
+ uint32_t modifiers,
+ const PP_FloatPoint* wheel_delta,
+ const PP_FloatPoint* wheel_ticks,
+ PP_Bool scroll_by_page) = 0;
+
+ virtual PP_Resource CreateAudio(PP_Instance instance,
+ PP_Resource config_id,
+ PPB_Audio_Callback audio_callback,
+ void* user_data) = 0;
+ virtual PP_Resource CreateAudioTrusted(PP_Instance instance) = 0;
+ virtual PP_Resource CreateAudioConfig(PP_Instance instance,
+ PP_AudioSampleRate sample_rate,
+ uint32_t sample_frame_count) = 0;
+ virtual PP_Resource CreateFileChooser(PP_Instance instance,
+ PP_FileChooserMode_Dev mode,
+ const PP_Var& accept_types) = 0;
+ virtual PP_Resource CreateGraphics2D(PP_Instance instance,
+ const PP_Size* size,
+ PP_Bool is_always_opaque) = 0;
+ virtual PP_Resource CreateGraphics3D(PP_Instance instance,
+ PP_Resource share_context,
+ const int32_t* attrib_list) = 0;
+ virtual PP_Resource CreateGraphics3DRaw(PP_Instance instance,
+ PP_Resource share_context,
+ const int32_t* attrib_list) = 0;
+ virtual PP_Resource CreateHostResolver(PP_Instance instance) = 0;
+ virtual PP_Resource CreateHostResolverPrivate(PP_Instance instance) = 0;
+ virtual PP_Resource CreateImageData(PP_Instance instance,
+ PP_ImageDataFormat format,
+ const PP_Size* size,
+ PP_Bool init_to_zero) = 0;
+ virtual PP_Resource CreateImageDataSimple(PP_Instance instance,
+ PP_ImageDataFormat format,
+ const PP_Size* size,
+ PP_Bool init_to_zero) = 0;
+ virtual PP_Resource CreateNetAddressFromIPv4Address(
+ PP_Instance instance,
+ const PP_NetAddress_IPv4* ipv4_addr) = 0;
+ virtual PP_Resource CreateNetAddressFromIPv6Address(
+ PP_Instance instance,
+ const PP_NetAddress_IPv6* ipv6_addr) = 0;
+ virtual PP_Resource CreateNetAddressFromNetAddressPrivate(
+ PP_Instance instance,
+ const PP_NetAddress_Private& private_addr) = 0;
+ virtual PP_Resource CreateNetworkMonitor(
+ PP_Instance instance,
+ PPB_NetworkMonitor_Callback callback,
+ void* user_data) = 0;
+ virtual PP_Resource CreatePrinting(PP_Instance instance) = 0;
+ virtual PP_Resource CreateTCPServerSocketPrivate(PP_Instance instance) = 0;
+ virtual PP_Resource CreateTCPSocket(PP_Instance instace) = 0;
+ virtual PP_Resource CreateTCPSocketPrivate(PP_Instance instace) = 0;
+ virtual PP_Resource CreateUDPSocket(PP_Instance instace) = 0;
+ virtual PP_Resource CreateUDPSocketPrivate(PP_Instance instace) = 0;
+ virtual PP_Resource CreateVideoDestination(PP_Instance instance) = 0;
+ virtual PP_Resource CreateVideoSource(PP_Instance instance) = 0;
+ virtual PP_Resource CreateWebSocket(PP_Instance instance) = 0;
+ virtual PP_Resource CreateX509CertificatePrivate(PP_Instance instance) = 0;
+#if !defined(OS_NACL)
+ virtual PP_Resource CreateAudioInput(PP_Instance instance) = 0;
+ virtual PP_Resource CreateBroker(PP_Instance instance) = 0;
+ virtual PP_Resource CreateBrowserFont(
+ PP_Instance instance,
+ const PP_BrowserFont_Trusted_Description* description) = 0;
+ virtual PP_Resource CreateBuffer(PP_Instance instance, uint32_t size) = 0;
+ virtual PP_Resource CreateFlashDRM(PP_Instance instance) = 0;
+ virtual PP_Resource CreateFlashFontFile(
+ PP_Instance instance,
+ const PP_BrowserFont_Trusted_Description* description,
+ PP_PrivateFontCharset charset) = 0;
+ virtual PP_Resource CreateFlashMenu(PP_Instance instance,
+ const PP_Flash_Menu* menu_data) = 0;
+ virtual PP_Resource CreateFlashMessageLoop(PP_Instance instance) = 0;
+ virtual PP_Resource CreateScrollbar(PP_Instance instance,
+ PP_Bool vertical) = 0;
+ virtual PP_Resource CreateTalk(PP_Instance instance) = 0;
+ virtual PP_Resource CreateVideoCapture(PP_Instance instance) = 0;
+ virtual PP_Resource CreateVideoDecoder(
+ PP_Instance instance,
+ PP_Resource context3d_id,
+ PP_VideoDecoder_Profile profile) = 0;
+#endif // !defined(OS_NACL)
+
+ static const ApiID kApiID = API_ID_RESOURCE_CREATION;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_RESOURCE_CREATION_API_H_
diff --git a/chromium/ppapi/thunk/thunk.h b/chromium/ppapi/thunk/thunk.h
new file mode 100644
index 00000000000..f454be7368b
--- /dev/null
+++ b/chromium/ppapi/thunk/thunk.h
@@ -0,0 +1,45 @@
+// 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_THUNK_H_
+#define PPAPI_THUNK_THUNK_H_
+
+#include "ppapi/c/private/ppb_instance_private.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+// Declares a getter for the interface thunk of the form:
+//
+// const PPB_Foo* ppapi::thunk::GetPPB_Foo_Thunk();
+//
+#define IFACE(api_name, interface_name, InterfaceType) \
+ struct InterfaceType; \
+ namespace ppapi { namespace thunk { \
+ PPAPI_THUNK_EXPORT const InterfaceType* Get##InterfaceType##_Thunk(); \
+ } }
+#define PROXIED_IFACE IFACE
+#define UNPROXIED_IFACE IFACE
+
+#include "ppapi/thunk/interfaces_ppb_private.h"
+#include "ppapi/thunk/interfaces_ppb_private_no_permissions.h"
+#include "ppapi/thunk/interfaces_ppb_private_flash.h"
+#include "ppapi/thunk/interfaces_ppb_public_stable.h"
+#include "ppapi/thunk/interfaces_ppb_public_dev.h"
+
+#undef UNPROXIED_IFACE
+#undef PROXIED_IFACE
+#undef IFACE
+
+namespace ppapi {
+namespace thunk {
+
+// Old-style thunk getters. Only put trusted/private stuff here (it hasn't
+// yet been converted to the new system). Otherwise, add the declaration to
+// the appropriate interfaces_*.h file.
+PPAPI_THUNK_EXPORT const PPB_Instance_Private_0_1*
+ GetPPB_Instance_Private_0_1_Thunk();
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_THUNK_H_