| OLD | NEW |
| 1 // Copyright (c) 2011 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_font_proxy.h" | 5 #include "ppapi/proxy/ppb_font_proxy.h" |
| 6 | 6 |
| 7 #include "ppapi/c/dev/ppb_font_dev.h" | 7 #include "ppapi/c/dev/ppb_font_dev.h" |
| 8 #include "ppapi/proxy/plugin_dispatcher.h" | 8 #include "ppapi/proxy/plugin_dispatcher.h" |
| 9 #include "ppapi/proxy/plugin_resource.h" | 9 #include "ppapi/proxy/plugin_resource.h" |
| 10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 178 |
| 179 Dispatcher* dispatcher = PluginDispatcher::GetForInstance(object->instance()); | 179 Dispatcher* dispatcher = PluginDispatcher::GetForInstance(object->instance()); |
| 180 int32_t result = 0; | 180 int32_t result = 0; |
| 181 dispatcher->Send(new PpapiHostMsg_PPBFont_PixelOffsetForCharacter( | 181 dispatcher->Send(new PpapiHostMsg_PPBFont_PixelOffsetForCharacter( |
| 182 INTERFACE_ID_PPB_FONT, object->host_resource(), | 182 INTERFACE_ID_PPB_FONT, object->host_resource(), |
| 183 SerializedVarSendInput(dispatcher, text->text), | 183 SerializedVarSendInput(dispatcher, text->text), |
| 184 text->rtl, text->override_direction, char_offset, &result)); | 184 text->rtl, text->override_direction, char_offset, &result)); |
| 185 return result; | 185 return result; |
| 186 } | 186 } |
| 187 | 187 |
| 188 const PPB_Font_Dev ppb_font_interface = { | 188 const PPB_Font_Dev font_interface = { |
| 189 &Create, | 189 &Create, |
| 190 &IsFont, | 190 &IsFont, |
| 191 &Describe, | 191 &Describe, |
| 192 &DrawTextAt, | 192 &DrawTextAt, |
| 193 &MeasureText, | 193 &MeasureText, |
| 194 &CharacterOffsetForPixel, | 194 &CharacterOffsetForPixel, |
| 195 &PixelOffsetForCharacter | 195 &PixelOffsetForCharacter |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 InterfaceProxy* CreateFontProxy(Dispatcher* dispatcher, |
| 199 const void* target_interface) { |
| 200 return new PPB_Font_Proxy(dispatcher, target_interface); |
| 201 } |
| 202 |
| 198 } // namespace | 203 } // namespace |
| 199 | 204 |
| 200 PPB_Font_Proxy::PPB_Font_Proxy(Dispatcher* dispatcher, | 205 PPB_Font_Proxy::PPB_Font_Proxy(Dispatcher* dispatcher, |
| 201 const void* target_interface) | 206 const void* target_interface) |
| 202 : InterfaceProxy(dispatcher, target_interface) { | 207 : InterfaceProxy(dispatcher, target_interface) { |
| 203 } | 208 } |
| 204 | 209 |
| 205 PPB_Font_Proxy::~PPB_Font_Proxy() { | 210 PPB_Font_Proxy::~PPB_Font_Proxy() { |
| 206 } | 211 } |
| 207 | 212 |
| 208 const void* PPB_Font_Proxy::GetSourceInterface() const { | 213 // static |
| 209 return &ppb_font_interface; | 214 const InterfaceProxy::Info* PPB_Font_Proxy::GetInfo() { |
| 210 } | 215 static const Info info = { |
| 211 | 216 &font_interface, |
| 212 InterfaceID PPB_Font_Proxy::GetInterfaceId() const { | 217 PPB_FONT_DEV_INTERFACE, |
| 213 return INTERFACE_ID_PPB_FONT; | 218 INTERFACE_ID_PPB_FONT, |
| 219 false, |
| 220 &CreateFontProxy, |
| 221 }; |
| 222 return &info; |
| 214 } | 223 } |
| 215 | 224 |
| 216 bool PPB_Font_Proxy::OnMessageReceived(const IPC::Message& msg) { | 225 bool PPB_Font_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 217 bool handled = true; | 226 bool handled = true; |
| 218 IPC_BEGIN_MESSAGE_MAP(PPB_Font_Proxy, msg) | 227 IPC_BEGIN_MESSAGE_MAP(PPB_Font_Proxy, msg) |
| 219 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFont_Create, | 228 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFont_Create, |
| 220 OnMsgCreate) | 229 OnMsgCreate) |
| 221 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFont_DrawTextAt, | 230 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFont_DrawTextAt, |
| 222 OnMsgDrawTextAt) | 231 OnMsgDrawTextAt) |
| 223 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFont_MeasureText, | 232 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFont_MeasureText, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 run.text = text.Get(dispatcher()); | 326 run.text = text.Get(dispatcher()); |
| 318 run.rtl = text_is_rtl; | 327 run.rtl = text_is_rtl; |
| 319 run.override_direction = override_direction; | 328 run.override_direction = override_direction; |
| 320 | 329 |
| 321 *result = ppb_font_target()->PixelOffsetForCharacter(font.host_resource(), | 330 *result = ppb_font_target()->PixelOffsetForCharacter(font.host_resource(), |
| 322 &run, char_offset); | 331 &run, char_offset); |
| 323 } | 332 } |
| 324 | 333 |
| 325 } // namespace proxy | 334 } // namespace proxy |
| 326 } // namespace pp | 335 } // namespace pp |
| OLD | NEW |