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 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "ppapi/c/private/ppb_pdf.h" | 14 #include "ppapi/c/private/ppb_pdf.h" |
15 #include "ppapi/proxy/plugin_dispatcher.h" | 15 #include "ppapi/proxy/plugin_dispatcher.h" |
16 #include "ppapi/proxy/plugin_resource_tracker.h" | 16 #include "ppapi/proxy/plugin_resource_tracker.h" |
17 #include "ppapi/proxy/ppapi_messages.h" | 17 #include "ppapi/proxy/ppapi_messages.h" |
18 #include "ppapi/thunk/enter.h" | 18 #include "ppapi/thunk/enter.h" |
19 #include "ppapi/thunk/ppb_pdf_api.h" | 19 #include "ppapi/thunk/ppb_pdf_api.h" |
20 | 20 |
21 using ppapi::thunk::PPB_PDFFont_API; | 21 using ppapi::thunk::PPB_PDFFont_API; |
22 using ppapi::thunk::EnterResource; | 22 using ppapi::thunk::EnterResource; |
23 | 23 |
24 namespace ppapi { | 24 namespace ppapi { |
25 namespace proxy { | 25 namespace proxy { |
26 | 26 |
27 class PrivateFontFile : public Resource, | 27 class PrivateFontFile : public Resource, |
28 public PPB_PDFFont_API { | 28 public PPB_PDFFont_API { |
29 public: | 29 public: |
30 PrivateFontFile(const HostResource& resource) : Resource(resource) { | 30 PrivateFontFile(const HostResource& resource) |
| 31 : Resource(OBJECT_IS_PROXY, resource) { |
31 } | 32 } |
32 virtual ~PrivateFontFile() {} | 33 virtual ~PrivateFontFile() {} |
33 | 34 |
34 PPB_PDFFont_API* AsPPB_PDFFont_API() { return this; } | 35 PPB_PDFFont_API* AsPPB_PDFFont_API() { return this; } |
35 | 36 |
36 // Sees if we have a cache of the font table and returns a pointer to it. | 37 // Sees if we have a cache of the font table and returns a pointer to it. |
37 // Returns NULL if we don't have it. | 38 // Returns NULL if we don't have it. |
38 std::string* GetFontTable(uint32_t table) const; | 39 std::string* GetFontTable(uint32_t table) const; |
39 | 40 |
40 std::string* AddFontTable(uint32_t table, const std::string& contents); | 41 std::string* AddFontTable(uint32_t table, const std::string& contents); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 font_file.host_resource(), table, NULL, &table_length)) | 185 font_file.host_resource(), table, NULL, &table_length)) |
185 return; | 186 return; |
186 | 187 |
187 result->resize(table_length); | 188 result->resize(table_length); |
188 ppb_pdf_impl_->GetFontTableForPrivateFontFile(font_file.host_resource(), | 189 ppb_pdf_impl_->GetFontTableForPrivateFontFile(font_file.host_resource(), |
189 table, const_cast<char*>(result->c_str()), &table_length); | 190 table, const_cast<char*>(result->c_str()), &table_length); |
190 } | 191 } |
191 | 192 |
192 } // namespace proxy | 193 } // namespace proxy |
193 } // namespace ppapi | 194 } // namespace ppapi |
OLD | NEW |