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 "chrome/renderer/pepper/pepper_flash_font_file_host.h" | 5 #include "chrome/renderer/pepper/pepper_flash_font_file_host.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "content/public/renderer/renderer_ppapi_host.h" | 8 #include "content/public/renderer/renderer_ppapi_host.h" |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "ppapi/host/dispatch_host_message.h" | 10 #include "ppapi/host/dispatch_host_message.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 | 51 |
52 int32_t PepperFlashFontFileHost::OnGetFontTable( | 52 int32_t PepperFlashFontFileHost::OnGetFontTable( |
53 ppapi::host::HostMessageContext* context, | 53 ppapi::host::HostMessageContext* context, |
54 uint32_t table) { | 54 uint32_t table) { |
55 std::string contents; | 55 std::string contents; |
56 int32_t result = PP_ERROR_FAILED; | 56 int32_t result = PP_ERROR_FAILED; |
57 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 57 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
58 if (fd_ != -1) { | 58 if (fd_ != -1) { |
59 size_t length = 0; | 59 size_t length = 0; |
60 if (content::GetFontTable(fd_, table, 0 /* offset */, NULL, &length)) { | 60 if (content::GetFontTable(fd_, table, NULL, &length)) { |
61 contents.resize(length); | 61 contents.resize(length); |
62 uint8_t* contents_ptr = | 62 uint8_t* contents_ptr = |
63 reinterpret_cast<uint8_t*>(const_cast<char*>(contents.c_str())); | 63 reinterpret_cast<uint8_t*>(const_cast<char*>(contents.c_str())); |
64 if (content::GetFontTable(fd_, table, 0 /* offset */, | 64 if (content::GetFontTable(fd_, table, contents_ptr, &length)) { |
65 contents_ptr, &length)) { | |
66 result = PP_OK; | 65 result = PP_OK; |
67 } else { | 66 } else { |
68 contents.clear(); | 67 contents.clear(); |
69 } | 68 } |
70 } | 69 } |
71 } | 70 } |
72 #endif // defined(OS_LINUX) || defined(OS_OPENBSD) | 71 #endif // defined(OS_LINUX) || defined(OS_OPENBSD) |
73 | 72 |
74 context->reply_msg = PpapiPluginMsg_FlashFontFile_GetFontTableReply(contents); | 73 context->reply_msg = PpapiPluginMsg_FlashFontFile_GetFontTableReply(contents); |
75 return result; | 74 return result; |
76 } | 75 } |
77 | 76 |
78 } // namespace chrome | 77 } // namespace chrome |
79 | 78 |
OLD | NEW |