summaryrefslogtreecommitdiffstats
path: root/ppapi/api/trusted
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-09 02:11:19 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-09 02:11:19 +0000
commit5aebe523df04a15f1cfb096206f32e6e84e76cfc (patch)
tree249cbf710c2c91f75567b46f1f32517d2986e3e9 /ppapi/api/trusted
parentb217e399f84ee905915db9006f57ce18da0e9b59 (diff)
downloadchromium_src-5aebe523df04a15f1cfb096206f32e6e84e76cfc.zip
chromium_src-5aebe523df04a15f1cfb096206f32e6e84e76cfc.tar.gz
chromium_src-5aebe523df04a15f1cfb096206f32e6e84e76cfc.tar.bz2
Move the charset inteface to "trusted" (we can't implement this efficiently
in NaCl) and modify to no longer require the memory interface. This keeps the old interface and implements it in terms of the newer one. We can remove it when all callers have been updated. BUG= TEST= Review URL: http://codereview.chromium.org/9348069 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121159 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/api/trusted')
-rw-r--r--ppapi/api/trusted/ppb_char_set_trusted.idl95
1 files changed, 95 insertions, 0 deletions
diff --git a/ppapi/api/trusted/ppb_char_set_trusted.idl b/ppapi/api/trusted/ppb_char_set_trusted.idl
new file mode 100644
index 0000000..61bd8d5
--- /dev/null
+++ b/ppapi/api/trusted/ppb_char_set_trusted.idl
@@ -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.
+ */
+
+/*
+ * This file defines the <code>PPB_CharSet_Trusted</code> interface.
+ */
+
+label Chrome {
+ M18 = 1.0
+};
+
+[assert_size(4)] enum PP_CharSet_Trusted_ConversionError {
+ /**
+ * Causes the entire conversion to fail if an error is encountered. The
+ * conversion function will return NULL.
+ */
+ PP_CHARSET_TRUSTED_CONVERSIONERROR_FAIL,
+
+ /**
+ * Silently skips over errors. Unrepresentable characters and input encoding
+ * errors will be removed from the output.
+ */
+ PP_CHARSET_TRUSTED_CONVERSIONERROR_SKIP,
+
+ /**
+ * Replaces the error or unrepresentable character with a substitution
+ * character. When converting to a Unicode character set (UTF-8 or UTF-16) it
+ * will use the unicode "substitution character" U+FFFD. When converting to
+ * another character set, the character will be charset-specific. For many
+ * languages this will be the representation of the '?' character.
+ */
+ PP_CHARSET_TRUSTED_CONVERSIONERROR_SUBSTITUTE
+};
+
+/**
+ * The <code>PPB_CharSet_Trusted</code> interface provides functions for
+ * converting between character sets.
+ *
+ * This inteface is provided for trusted plugins only since in Native Client it
+ * would require an expensive out-of-process IPC call for each conversion,
+ * which makes performance unacceptable. Native Client plugins should include
+ * ICU or some other library if they need this feature.
+ */
+interface PPB_CharSet_Trusted {
+ /**
+ * Converts the UTF-16 string pointed to by |*utf16| to an 8-bit string in
+ * the specified code page. |utf16_len| is measured in UTF-16 units, not
+ * bytes. This value may not be NULL.
+ *
+ * The given output buffer will be filled up to output_length bytes with the
+ * result. output_length will be updated with the number of bytes required
+ * for the given string. The output buffer may be null to just retrieve the
+ * required buffer length.
+ *
+ * This function will return PP_FALSE if there was an error converting the
+ * string and you requested PP_CHARSET_CONVERSIONERROR_FAIL, or the output
+ * character set was unknown. Otherwise, it will return PP_TRUE.
+ */
+ PP_Bool UTF16ToCharSet([in, size_as=utf16_len] uint16_t[] utf16,
+ [in] uint32_t utf16_len,
+ [in] str_t output_char_set,
+ [in] PP_CharSet_Trusted_ConversionError on_error,
+ [out] str_t output_buffer,
+ [inout] uint32_t output_length);
+
+ /**
+ * Same as UTF16ToCharSet except converts in the other direction. The input
+ * is in the given charset, and the |input_len| is the number of bytes in
+ * the |input| string.
+ *
+ * Note that the output_utf16_length is measured in UTF-16 characters.
+ *
+ * Since UTF16 can represent every Unicode character, the only time the
+ * replacement character will be used is if the encoding in the input string
+ * is incorrect.
+ */
+ PP_Bool CharSetToUTF16([in] str_t input,
+ [in] uint32_t input_len,
+ [in] str_t input_char_set,
+ [in] PP_CharSet_Trusted_ConversionError on_error,
+ [out] uint16_t output_buffer,
+ [inout] uint32_t output_utf16_length);
+
+ /**
+ * Returns a string var representing the current multi-byte character set of
+ * the current system.
+ *
+ * WARNING: You really shouldn't be using this function unless you're dealing
+ * with legacy data. You should be using UTF-8 or UTF-16 and you don't have
+ * to worry about the character sets.
+ */
+ PP_Var GetDefaultCharSet([in] PP_Instance instance);
+};