OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 &pdf_interface, | 148 &pdf_interface, |
149 PPB_PDF_INTERFACE, | 149 PPB_PDF_INTERFACE, |
150 API_ID_PPB_PDF, | 150 API_ID_PPB_PDF, |
151 true, | 151 true, |
152 &CreatePDFProxy, | 152 &CreatePDFProxy, |
153 }; | 153 }; |
154 return &info; | 154 return &info; |
155 } | 155 } |
156 | 156 |
157 bool PPB_PDF_Proxy::OnMessageReceived(const IPC::Message& msg) { | 157 bool PPB_PDF_Proxy::OnMessageReceived(const IPC::Message& msg) { |
158 // This is a private interface, plugin must have permission. | |
159 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) | |
160 return false; | |
161 | |
162 bool handled = true; | 158 bool handled = true; |
163 IPC_BEGIN_MESSAGE_MAP(PPB_PDF_Proxy, msg) | 159 IPC_BEGIN_MESSAGE_MAP(PPB_PDF_Proxy, msg) |
164 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontFileWithFallback, | 160 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontFileWithFallback, |
165 OnMsgGetFontFileWithFallback) | 161 OnMsgGetFontFileWithFallback) |
166 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontTableForPrivateFontFile, | 162 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontTableForPrivateFontFile, |
167 OnMsgGetFontTableForPrivateFontFile) | 163 OnMsgGetFontTableForPrivateFontFile) |
168 IPC_MESSAGE_UNHANDLED(handled = false) | 164 IPC_MESSAGE_UNHANDLED(handled = false) |
169 IPC_END_MESSAGE_MAP() | 165 IPC_END_MESSAGE_MAP() |
170 // TODO(brettw): handle bad messages! | 166 // TODO(brettw): handle bad messages! |
171 return handled; | 167 return handled; |
(...skipping 25 matching lines...) Expand all Loading... |
197 font_file.host_resource(), table, NULL, &table_length)) | 193 font_file.host_resource(), table, NULL, &table_length)) |
198 return; | 194 return; |
199 | 195 |
200 result->resize(table_length); | 196 result->resize(table_length); |
201 ppb_pdf_impl_->GetFontTableForPrivateFontFile(font_file.host_resource(), | 197 ppb_pdf_impl_->GetFontTableForPrivateFontFile(font_file.host_resource(), |
202 table, const_cast<char*>(result->c_str()), &table_length); | 198 table, const_cast<char*>(result->c_str()), &table_length); |
203 } | 199 } |
204 | 200 |
205 } // namespace proxy | 201 } // namespace proxy |
206 } // namespace ppapi | 202 } // namespace ppapi |
OLD | NEW |