| 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_pdf_proxy.h" | 5 #include "ppapi/proxy/ppb_pdf_proxy.h" |
| 6 | 6 |
| 7 #include <string.h> // For memcpy. | 7 #include <string.h> // For memcpy. |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 } | 118 } |
| 119 | 119 |
| 120 const void* PPB_PDF_Proxy::GetSourceInterface() const { | 120 const void* PPB_PDF_Proxy::GetSourceInterface() const { |
| 121 return &ppb_pdf; | 121 return &ppb_pdf; |
| 122 } | 122 } |
| 123 | 123 |
| 124 InterfaceID PPB_PDF_Proxy::GetInterfaceId() const { | 124 InterfaceID PPB_PDF_Proxy::GetInterfaceId() const { |
| 125 return INTERFACE_ID_PPB_PDF; | 125 return INTERFACE_ID_PPB_PDF; |
| 126 } | 126 } |
| 127 | 127 |
| 128 void PPB_PDF_Proxy::OnMessageReceived(const IPC::Message& msg) { | 128 bool PPB_PDF_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 129 bool handled = true; |
| 129 IPC_BEGIN_MESSAGE_MAP(PPB_PDF_Proxy, msg) | 130 IPC_BEGIN_MESSAGE_MAP(PPB_PDF_Proxy, msg) |
| 130 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontFileWithFallback, | 131 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontFileWithFallback, |
| 131 OnMsgGetFontFileWithFallback) | 132 OnMsgGetFontFileWithFallback) |
| 132 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontTableForPrivateFontFile, | 133 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontTableForPrivateFontFile, |
| 133 OnMsgGetFontTableForPrivateFontFile) | 134 OnMsgGetFontTableForPrivateFontFile) |
| 135 IPC_MESSAGE_UNHANDLED(handled = false) |
| 134 IPC_END_MESSAGE_MAP() | 136 IPC_END_MESSAGE_MAP() |
| 135 // TODO(brettw): handle bad messages! | 137 // TODO(brettw): handle bad messages! |
| 138 return handled; |
| 136 } | 139 } |
| 137 | 140 |
| 138 void PPB_PDF_Proxy::OnMsgGetFontFileWithFallback( | 141 void PPB_PDF_Proxy::OnMsgGetFontFileWithFallback( |
| 139 PP_Module module, | 142 PP_Module module, |
| 140 const SerializedFontDescription& in_desc, | 143 const SerializedFontDescription& in_desc, |
| 141 int32_t charset, | 144 int32_t charset, |
| 142 PP_Resource* result) { | 145 PP_Resource* result) { |
| 143 PP_FontDescription_Dev desc; | 146 PP_FontDescription_Dev desc; |
| 144 in_desc.SetToPPFontDescription(dispatcher(), &desc, false); | 147 in_desc.SetToPPFontDescription(dispatcher(), &desc, false); |
| 145 *result = ppb_pdf_target()->GetFontFileWithFallback(module, &desc, | 148 *result = ppb_pdf_target()->GetFontFileWithFallback(module, &desc, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 156 font_file, table, NULL, &table_length)) | 159 font_file, table, NULL, &table_length)) |
| 157 return; | 160 return; |
| 158 | 161 |
| 159 result->resize(table_length); | 162 result->resize(table_length); |
| 160 ppb_pdf_target()->GetFontTableForPrivateFontFile(font_file, table, | 163 ppb_pdf_target()->GetFontTableForPrivateFontFile(font_file, table, |
| 161 const_cast<char*>(result->c_str()), &table_length); | 164 const_cast<char*>(result->c_str()), &table_length); |
| 162 } | 165 } |
| 163 | 166 |
| 164 } // namespace proxy | 167 } // namespace proxy |
| 165 } // namespace pp | 168 } // namespace pp |
| OLD | NEW |