| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| 11 #include "ppapi/proxy/serialized_var.h" | 11 #include "ppapi/proxy/serialized_var.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 72 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 73 if (!dispatcher) | 73 if (!dispatcher) |
| 74 return PP_MakeUndefined(); | 74 return PP_MakeUndefined(); |
| 75 | 75 |
| 76 ReceiveSerializedVarReturnValue result; | 76 ReceiveSerializedVarReturnValue result; |
| 77 dispatcher->Send(new PpapiHostMsg_PPBCharSet_GetDefaultCharSet( | 77 dispatcher->Send(new PpapiHostMsg_PPBCharSet_GetDefaultCharSet( |
| 78 INTERFACE_ID_PPB_CHAR_SET, instance, &result)); | 78 INTERFACE_ID_PPB_CHAR_SET, instance, &result)); |
| 79 return result.Return(dispatcher); | 79 return result.Return(dispatcher); |
| 80 } | 80 } |
| 81 | 81 |
| 82 const PPB_CharSet_Dev ppb_charset_interface = { | 82 const PPB_CharSet_Dev charset_interface = { |
| 83 &UTF16ToCharSet, | 83 &UTF16ToCharSet, |
| 84 &CharSetToUTF16, | 84 &CharSetToUTF16, |
| 85 &GetDefaultCharSet | 85 &GetDefaultCharSet |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 InterfaceProxy* CreateCharSetProxy(Dispatcher* dispatcher, |
| 89 const void* target_interface) { |
| 90 return new PPB_CharSet_Proxy(dispatcher, target_interface); |
| 91 } |
| 92 |
| 88 } // namespace | 93 } // namespace |
| 89 | 94 |
| 90 PPB_CharSet_Proxy::PPB_CharSet_Proxy(Dispatcher* dispatcher, | 95 PPB_CharSet_Proxy::PPB_CharSet_Proxy(Dispatcher* dispatcher, |
| 91 const void* target_interface) | 96 const void* target_interface) |
| 92 : InterfaceProxy(dispatcher, target_interface), | 97 : InterfaceProxy(dispatcher, target_interface), |
| 93 core_interface_(NULL) { | 98 core_interface_(NULL) { |
| 94 } | 99 } |
| 95 | 100 |
| 96 PPB_CharSet_Proxy::~PPB_CharSet_Proxy() { | 101 PPB_CharSet_Proxy::~PPB_CharSet_Proxy() { |
| 97 } | 102 } |
| 98 | 103 |
| 99 const void* PPB_CharSet_Proxy::GetSourceInterface() const { | 104 // static |
| 100 return &ppb_charset_interface; | 105 const InterfaceProxy::Info* PPB_CharSet_Proxy::GetInfo() { |
| 101 } | 106 static const Info info = { |
| 102 | 107 &charset_interface, |
| 103 InterfaceID PPB_CharSet_Proxy::GetInterfaceId() const { | 108 PPB_CHAR_SET_DEV_INTERFACE, |
| 104 return INTERFACE_ID_PPB_CHAR_SET; | 109 INTERFACE_ID_PPB_CHAR_SET, |
| 110 false, |
| 111 &CreateCharSetProxy, |
| 112 }; |
| 113 return &info; |
| 105 } | 114 } |
| 106 | 115 |
| 107 bool PPB_CharSet_Proxy::OnMessageReceived(const IPC::Message& msg) { | 116 bool PPB_CharSet_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 108 bool handled = true; | 117 bool handled = true; |
| 109 IPC_BEGIN_MESSAGE_MAP(PPB_CharSet_Proxy, msg) | 118 IPC_BEGIN_MESSAGE_MAP(PPB_CharSet_Proxy, msg) |
| 110 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_UTF16ToCharSet, | 119 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_UTF16ToCharSet, |
| 111 OnMsgUTF16ToCharSet) | 120 OnMsgUTF16ToCharSet) |
| 112 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_CharSetToUTF16, | 121 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_CharSetToUTF16, |
| 113 OnMsgCharSetToUTF16) | 122 OnMsgCharSetToUTF16) |
| 114 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_GetDefaultCharSet, | 123 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_GetDefaultCharSet, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 const PPB_Core* PPB_CharSet_Proxy::GetCoreInterface() { | 178 const PPB_Core* PPB_CharSet_Proxy::GetCoreInterface() { |
| 170 if (!core_interface_) { | 179 if (!core_interface_) { |
| 171 core_interface_ = static_cast<const PPB_Core*>( | 180 core_interface_ = static_cast<const PPB_Core*>( |
| 172 dispatcher()->GetLocalInterface(PPB_CORE_INTERFACE)); | 181 dispatcher()->GetLocalInterface(PPB_CORE_INTERFACE)); |
| 173 } | 182 } |
| 174 return core_interface_; | 183 return core_interface_; |
| 175 } | 184 } |
| 176 | 185 |
| 177 } // namespace proxy | 186 } // namespace proxy |
| 178 } // namespace pp | 187 } // namespace pp |
| OLD | NEW |