Index: ppapi/native_client/src/trusted/plugin/plugin.cc |
=================================================================== |
--- ppapi/native_client/src/trusted/plugin/plugin.cc (revision 105554) |
+++ ppapi/native_client/src/trusted/plugin/plugin.cc (working copy) |
@@ -103,6 +103,10 @@ |
// for the null termination character. |
const size_t kNaClManifestMaxFileBytes = 1024 * 1024; |
+// Define an argument name to enable 'dev' interfaces. To make sure it doesn't |
+// collide with any user-defined HTML attribute, make the first character '@'. |
+const char* const kDevAttribute = "@dev"; |
sehr
2011/10/14 21:38:32
Does this naming scheme prevent JavaScript from cr
bbudge
2011/10/14 22:03:27
Added a check for this on the browser side. Thanks
|
+ |
// URL schemes that we treat in special ways. |
const char* const kChromeExtensionUriScheme = "chrome-extension"; |
const char* const kDataUriScheme = "data"; |
@@ -892,6 +896,11 @@ |
const_cast<char**>(argn), |
const_cast<char**>(argv)); |
if (status) { |
+ // Look for the developer attribute; if it's present, enable 'dev' |
+ // interfaces. |
+ const char* dev_settings = LookupArgument(kDevAttribute); |
+ enable_dev_interfaces_ = (dev_settings != NULL); |
+ |
const char* type_attr = LookupArgument(kTypeAttribute); |
if (type_attr != NULL) { |
mime_type_ = nacl::string(type_attr); |
@@ -904,7 +913,6 @@ |
// and 'nacl' will be the URL for the manifest. |
if (IsForeignMIMEType()) { |
manifest_url = LookupArgument(kNaClManifestAttribute); |
- enable_dev_interfaces_ = RequiresDevInterfaces(manifest_url); |
} |
// Use the document URL as the base for resolving relative URLs to find the |
// manifest. This takes into account the setting of <base> tags that |
@@ -1300,21 +1308,6 @@ |
} |
} |
-// Check manifest_url and return whether or not to enable PPAPI Dev interfaces. |
-// Returning true here will enable the PPAPI Dev interfaces regardless of |
-// the environment variable NACL_ENABLE_PPAPI_DEV. |
-bool Plugin::RequiresDevInterfaces(const nacl::string& manifest_url) { |
- const char* extensions[] = { |
- "chrome-extension://acadkphlmlegjaadjagenfimbpphcgnh/", // PDF |
- }; |
- for (size_t i = 0; i < sizeof(extensions) / sizeof(const char*); ++i) { |
- if (manifest_url.find(extensions[i]) == 0) { |
- return true; |
- } |
- } |
- return false; |
-} |
- |
bool Plugin::StartProxiedExecution(NaClSrpcChannel* srpc_channel, |
ErrorInfo* error_info) { |
PLUGIN_PRINTF(("Plugin::StartProxiedExecution (srpc_channel=%p)\n", |