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 |
11 #include "base/linked_ptr.h" | 11 #include "base/linked_ptr.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "ppapi/proxy/plugin_dispatcher.h" | 14 #include "ppapi/proxy/plugin_dispatcher.h" |
15 #include "ppapi/proxy/plugin_resource.h" | 15 #include "ppapi/proxy/plugin_resource.h" |
16 #include "ppapi/proxy/ppapi_messages.h" | 16 #include "ppapi/proxy/ppapi_messages.h" |
17 #include "webkit/glue/plugins/ppb_private.h" | 17 #include "webkit/plugins/ppapi/ppb_pdf.h" |
18 | 18 |
19 namespace pp { | 19 namespace pp { |
20 namespace proxy { | 20 namespace proxy { |
21 | 21 |
22 class PrivateFontFile : public PluginResource { | 22 class PrivateFontFile : public PluginResource { |
23 public: | 23 public: |
24 PrivateFontFile() {} | 24 PrivateFontFile() {} |
25 virtual ~PrivateFontFile() {} | 25 virtual ~PrivateFontFile() {} |
26 | 26 |
27 // Resource overrides. | 27 // Resource overrides. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 return false; | 93 return false; |
94 contents = object->AddFontTable(table, deserialized); | 94 contents = object->AddFontTable(table, deserialized); |
95 } | 95 } |
96 | 96 |
97 *output_length = static_cast<uint32_t>(contents->size()); | 97 *output_length = static_cast<uint32_t>(contents->size()); |
98 if (output) | 98 if (output) |
99 memcpy(output, contents->c_str(), *output_length); | 99 memcpy(output, contents->c_str(), *output_length); |
100 return true; | 100 return true; |
101 } | 101 } |
102 | 102 |
103 const PPB_Private ppb_private = { | 103 const PPB_Pdf ppb_pdf = { |
104 NULL, // &GetLocalizedString, | 104 NULL, // &GetLocalizedString, |
105 NULL, // &GetResourceImage, | 105 NULL, // &GetResourceImage, |
106 &GetFontFileWithFallback, | 106 &GetFontFileWithFallback, |
107 &GetFontTableForPrivateFontFile, | 107 &GetFontTableForPrivateFontFile, |
108 }; | 108 }; |
109 | 109 |
110 } // namespace | 110 } // namespace |
111 | 111 |
112 PPB_Pdf_Proxy::PPB_Pdf_Proxy(Dispatcher* dispatcher, | 112 PPB_Pdf_Proxy::PPB_Pdf_Proxy(Dispatcher* dispatcher, |
113 const void* target_interface) | 113 const void* target_interface) |
114 : InterfaceProxy(dispatcher, target_interface) { | 114 : InterfaceProxy(dispatcher, target_interface) { |
115 } | 115 } |
116 | 116 |
117 PPB_Pdf_Proxy::~PPB_Pdf_Proxy() { | 117 PPB_Pdf_Proxy::~PPB_Pdf_Proxy() { |
118 } | 118 } |
119 | 119 |
120 const void* PPB_Pdf_Proxy::GetSourceInterface() const { | 120 const void* PPB_Pdf_Proxy::GetSourceInterface() const { |
121 return &ppb_private; | 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 void PPB_Pdf_Proxy::OnMessageReceived(const IPC::Message& msg) { |
129 IPC_BEGIN_MESSAGE_MAP(PPB_Pdf_Proxy, msg) | 129 IPC_BEGIN_MESSAGE_MAP(PPB_Pdf_Proxy, msg) |
130 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPdf_GetFontFileWithFallback, | 130 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPdf_GetFontFileWithFallback, |
131 OnMsgGetFontFileWithFallback) | 131 OnMsgGetFontFileWithFallback) |
(...skipping 24 matching lines...) Expand all Loading... |
156 font_file, table, NULL, &table_length)) | 156 font_file, table, NULL, &table_length)) |
157 return; | 157 return; |
158 | 158 |
159 result->resize(table_length); | 159 result->resize(table_length); |
160 ppb_pdf_target()->GetFontTableForPrivateFontFile(font_file, table, | 160 ppb_pdf_target()->GetFontTableForPrivateFontFile(font_file, table, |
161 const_cast<char*>(result->c_str()), &table_length); | 161 const_cast<char*>(result->c_str()), &table_length); |
162 } | 162 } |
163 | 163 |
164 } // namespace proxy | 164 } // namespace proxy |
165 } // namespace pp | 165 } // namespace pp |
OLD | NEW |