| 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 #include "ppapi/proxy/ppb_char_set_proxy.h" | 5 #include "ppapi/proxy/ppb_char_set_proxy.h" |
| 6 | 6 |
| 7 #include "ppapi/c/dev/ppb_char_set_dev.h" | 7 #include "ppapi/c/dev/ppb_char_set_dev.h" |
| 8 #include "ppapi/c/ppb_core.h" | 8 #include "ppapi/c/ppb_core.h" |
| 9 #include "ppapi/proxy/plugin_dispatcher.h" | 9 #include "ppapi/proxy/plugin_dispatcher.h" |
| 10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 | 82 |
| 83 const void* PPB_CharSet_Proxy::GetSourceInterface() const { | 83 const void* PPB_CharSet_Proxy::GetSourceInterface() const { |
| 84 return &ppb_charset_interface; | 84 return &ppb_charset_interface; |
| 85 } | 85 } |
| 86 | 86 |
| 87 InterfaceID PPB_CharSet_Proxy::GetInterfaceId() const { | 87 InterfaceID PPB_CharSet_Proxy::GetInterfaceId() const { |
| 88 return INTERFACE_ID_PPB_CHAR_SET; | 88 return INTERFACE_ID_PPB_CHAR_SET; |
| 89 } | 89 } |
| 90 | 90 |
| 91 void PPB_CharSet_Proxy::OnMessageReceived(const IPC::Message& msg) { | 91 bool PPB_CharSet_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 92 bool handled = true; |
| 92 IPC_BEGIN_MESSAGE_MAP(PPB_CharSet_Proxy, msg) | 93 IPC_BEGIN_MESSAGE_MAP(PPB_CharSet_Proxy, msg) |
| 93 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_UTF16ToCharSet, | 94 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_UTF16ToCharSet, |
| 94 OnMsgUTF16ToCharSet) | 95 OnMsgUTF16ToCharSet) |
| 95 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_CharSetToUTF16, | 96 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_CharSetToUTF16, |
| 96 OnMsgCharSetToUTF16) | 97 OnMsgCharSetToUTF16) |
| 97 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_GetDefaultCharSet, | 98 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_GetDefaultCharSet, |
| 98 OnMsgGetDefaultCharSet) | 99 OnMsgGetDefaultCharSet) |
| 100 IPC_MESSAGE_UNHANDLED(handled = false) |
| 99 IPC_END_MESSAGE_MAP() | 101 IPC_END_MESSAGE_MAP() |
| 102 return handled; |
| 100 } | 103 } |
| 101 | 104 |
| 102 void PPB_CharSet_Proxy::OnMsgUTF16ToCharSet(const string16& utf16, | 105 void PPB_CharSet_Proxy::OnMsgUTF16ToCharSet(const string16& utf16, |
| 103 const std::string& char_set, | 106 const std::string& char_set, |
| 104 int32_t on_error, | 107 int32_t on_error, |
| 105 std::string* output, | 108 std::string* output, |
| 106 bool* output_is_success) { | 109 bool* output_is_success) { |
| 107 uint32_t output_len = 0; | 110 uint32_t output_len = 0; |
| 108 char* result = ppb_char_set_target()->UTF16ToCharSet( | 111 char* result = ppb_char_set_target()->UTF16ToCharSet( |
| 109 reinterpret_cast<const uint16_t*>(utf16.c_str()), | 112 reinterpret_cast<const uint16_t*>(utf16.c_str()), |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 const PPB_Core* PPB_CharSet_Proxy::GetCoreInterface() { | 151 const PPB_Core* PPB_CharSet_Proxy::GetCoreInterface() { |
| 149 if (!core_interface_) { | 152 if (!core_interface_) { |
| 150 core_interface_ = static_cast<const PPB_Core*>( | 153 core_interface_ = static_cast<const PPB_Core*>( |
| 151 dispatcher()->GetLocalInterface(PPB_CORE_INTERFACE)); | 154 dispatcher()->GetLocalInterface(PPB_CORE_INTERFACE)); |
| 152 } | 155 } |
| 153 return core_interface_; | 156 return core_interface_; |
| 154 } | 157 } |
| 155 | 158 |
| 156 } // namespace proxy | 159 } // namespace proxy |
| 157 } // namespace pp | 160 } // namespace pp |
| OLD | NEW |