OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PPAPI_PROXY_PPB_CHAR_SET_PROXY_H_ | 5 #ifndef PPAPI_PROXY_PPB_CHAR_SET_PROXY_H_ |
6 #define PPAPI_PROXY_PPB_CHAR_SET_PROXY_H_ | 6 #define PPAPI_PROXY_PPB_CHAR_SET_PROXY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | |
9 #include "ppapi/c/pp_instance.h" | 8 #include "ppapi/c/pp_instance.h" |
10 #include "ppapi/c/pp_resource.h" | 9 #include "ppapi/c/pp_resource.h" |
11 #include "ppapi/proxy/interface_proxy.h" | 10 #include "ppapi/proxy/interface_proxy.h" |
12 | 11 |
13 struct PPB_CharSet_Dev; | 12 struct PPB_CharSet_Dev; |
14 struct PPB_Core; | 13 struct PPB_Core; |
15 | 14 |
16 namespace pp { | 15 namespace pp { |
17 namespace proxy { | 16 namespace proxy { |
18 | 17 |
19 class SerializedVarReturnValue; | 18 class SerializedVarReturnValue; |
20 | 19 |
21 class PPB_CharSet_Proxy : public InterfaceProxy { | 20 class PPB_CharSet_Proxy : public InterfaceProxy { |
22 public: | 21 public: |
23 PPB_CharSet_Proxy(Dispatcher* dispatcher, const void* target_interface); | 22 PPB_CharSet_Proxy(Dispatcher* dispatcher, const void* target_interface); |
24 virtual ~PPB_CharSet_Proxy(); | 23 virtual ~PPB_CharSet_Proxy(); |
25 | 24 |
26 static const Info* GetInfo(); | 25 static const Info* GetInfo(); |
27 | 26 |
28 const PPB_CharSet_Dev* ppb_char_set_target() const { | 27 const PPB_CharSet_Dev* ppb_char_set_target() const { |
29 return static_cast<const PPB_CharSet_Dev*>(target_interface()); | 28 return static_cast<const PPB_CharSet_Dev*>(target_interface()); |
30 } | 29 } |
31 | 30 |
32 // InterfaceProxy implementation. | 31 // InterfaceProxy implementation. |
33 virtual bool OnMessageReceived(const IPC::Message& msg); | 32 virtual bool OnMessageReceived(const IPC::Message& msg); |
34 | 33 |
35 private: | 34 private: |
36 // Message handlers. | |
37 void OnMsgUTF16ToCharSet(PP_Instance instance, | |
38 const string16& utf16, | |
39 const std::string& char_set, | |
40 int32_t on_error, | |
41 std::string* output, | |
42 bool* output_is_success); | |
43 void OnMsgCharSetToUTF16(PP_Instance instance, | |
44 const std::string& input, | |
45 const std::string& char_set, | |
46 int32_t on_error, | |
47 string16* output, | |
48 bool* output_is_success); | |
49 void OnMsgGetDefaultCharSet(PP_Instance instance, | 35 void OnMsgGetDefaultCharSet(PP_Instance instance, |
50 SerializedVarReturnValue result); | 36 SerializedVarReturnValue result); |
51 | 37 |
52 // Returns the local PPB_Core interface for freeing strings. | |
53 const PPB_Core* GetCoreInterface(); | |
54 | |
55 // Possibly NULL, lazily initialized by GetCoreInterface. | |
56 const PPB_Core* core_interface_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(PPB_CharSet_Proxy); | 38 DISALLOW_COPY_AND_ASSIGN(PPB_CharSet_Proxy); |
59 }; | 39 }; |
60 | 40 |
61 } // namespace proxy | 41 } // namespace proxy |
62 } // namespace pp | 42 } // namespace pp |
63 | 43 |
64 #endif // PPAPI_PROXY_PPB_CHAR_SET_PROXY_H_ | 44 #endif // PPAPI_PROXY_PPB_CHAR_SET_PROXY_H_ |
OLD | NEW |