1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef PPAPI_SHARED_IMPL_PPB_CHAR_SET_SHARED_H_
6#define PPAPI_SHARED_IMPL_PPB_CHAR_SET_SHARED_H_
7
8#include "base/basictypes.h"
9#include "ppapi/c/dev/ppb_char_set_dev.h"
10#include "ppapi/c/trusted/ppb_char_set_trusted.h"
11#include "ppapi/shared_impl/ppapi_shared_export.h"
12
13namespace ppapi {
14
15// Contains the implementation of character set conversion that is shared
16// between the proxy and the renderer.
17class PPAPI_SHARED_EXPORT PPB_CharSet_Shared {
18 public:
19  static char* UTF16ToCharSetDeprecated(const uint16_t* utf16,
20                                        uint32_t utf16_len,
21                                        const char* output_char_set,
22                                        PP_CharSet_ConversionError on_error,
23                                        uint32_t* output_length);
24  static PP_Bool UTF16ToCharSet(const uint16_t utf16[],
25                                uint32_t utf16_len,
26                                const char* output_char_set,
27                                PP_CharSet_Trusted_ConversionError on_error,
28                                char* output_buffer,
29                                uint32_t* output_length);
30
31  static uint16_t* CharSetToUTF16Deprecated(const char* input,
32                                            uint32_t input_len,
33                                            const char* input_char_set,
34                                            PP_CharSet_ConversionError on_error,
35                                            uint32_t* output_length);
36  static PP_Bool CharSetToUTF16(const char* input,
37                                uint32_t input_len,
38                                const char* input_char_set,
39                                PP_CharSet_Trusted_ConversionError on_error,
40                                uint16_t* output_buffer,
41                                uint32_t* output_utf16_length);
42};
43
44}  // namespace ppapi
45
46#endif  // PPAPI_SHARED_IMPL_PPB_CHAR_SET_SHARED_H_
47