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

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: Rebase Created 7 years, 3 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/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 26 matching lines...) Expand all
37 #include "ui/base/layout.h" 37 #include "ui/base/layout.h"
38 #include "ui/base/resource/resource_bundle.h" 38 #include "ui/base/resource/resource_bundle.h"
39 39
40 using ppapi::PpapiGlobals; 40 using ppapi::PpapiGlobals;
41 using WebKit::WebElement; 41 using WebKit::WebElement;
42 using WebKit::WebView; 42 using WebKit::WebView;
43 using content::RenderThread; 43 using content::RenderThread;
44 44
45 namespace { 45 namespace {
46 46
47 #if defined(OS_LINUX) || defined(OS_OPENBSD) 47 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
48 class PrivateFontFile : public ppapi::Resource { 48 class PrivateFontFile : public ppapi::Resource {
49 public: 49 public:
50 PrivateFontFile(PP_Instance instance, int fd) 50 PrivateFontFile(PP_Instance instance, int fd)
51 : Resource(ppapi::OBJECT_IS_IMPL, instance), 51 : Resource(ppapi::OBJECT_IS_IMPL, instance),
52 fd_(fd) { 52 fd_(fd) {
53 } 53 }
54 54
55 bool GetFontTable(uint32_t table, 55 bool GetFontTable(uint32_t table,
56 void* output, 56 void* output,
57 uint32_t* output_length) { 57 uint32_t* output_length) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 NOTREACHED(); 185 NOTREACHED();
186 } 186 }
187 187
188 return ppapi::StringVar::StringToPPVar(rv); 188 return ppapi::StringVar::StringToPPVar(rv);
189 } 189 }
190 190
191 PP_Resource GetFontFileWithFallback( 191 PP_Resource GetFontFileWithFallback(
192 PP_Instance instance_id, 192 PP_Instance instance_id,
193 const PP_BrowserFont_Trusted_Description* description, 193 const PP_BrowserFont_Trusted_Description* description,
194 PP_PrivateFontCharset charset) { 194 PP_PrivateFontCharset charset) {
195 #if defined(OS_LINUX) || defined(OS_OPENBSD) 195 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
196 // Validate the instance before using it below. 196 // Validate the instance before using it below.
197 if (!content::PepperPluginInstance::Get(instance_id)) 197 if (!content::PepperPluginInstance::Get(instance_id))
198 return 0; 198 return 0;
199 199
200 scoped_refptr<ppapi::StringVar> face_name(ppapi::StringVar::FromPPVar( 200 scoped_refptr<ppapi::StringVar> face_name(ppapi::StringVar::FromPPVar(
201 description->face)); 201 description->face));
202 if (!face_name.get()) 202 if (!face_name.get())
203 return 0; 203 return 0;
204 204
205 int fd = content::MatchFontWithFallback( 205 int fd = content::MatchFontWithFallback(
(...skipping 11 matching lines...) Expand all
217 // For trusted PPAPI plugins, this is only needed in Linux since font loading 217 // For trusted PPAPI plugins, this is only needed in Linux since font loading
218 // on Windows and Mac works through the renderer sandbox. 218 // on Windows and Mac works through the renderer sandbox.
219 return 0; 219 return 0;
220 #endif 220 #endif
221 } 221 }
222 222
223 bool GetFontTableForPrivateFontFile(PP_Resource font_file, 223 bool GetFontTableForPrivateFontFile(PP_Resource font_file,
224 uint32_t table, 224 uint32_t table,
225 void* output, 225 void* output,
226 uint32_t* output_length) { 226 uint32_t* output_length) {
227 #if defined(OS_LINUX) || defined(OS_OPENBSD) 227 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
228 ppapi::Resource* resource = 228 ppapi::Resource* resource =
229 PpapiGlobals::Get()->GetResourceTracker()->GetResource(font_file); 229 PpapiGlobals::Get()->GetResourceTracker()->GetResource(font_file);
230 if (!resource) 230 if (!resource)
231 return false; 231 return false;
232 232
233 PrivateFontFile* font = static_cast<PrivateFontFile*>(resource); 233 PrivateFontFile* font = static_cast<PrivateFontFile*>(resource);
234 return font->GetFontTable(table, output, output_length); 234 return font->GetFontTable(table, output, output_length);
235 #else 235 #else
236 return false; 236 return false;
237 #endif 237 #endif
(...skipping 209 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_FULL_PRINTING) 450 #if defined(ENABLE_FULL_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_FULL_PRINTING 455 #endif // ENABLE_FULL_PRINTING
456 } 456 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698