Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: ppapi/proxy/ppb_pdf_proxy.cc

Issue 8333004: Rename InterfaceID to ApiID and move the file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_instance_proxy.cc ('k') | ppapi/proxy/ppb_surface_3d_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
68 PP_PrivateFontCharset charset) { 68 PP_PrivateFontCharset charset) {
69 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 69 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
70 if (!dispatcher) 70 if (!dispatcher)
71 return 0; 71 return 0;
72 72
73 SerializedFontDescription desc; 73 SerializedFontDescription desc;
74 desc.SetFromPPFontDescription(dispatcher, *description, true); 74 desc.SetFromPPFontDescription(dispatcher, *description, true);
75 75
76 HostResource result; 76 HostResource result;
77 dispatcher->Send(new PpapiHostMsg_PPBPDF_GetFontFileWithFallback( 77 dispatcher->Send(new PpapiHostMsg_PPBPDF_GetFontFileWithFallback(
78 INTERFACE_ID_PPB_PDF, instance, desc, charset, &result)); 78 API_ID_PPB_PDF, instance, desc, charset, &result));
79 if (result.is_null()) 79 if (result.is_null())
80 return 0; 80 return 0;
81 return (new PrivateFontFile(result))->GetReference(); 81 return (new PrivateFontFile(result))->GetReference();
82 } 82 }
83 83
84 bool GetFontTableForPrivateFontFile(PP_Resource font_file, 84 bool GetFontTableForPrivateFontFile(PP_Resource font_file,
85 uint32_t table, 85 uint32_t table,
86 void* output, 86 void* output,
87 uint32_t* output_length) { 87 uint32_t* output_length) {
88 EnterResource<PPB_PDFFont_API> enter(font_file, true); 88 EnterResource<PPB_PDFFont_API> enter(font_file, true);
89 if (enter.failed()) 89 if (enter.failed())
90 return false; 90 return false;
91 91
92 PrivateFontFile* object = static_cast<PrivateFontFile*>(enter.object()); 92 PrivateFontFile* object = static_cast<PrivateFontFile*>(enter.object());
93 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance( 93 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(
94 object->pp_instance()); 94 object->pp_instance());
95 if (!dispatcher) 95 if (!dispatcher)
96 return false; 96 return false;
97 97
98 std::string* contents = object->GetFontTable(table); 98 std::string* contents = object->GetFontTable(table);
99 if (!contents) { 99 if (!contents) {
100 std::string deserialized; 100 std::string deserialized;
101 dispatcher->Send(new PpapiHostMsg_PPBPDF_GetFontTableForPrivateFontFile( 101 dispatcher->Send(new PpapiHostMsg_PPBPDF_GetFontTableForPrivateFontFile(
102 INTERFACE_ID_PPB_PDF, object->host_resource(), table, &deserialized)); 102 API_ID_PPB_PDF, object->host_resource(), table, &deserialized));
103 if (deserialized.empty()) 103 if (deserialized.empty())
104 return false; 104 return false;
105 contents = object->AddFontTable(table, deserialized); 105 contents = object->AddFontTable(table, deserialized);
106 } 106 }
107 107
108 *output_length = static_cast<uint32_t>(contents->size()); 108 *output_length = static_cast<uint32_t>(contents->size());
109 if (output) 109 if (output)
110 memcpy(output, contents->c_str(), *output_length); 110 memcpy(output, contents->c_str(), *output_length);
111 return true; 111 return true;
112 } 112 }
(...skipping 21 matching lines...) Expand all
134 } 134 }
135 135
136 PPB_PDF_Proxy::~PPB_PDF_Proxy() { 136 PPB_PDF_Proxy::~PPB_PDF_Proxy() {
137 } 137 }
138 138
139 // static 139 // static
140 const InterfaceProxy::Info* PPB_PDF_Proxy::GetInfo() { 140 const InterfaceProxy::Info* PPB_PDF_Proxy::GetInfo() {
141 static const Info info = { 141 static const Info info = {
142 &pdf_interface, 142 &pdf_interface,
143 PPB_PDF_INTERFACE, 143 PPB_PDF_INTERFACE,
144 INTERFACE_ID_PPB_PDF, 144 API_ID_PPB_PDF,
145 true, 145 true,
146 &CreatePDFProxy, 146 &CreatePDFProxy,
147 }; 147 };
148 return &info; 148 return &info;
149 } 149 }
150 150
151 bool PPB_PDF_Proxy::OnMessageReceived(const IPC::Message& msg) { 151 bool PPB_PDF_Proxy::OnMessageReceived(const IPC::Message& msg) {
152 bool handled = true; 152 bool handled = true;
153 IPC_BEGIN_MESSAGE_MAP(PPB_PDF_Proxy, msg) 153 IPC_BEGIN_MESSAGE_MAP(PPB_PDF_Proxy, msg)
154 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontFileWithFallback, 154 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontFileWithFallback,
(...skipping 29 matching lines...) Expand all
184 font_file.host_resource(), table, NULL, &table_length)) 184 font_file.host_resource(), table, NULL, &table_length))
185 return; 185 return;
186 186
187 result->resize(table_length); 187 result->resize(table_length);
188 ppb_pdf_impl_->GetFontTableForPrivateFontFile(font_file.host_resource(), 188 ppb_pdf_impl_->GetFontTableForPrivateFontFile(font_file.host_resource(),
189 table, const_cast<char*>(result->c_str()), &table_length); 189 table, const_cast<char*>(result->c_str()), &table_length);
190 } 190 }
191 191
192 } // namespace proxy 192 } // namespace proxy
193 } // namespace ppapi 193 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_instance_proxy.cc ('k') | ppapi/proxy/ppb_surface_3d_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698