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/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" | |
10 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
11 #include "build/build_config.h" | 10 #include "build/build_config.h" |
12 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/common/render_messages.h" | 12 #include "chrome/common/render_messages.h" |
14 #include "chrome/renderer/printing/print_web_view_helper.h" | 13 #include "chrome/renderer/printing/print_web_view_helper.h" |
15 #include "content/public/common/child_process_sandbox_support_linux.h" | 14 #include "content/public/common/child_process_sandbox_support_linux.h" |
16 #include "content/public/common/content_client.h" | 15 #include "content/public/common/content_client.h" |
17 #include "content/public/renderer/render_thread.h" | 16 #include "content/public/renderer/render_thread.h" |
18 #include "content/public/renderer/render_view.h" | 17 #include "content/public/renderer/render_view.h" |
19 #include "grit/webkit_resources.h" | 18 #include "grit/webkit_resources.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 PrivateFontFile(PP_Instance instance, int fd) | 54 PrivateFontFile(PP_Instance instance, int fd) |
56 : Resource(ppapi::OBJECT_IS_IMPL, instance), | 55 : Resource(ppapi::OBJECT_IS_IMPL, instance), |
57 fd_(fd) { | 56 fd_(fd) { |
58 } | 57 } |
59 | 58 |
60 bool GetFontTable(uint32_t table, | 59 bool GetFontTable(uint32_t table, |
61 void* output, | 60 void* output, |
62 uint32_t* output_length) { | 61 uint32_t* output_length) { |
63 size_t temp_size = static_cast<size_t>(*output_length); | 62 size_t temp_size = static_cast<size_t>(*output_length); |
64 bool rv = content::GetFontTable( | 63 bool rv = content::GetFontTable( |
65 fd_, table, 0 /* offset */, static_cast<uint8_t*>(output), &temp_size); | 64 fd_, table, static_cast<uint8_t*>(output), &temp_size); |
66 *output_length = base::checked_numeric_cast<uint32_t>(temp_size); | 65 *output_length = static_cast<uint32_t>(temp_size); |
67 return rv; | 66 return rv; |
68 } | 67 } |
69 | 68 |
70 protected: | 69 protected: |
71 virtual ~PrivateFontFile() {} | 70 virtual ~PrivateFontFile() {} |
72 | 71 |
73 private: | 72 private: |
74 int fd_; | 73 int fd_; |
75 }; | 74 }; |
76 #endif | 75 #endif |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 WebKit::WebElement element = instance->container()->element(); | 419 WebKit::WebElement element = instance->container()->element(); |
421 WebKit::WebView* view = element.document().frame()->view(); | 420 WebKit::WebView* view = element.document().frame()->view(); |
422 content::RenderView* render_view = content::RenderView::FromWebView(view); | 421 content::RenderView* render_view = content::RenderView::FromWebView(view); |
423 | 422 |
424 using printing::PrintWebViewHelper; | 423 using printing::PrintWebViewHelper; |
425 PrintWebViewHelper* print_view_helper = PrintWebViewHelper::Get(render_view); | 424 PrintWebViewHelper* print_view_helper = PrintWebViewHelper::Get(render_view); |
426 if (print_view_helper) | 425 if (print_view_helper) |
427 print_view_helper->PrintNode(element); | 426 print_view_helper->PrintNode(element); |
428 #endif | 427 #endif |
429 } | 428 } |
OLD | NEW |