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 |
158 bool handled = true; | 162 bool handled = true; |
159 IPC_BEGIN_MESSAGE_MAP(PPB_PDF_Proxy, msg) | 163 IPC_BEGIN_MESSAGE_MAP(PPB_PDF_Proxy, msg) |
160 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontFileWithFallback, | 164 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontFileWithFallback, |
161 OnMsgGetFontFileWithFallback) | 165 OnMsgGetFontFileWithFallback) |
162 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontTableForPrivateFontFile, | 166 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontTableForPrivateFontFile, |
163 OnMsgGetFontTableForPrivateFontFile) | 167 OnMsgGetFontTableForPrivateFontFile) |
164 IPC_MESSAGE_UNHANDLED(handled = false) | 168 IPC_MESSAGE_UNHANDLED(handled = false) |
165 IPC_END_MESSAGE_MAP() | 169 IPC_END_MESSAGE_MAP() |
166 // TODO(brettw): handle bad messages! | 170 // TODO(brettw): handle bad messages! |
167 return handled; | 171 return handled; |
(...skipping 25 matching lines...) Expand all Loading... |
193 font_file.host_resource(), table, NULL, &table_length)) | 197 font_file.host_resource(), table, NULL, &table_length)) |
194 return; | 198 return; |
195 | 199 |
196 result->resize(table_length); | 200 result->resize(table_length); |
197 ppb_pdf_impl_->GetFontTableForPrivateFontFile(font_file.host_resource(), | 201 ppb_pdf_impl_->GetFontTableForPrivateFontFile(font_file.host_resource(), |
198 table, const_cast<char*>(result->c_str()), &table_length); | 202 table, const_cast<char*>(result->c_str()), &table_length); |
199 } | 203 } |
200 | 204 |
201 } // namespace proxy | 205 } // namespace proxy |
202 } // namespace ppapi | 206 } // namespace ppapi |
OLD | NEW |