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

Side by Side Diff: chrome/renderer/pepper/ppb_pdf_impl.cc

Issue 16206002: Add more support for FreeBSD (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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
OLDNEW
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/ppb_pdf_impl.h" 5 #include "chrome/renderer/pepper/ppb_pdf_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/safe_numerics.h" 9 #include "base/safe_numerics.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 using ppapi::PpapiGlobals; 43 using ppapi::PpapiGlobals;
44 using webkit::ppapi::HostGlobals; 44 using webkit::ppapi::HostGlobals;
45 using webkit::ppapi::PluginInstance; 45 using webkit::ppapi::PluginInstance;
46 using WebKit::WebElement; 46 using WebKit::WebElement;
47 using WebKit::WebView; 47 using WebKit::WebView;
48 using content::RenderThread; 48 using content::RenderThread;
49 49
50 namespace { 50 namespace {
51 51
52 #if defined(OS_LINUX) || defined(OS_OPENBSD) 52 #if defined(OS_LINUX) || defined(OS_BSD)
53 class PrivateFontFile : public ppapi::Resource { 53 class PrivateFontFile : public ppapi::Resource {
54 public: 54 public:
55 PrivateFontFile(PP_Instance instance, int fd) 55 PrivateFontFile(PP_Instance instance, int fd)
56 : Resource(ppapi::OBJECT_IS_IMPL, instance), 56 : Resource(ppapi::OBJECT_IS_IMPL, instance),
57 fd_(fd) { 57 fd_(fd) {
58 } 58 }
59 59
60 bool GetFontTable(uint32_t table, 60 bool GetFontTable(uint32_t table,
61 void* output, 61 void* output,
62 uint32_t* output_length) { 62 uint32_t* output_length) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 NOTREACHED(); 189 NOTREACHED();
190 } 190 }
191 191
192 return ppapi::StringVar::StringToPPVar(rv); 192 return ppapi::StringVar::StringToPPVar(rv);
193 } 193 }
194 194
195 PP_Resource GetFontFileWithFallback( 195 PP_Resource GetFontFileWithFallback(
196 PP_Instance instance_id, 196 PP_Instance instance_id,
197 const PP_BrowserFont_Trusted_Description* description, 197 const PP_BrowserFont_Trusted_Description* description,
198 PP_PrivateFontCharset charset) { 198 PP_PrivateFontCharset charset) {
199 #if defined(OS_LINUX) || defined(OS_OPENBSD) 199 #if defined(OS_LINUX) || defined(OS_BSD)
200 // Validate the instance before using it below. 200 // Validate the instance before using it below.
201 if (!content::GetHostGlobals()->GetInstance(instance_id)) 201 if (!content::GetHostGlobals()->GetInstance(instance_id))
202 return 0; 202 return 0;
203 203
204 scoped_refptr<ppapi::StringVar> face_name(ppapi::StringVar::FromPPVar( 204 scoped_refptr<ppapi::StringVar> face_name(ppapi::StringVar::FromPPVar(
205 description->face)); 205 description->face));
206 if (!face_name) 206 if (!face_name)
207 return 0; 207 return 0;
208 208
209 int fd = content::MatchFontWithFallback( 209 int fd = content::MatchFontWithFallback(
(...skipping 11 matching lines...) Expand all
221 // For trusted PPAPI plugins, this is only needed in Linux since font loading 221 // For trusted PPAPI plugins, this is only needed in Linux since font loading
222 // on Windows and Mac works through the renderer sandbox. 222 // on Windows and Mac works through the renderer sandbox.
223 return 0; 223 return 0;
224 #endif 224 #endif
225 } 225 }
226 226
227 bool GetFontTableForPrivateFontFile(PP_Resource font_file, 227 bool GetFontTableForPrivateFontFile(PP_Resource font_file,
228 uint32_t table, 228 uint32_t table,
229 void* output, 229 void* output,
230 uint32_t* output_length) { 230 uint32_t* output_length) {
231 #if defined(OS_LINUX) || defined(OS_OPENBSD) 231 #if defined(OS_LINUX) || defined(OS_BSD)
232 ppapi::Resource* resource = 232 ppapi::Resource* resource =
233 PpapiGlobals::Get()->GetResourceTracker()->GetResource(font_file); 233 PpapiGlobals::Get()->GetResourceTracker()->GetResource(font_file);
234 if (!resource) 234 if (!resource)
235 return false; 235 return false;
236 236
237 PrivateFontFile* font = static_cast<PrivateFontFile*>(resource); 237 PrivateFontFile* font = static_cast<PrivateFontFile*>(resource);
238 return font->GetFontTable(table, output, output_length); 238 return font->GetFontTable(table, output, output_length);
239 #else 239 #else
240 return false; 240 return false;
241 #endif 241 #endif
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 447
448 // static 448 // static
449 void PPB_PDF_Impl::InvokePrintingForInstance(PP_Instance instance_id) { 449 void PPB_PDF_Impl::InvokePrintingForInstance(PP_Instance instance_id) {
450 #if defined(ENABLE_PRINTING) 450 #if defined(ENABLE_PRINTING)
451 WebKit::WebElement element = GetWebElement(instance_id); 451 WebKit::WebElement element = GetWebElement(instance_id);
452 printing::PrintWebViewHelper* helper = GetPrintWebViewHelper(element); 452 printing::PrintWebViewHelper* helper = GetPrintWebViewHelper(element);
453 if (helper) 453 if (helper)
454 helper->PrintNode(element); 454 helper->PrintNode(element);
455 #endif // ENABLE_PRINTING 455 #endif // ENABLE_PRINTING
456 } 456 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698