summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-09 16:59:42 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-09 16:59:42 +0000
commitac512ec99f9eb1d0aa829013651c9f653a931fb3 (patch)
treea25e89ea421542fb19e3a65e781409b2c6d5ff00 /webkit
parent3544b8333016c6eae171b3a3d8419aed7577ff65 (diff)
downloadchromium_src-ac512ec99f9eb1d0aa829013651c9f653a931fb3.zip
chromium_src-ac512ec99f9eb1d0aa829013651c9f653a931fb3.tar.gz
chromium_src-ac512ec99f9eb1d0aa829013651c9f653a931fb3.tar.bz2
Add a command line switch to enable the pepper testing interface. This moves the other switch we were using in the plugins directory to the new file as well.
TEST=covered by UI test BUG=none Review URL: http://codereview.chromium.org/2716002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49269 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/plugins/pepper_plugin_module.cc11
-rw-r--r--webkit/glue/plugins/plugin_list_posix.cc5
-rw-r--r--webkit/glue/plugins/plugin_switches.cc17
-rw-r--r--webkit/glue/plugins/plugin_switches.h20
-rw-r--r--webkit/glue/webkit_glue.gypi2
5 files changed, 51 insertions, 4 deletions
diff --git a/webkit/glue/plugins/pepper_plugin_module.cc b/webkit/glue/plugins/pepper_plugin_module.cc
index 543e6c1..99448f2 100644
--- a/webkit/glue/plugins/pepper_plugin_module.cc
+++ b/webkit/glue/plugins/pepper_plugin_module.cc
@@ -6,6 +6,7 @@
#include <set>
+#include "base/command_line.h"
#include "base/message_loop_proxy.h"
#include "base/logging.h"
#include "base/scoped_ptr.h"
@@ -126,8 +127,14 @@ const void* GetInterface(const char* name) {
return ImageData::GetInterface();
if (strcmp(name, PPB_DEVICECONTEXT2D_INTERFACE) == 0)
return DeviceContext2D::GetInterface();
- if (strcmp(name, PPB_TESTING_INTERFACE) == 0)
- return &testing_interface;
+
+ // Only support the testing interface when the command line switch is
+ // specified. This allows us to prevent people from (ab)using this interface
+ // in production code.
+ if (strcmp(name, PPB_TESTING_INTERFACE) == 0) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch("enable-pepper-testing"))
+ return &testing_interface;
+ }
return NULL;
}
diff --git a/webkit/glue/plugins/plugin_list_posix.cc b/webkit/glue/plugins/plugin_list_posix.cc
index 3a59aeb2..b787cb0 100644
--- a/webkit/glue/plugins/plugin_list_posix.cc
+++ b/webkit/glue/plugins/plugin_list_posix.cc
@@ -9,13 +9,14 @@
#include "base/path_service.h"
#include "base/string_util.h"
#include "build/build_config.h"
+#include "webkit/glue/plugins/plugin_switches.h"
namespace {
// Return true if we're in debug-plugin-loading mode.
bool DebugPluginLoading() {
- static const char kDebugPluginLoading[] = "debug-plugin-loading";
- return CommandLine::ForCurrentProcess()->HasSwitch(kDebugPluginLoading);
+ return CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDebugPluginLoading);
}
// Shorthand way of logging plugin load status.
diff --git a/webkit/glue/plugins/plugin_switches.cc b/webkit/glue/plugins/plugin_switches.cc
new file mode 100644
index 0000000..cc76917
--- /dev/null
+++ b/webkit/glue/plugins/plugin_switches.cc
@@ -0,0 +1,17 @@
+// Copyright (c) 2010 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 "webkit/glue/plugins/plugin_switches.h"
+
+namespace switches {
+
+// Enables the testing interface for PPAPI.
+const char kEnablePepperTesting[] = "enable-pepper-testing";
+
+#if defined(OS_POSIX)
+// Dumps extra logging about plugin loading to the log file.
+const char kDebugPluginLoading[] = "debug-plugin-loading";
+#endif
+
+} // namespace switches
diff --git a/webkit/glue/plugins/plugin_switches.h b/webkit/glue/plugins/plugin_switches.h
new file mode 100644
index 0000000..8c99704
--- /dev/null
+++ b/webkit/glue/plugins/plugin_switches.h
@@ -0,0 +1,20 @@
+// Copyright (c) 2010 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 WEBKIT_GLUE_PLUGINS_PLUGIN_SWITCHES_H_
+#define WEBKIT_GLUE_PLUGINS_PLUGIN_SWITCHES_H_
+
+#include "build/build_config.h"
+
+namespace switches {
+
+extern const char kEnablePepperTesting[];
+
+#if defined(OS_POSIX)
+extern const char kDebugPluginLoading[];
+#endif
+
+} // namespace switches
+
+#endif // WEBKIT_GLUE_PLUGINS_PLUGIN_SWITCHES_H_
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index 83b2a9b..6d97923 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -204,6 +204,8 @@
'plugins/plugin_string_stream.cc',
'plugins/plugin_string_stream.h',
'plugins/plugin_stubs.cc',
+ 'plugins/plugin_switches.cc',
+ 'plugins/plugin_switches.h',
'plugins/plugin_web_event_converter_mac.h',
'plugins/plugin_web_event_converter_mac.mm',
'plugins/quickdraw_drawing_manager_mac.h',