summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-03 19:13:43 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-03 19:13:43 +0000
commit747ab0d4b60d997bc6036c4ec7d70dae6bef6c85 (patch)
tree7d6de1a2eb3900444fda347a60bbb7b63da5a9e7 /ppapi
parenta041229a7dfe1dc778a2c414b8d75351e517e172 (diff)
downloadchromium_src-747ab0d4b60d997bc6036c4ec7d70dae6bef6c85.zip
chromium_src-747ab0d4b60d997bc6036c4ec7d70dae6bef6c85.tar.gz
chromium_src-747ab0d4b60d997bc6036c4ec7d70dae6bef6c85.tar.bz2
Add a way to pass information to Pepper Flash from the command-line (e.g., for debugging).
This also adds a |ProxyModule| singleton object to the Pepper proxy, which we may eventually use for communicating directly with the browser. BUG=none TEST=none Review URL: http://codereview.chromium.org/6910007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83932 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/c/private/ppb_flash.h7
-rw-r--r--ppapi/ppapi_shared_proxy.gypi2
-rw-r--r--ppapi/proxy/ppb_flash_proxy.cc15
-rw-r--r--ppapi/proxy/proxy_module.cc32
-rw-r--r--ppapi/proxy/proxy_module.h45
5 files changed, 99 insertions, 2 deletions
diff --git a/ppapi/c/private/ppb_flash.h b/ppapi/c/private/ppb_flash.h
index a46b813..1a2f763 100644
--- a/ppapi/c/private/ppb_flash.h
+++ b/ppapi/c/private/ppb_flash.h
@@ -7,13 +7,14 @@
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_module.h"
#include "ppapi/c/pp_point.h"
#include "ppapi/c/pp_rect.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_time.h"
#include "ppapi/c/pp_var.h"
-#define PPB_FLASH_INTERFACE "PPB_Flash;10"
+#define PPB_FLASH_INTERFACE "PPB_Flash;11"
struct PPB_Flash {
// Sets or clears the rendering hint that the given plugin instance is always
@@ -55,6 +56,10 @@ struct PPB_Flash {
// Retrieves the local time zone offset from GM time for the given UTC time.
double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t);
+
+ // Gets a (string) with "command-line" options for Flash; used to pass
+ // run-time debugging parameters, etc.
+ struct PP_Var (*GetCommandLineArgs)(PP_Module module);
};
#endif // PPAPI_C_PRIVATE_PPB_FLASH_H_
diff --git a/ppapi/ppapi_shared_proxy.gypi b/ppapi/ppapi_shared_proxy.gypi
index 9ce1401..c02ba86 100644
--- a/ppapi/ppapi_shared_proxy.gypi
+++ b/ppapi/ppapi_shared_proxy.gypi
@@ -161,6 +161,8 @@
'proxy/ppp_instance_proxy.h',
'proxy/proxy_channel.cc',
'proxy/proxy_channel.h',
+ 'proxy/proxy_module.cc',
+ 'proxy/proxy_module.h',
'proxy/serialized_flash_menu.cc',
'proxy/serialized_flash_menu.h',
'proxy/serialized_structs.cc',
diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc
index fab5fd3..27c83ba 100644
--- a/ppapi/proxy/ppb_flash_proxy.cc
+++ b/ppapi/proxy/ppb_flash_proxy.cc
@@ -8,6 +8,7 @@
#include "base/message_loop.h"
#include "base/time.h"
#include "ppapi/c/dev/ppb_font_dev.h"
+#include "ppapi/c/dev/ppb_var_deprecated.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/private/ppb_flash.h"
@@ -15,6 +16,7 @@
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/plugin_resource.h"
#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/proxy_module.h"
#include "ppapi/proxy/serialized_var.h"
namespace pp {
@@ -145,6 +147,16 @@ double GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
return result;
}
+PP_Var GetCommandLineArgs(PP_Module pp_module) {
+ const PPB_Var_Deprecated* var_deprecated =
+ static_cast<const PPB_Var_Deprecated*>(
+ PluginDispatcher::GetInterfaceFromDispatcher(
+ PPB_VAR_DEPRECATED_INTERFACE));
+ std::string args =
+ pp::proxy::ProxyModule::GetInstance()->GetFlashCommandLineArgs();
+ return var_deprecated->VarFromUtf8(pp_module, args.data(), args.length());
+}
+
const PPB_Flash flash_interface = {
&SetInstanceAlwaysOnTop,
&DrawGlyphs,
@@ -152,7 +164,8 @@ const PPB_Flash flash_interface = {
&Navigate,
&RunMessageLoop,
&QuitMessageLoop,
- &GetLocalTimeZoneOffset
+ &GetLocalTimeZoneOffset,
+ &GetCommandLineArgs
};
InterfaceProxy* CreateFlashProxy(Dispatcher* dispatcher,
diff --git a/ppapi/proxy/proxy_module.cc b/ppapi/proxy/proxy_module.cc
new file mode 100644
index 0000000..94de0c1
--- /dev/null
+++ b/ppapi/proxy/proxy_module.cc
@@ -0,0 +1,32 @@
+// 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.
+
+#include "ppapi/proxy/proxy_module.h"
+
+#include "base/memory/singleton.h"
+
+namespace pp {
+namespace proxy {
+
+ProxyModule::ProxyModule() {
+}
+
+ProxyModule::~ProxyModule() {
+}
+
+// static
+ProxyModule* ProxyModule::GetInstance() {
+ return Singleton<ProxyModule>::get();
+}
+
+const std::string& ProxyModule::GetFlashCommandLineArgs() {
+ return flash_command_line_args_;
+}
+
+void ProxyModule::SetFlashCommandLineArgs(const std::string& args) {
+ flash_command_line_args_ = args;
+}
+
+} // namespace proxy
+} // namespace pp
diff --git a/ppapi/proxy/proxy_module.h b/ppapi/proxy/proxy_module.h
new file mode 100644
index 0000000..304f24f
--- /dev/null
+++ b/ppapi/proxy/proxy_module.h
@@ -0,0 +1,45 @@
+// 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_PROXY_PROXY_MODULE_H_
+#define PPAPI_PROXY_PROXY_MODULE_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+
+template<typename T> struct DefaultSingletonTraits;
+
+namespace pp {
+namespace proxy {
+
+class PluginDispatcher;
+class PluginResource;
+
+class ProxyModule {
+ public:
+ // The global singleton getter.
+ static ProxyModule* GetInstance();
+
+ // TODO(viettrungluu): Generalize this for use with other plugins if it proves
+ // necessary. (Currently, we can't do this easily, since we can't tell from
+ // |PpapiPluginMain()| which plugin will be loaded.)
+ const std::string& GetFlashCommandLineArgs();
+ void SetFlashCommandLineArgs(const std::string& args);
+
+ private:
+ friend struct DefaultSingletonTraits<ProxyModule>;
+
+ std::string flash_command_line_args_;
+
+ ProxyModule();
+ ~ProxyModule();
+
+ DISALLOW_COPY_AND_ASSIGN(ProxyModule);
+};
+
+} // namespace proxy
+} // namespace pp
+
+#endif // PPAPI_PROXY_PROXY_MODULE_H_