summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authordschuff@chromium.org <dschuff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-14 10:07:46 +0000
committerdschuff@chromium.org <dschuff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-14 10:07:46 +0000
commit923c116f86cfc2d1f500e0a1afbe69999297e354 (patch)
treec78c287fb0c819e44eb8a7295d88f6d527d04e56 /ppapi
parentda4756ede951255bb2a1f1c815485225a444c716 (diff)
downloadchromium_src-923c116f86cfc2d1f500e0a1afbe69999297e354.zip
chromium_src-923c116f86cfc2d1f500e0a1afbe69999297e354.tar.gz
chromium_src-923c116f86cfc2d1f500e0a1afbe69999297e354.tar.bz2
Pepper and IPC plumbing to display message to NaCl user
The goal is to display an infobar for the user when when the NaCl manifest does not have an entry for nexe usable on the user's architecture (e.g. if the user is on arm but only x86 nexes have been built). This CL is the plumbing from the NaCl plugin (which actually checks the manifest) into the browser process UI thread, which can actually do the UI. R= sehr@chromium.org/jvoung@chromium.org (plugin, nacl_host) brettw@chromium.org (ppapi/, chrome/renderer/pepper, chrome/browser/renderer_host) jschuh@chromium.org (chrome/common) BUG=154121 Review URL: https://chromiumcodereview.appspot.com/11446081 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/api/private/ppb_nacl_private.idl13
-rw-r--r--ppapi/c/private/ppb_nacl_private.h14
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.cc9
3 files changed, 35 insertions, 1 deletions
diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/ppb_nacl_private.idl
index 60821c0..aa65b97 100644
--- a/ppapi/api/private/ppb_nacl_private.idl
+++ b/ppapi/api/private/ppb_nacl_private.idl
@@ -26,6 +26,15 @@ enum PP_NaClResult {
PP_NACL_USE_SRPC = 128
};
+/** NaCl-specific errors that should be reported to the user */
+enum PP_NaClError {
+ /**
+ * The manifest program element does not contain a program usable on the
+ * user's architecture
+ */
+ PP_NACL_MANIFEST_MISSING_ARCH = 0
+};
+
/* PPB_NaCl_Private */
interface PPB_NaCl_Private {
/* Launches NaCl's sel_ldr process. Returns PP_NACL_OK on success and writes
@@ -99,4 +108,8 @@ interface PPB_NaCl_Private {
/* Return true if PNaCl is turned on.
*/
PP_Bool IsPnaclEnabled();
+
+ /* Display a UI message to the user. */
+ PP_NaClResult ReportNaClError([in] PP_Instance instance,
+ [in] PP_NaClError message_id);
};
diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h
index 5a4e2bf..42a6a71 100644
--- a/ppapi/c/private/ppb_nacl_private.h
+++ b/ppapi/c/private/ppb_nacl_private.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_nacl_private.idl modified Thu Nov 29 15:01:09 2012. */
+/* From private/ppb_nacl_private.idl modified Thu Dec 13 13:40:29 2012. */
#ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
@@ -43,6 +43,15 @@ typedef enum {
PP_NACL_USE_SRPC = 128
} PP_NaClResult;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NaClResult, 4);
+
+/** NaCl-specific errors that should be reported to the user */
+typedef enum {
+ /**
+ * The manifest program element does not contain a program usable on the
+ * user's architecture
+ */
+ PP_NACL_MANIFEST_MISSING_ARCH = 0
+} PP_NaClError;
/**
* @}
*/
@@ -115,6 +124,9 @@ struct PPB_NaCl_Private_1_0 {
/* Return true if PNaCl is turned on.
*/
PP_Bool (*IsPnaclEnabled)(void);
+ /* Display a UI message to the user. */
+ PP_NaClResult (*ReportNaClError)(PP_Instance instance,
+ PP_NaClError message_id);
};
typedef struct PPB_NaCl_Private_1_0 PPB_NaCl_Private;
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc
index 866762a..c8c9194 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -1678,6 +1678,15 @@ void Plugin::ReportLoadSuccess(LengthComputable length_computable,
void Plugin::ReportLoadError(const ErrorInfo& error_info) {
PLUGIN_PRINTF(("Plugin::ReportLoadError (error='%s')\n",
error_info.message().c_str()));
+ // For errors the user (and not just the developer) should know about,
+ // report them to the renderer so the browser can display a message.
+ if (error_info.error_code() == ERROR_MANIFEST_PROGRAM_MISSING_ARCH) {
+ // A special case: the manifest may otherwise be valid but is missing
+ // a program/file compatible with the user's sandbox.
+ nacl_interface()->ReportNaClError(pp_instance(),
+ PP_NACL_MANIFEST_MISSING_ARCH);
+ }
+
// Set the readyState attribute to indicate we need to start over.
set_nacl_ready_state(DONE);
set_nexe_error_reported(true);