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_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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 SerializedFontDescription desc; | 69 SerializedFontDescription desc; |
70 desc.SetFromPPFontDescription(dispatcher, *description, true); | 70 desc.SetFromPPFontDescription(dispatcher, *description, true); |
71 | 71 |
72 HostResource result; | 72 HostResource result; |
73 dispatcher->Send(new PpapiHostMsg_PPBPDF_GetFontFileWithFallback( | 73 dispatcher->Send(new PpapiHostMsg_PPBPDF_GetFontFileWithFallback( |
74 INTERFACE_ID_PPB_PDF, instance, desc, charset, &result)); | 74 INTERFACE_ID_PPB_PDF, instance, desc, charset, &result)); |
75 if (result.is_null()) | 75 if (result.is_null()) |
76 return 0; | 76 return 0; |
77 | 77 |
78 linked_ptr<PrivateFontFile> object(new PrivateFontFile(result)); | 78 return PluginResourceTracker::GetInstance()->AddResource( |
79 return PluginResourceTracker::GetInstance()->AddResource(object); | 79 new PrivateFontFile(result)); |
80 } | 80 } |
81 | 81 |
82 bool GetFontTableForPrivateFontFile(PP_Resource font_file, | 82 bool GetFontTableForPrivateFontFile(PP_Resource font_file, |
83 uint32_t table, | 83 uint32_t table, |
84 void* output, | 84 void* output, |
85 uint32_t* output_length) { | 85 uint32_t* output_length) { |
86 PrivateFontFile* object = PluginResource::GetAs<PrivateFontFile>(font_file); | 86 PrivateFontFile* object = PluginResource::GetAs<PrivateFontFile>(font_file); |
87 if (!object) | 87 if (!object) |
88 return false; | 88 return false; |
89 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance( | 89 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance( |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 font_file.host_resource(), table, NULL, &table_length)) | 177 font_file.host_resource(), table, NULL, &table_length)) |
178 return; | 178 return; |
179 | 179 |
180 result->resize(table_length); | 180 result->resize(table_length); |
181 ppb_pdf_target()->GetFontTableForPrivateFontFile(font_file.host_resource(), | 181 ppb_pdf_target()->GetFontTableForPrivateFontFile(font_file.host_resource(), |
182 table, const_cast<char*>(result->c_str()), &table_length); | 182 table, const_cast<char*>(result->c_str()), &table_length); |
183 } | 183 } |
184 | 184 |
185 } // namespace proxy | 185 } // namespace proxy |
186 } // namespace pp | 186 } // namespace pp |
OLD | NEW |