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 "content/renderer/pepper/pepper_plugin_instance_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bit_cast.h" | 10 #include "base/bit_cast.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 #include "ppapi/shared_impl/ppb_view_shared.h" | 86 #include "ppapi/shared_impl/ppb_view_shared.h" |
87 #include "ppapi/shared_impl/ppp_instance_combined.h" | 87 #include "ppapi/shared_impl/ppp_instance_combined.h" |
88 #include "ppapi/shared_impl/resource.h" | 88 #include "ppapi/shared_impl/resource.h" |
89 #include "ppapi/shared_impl/scoped_pp_resource.h" | 89 #include "ppapi/shared_impl/scoped_pp_resource.h" |
90 #include "ppapi/shared_impl/scoped_pp_var.h" | 90 #include "ppapi/shared_impl/scoped_pp_var.h" |
91 #include "ppapi/shared_impl/time_conversion.h" | 91 #include "ppapi/shared_impl/time_conversion.h" |
92 #include "ppapi/shared_impl/url_request_info_data.h" | 92 #include "ppapi/shared_impl/url_request_info_data.h" |
93 #include "ppapi/shared_impl/var.h" | 93 #include "ppapi/shared_impl/var.h" |
94 #include "ppapi/thunk/enter.h" | 94 #include "ppapi/thunk/enter.h" |
95 #include "ppapi/thunk/ppb_buffer_api.h" | 95 #include "ppapi/thunk/ppb_buffer_api.h" |
| 96 #include "printing/features/features.h" |
96 #include "skia/ext/platform_canvas.h" | 97 #include "skia/ext/platform_canvas.h" |
97 #include "third_party/WebKit/public/platform/URLConversion.h" | 98 #include "third_party/WebKit/public/platform/URLConversion.h" |
98 #include "third_party/WebKit/public/platform/WebCursorInfo.h" | 99 #include "third_party/WebKit/public/platform/WebCursorInfo.h" |
99 #include "third_party/WebKit/public/platform/WebFloatRect.h" | 100 #include "third_party/WebKit/public/platform/WebFloatRect.h" |
100 #include "third_party/WebKit/public/platform/WebGamepads.h" | 101 #include "third_party/WebKit/public/platform/WebGamepads.h" |
101 #include "third_party/WebKit/public/platform/WebRect.h" | 102 #include "third_party/WebKit/public/platform/WebRect.h" |
102 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 103 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
103 #include "third_party/WebKit/public/platform/WebString.h" | 104 #include "third_party/WebKit/public/platform/WebString.h" |
104 #include "third_party/WebKit/public/platform/WebURL.h" | 105 #include "third_party/WebKit/public/platform/WebURL.h" |
105 #include "third_party/WebKit/public/platform/WebURLError.h" | 106 #include "third_party/WebKit/public/platform/WebURLError.h" |
(...skipping 14 matching lines...) Expand all Loading... |
120 #include "third_party/WebKit/public/web/WebView.h" | 121 #include "third_party/WebKit/public/web/WebView.h" |
121 #include "third_party/khronos/GLES2/gl2.h" | 122 #include "third_party/khronos/GLES2/gl2.h" |
122 #include "ui/events/blink/blink_event_util.h" | 123 #include "ui/events/blink/blink_event_util.h" |
123 #include "ui/gfx/geometry/rect_conversions.h" | 124 #include "ui/gfx/geometry/rect_conversions.h" |
124 #include "ui/gfx/image/image_skia.h" | 125 #include "ui/gfx/image/image_skia.h" |
125 #include "ui/gfx/image/image_skia_rep.h" | 126 #include "ui/gfx/image/image_skia_rep.h" |
126 #include "ui/gfx/range/range.h" | 127 #include "ui/gfx/range/range.h" |
127 #include "url/origin.h" | 128 #include "url/origin.h" |
128 #include "v8/include/v8.h" | 129 #include "v8/include/v8.h" |
129 | 130 |
130 #if defined(ENABLE_PRINTING) | 131 #if BUILDFLAG(ENABLE_PRINTING) |
131 // nogncheck because dependency on //printing is conditional upon | 132 // nogncheck because dependency on //printing is conditional upon |
132 // enable_basic_printing or enable_print_preview flags. | 133 // enable_basic_printing or enable_print_preview flags. |
133 #include "printing/metafile_skia_wrapper.h" // nogncheck | 134 #include "printing/metafile_skia_wrapper.h" // nogncheck |
134 #include "printing/pdf_metafile_skia.h" // nogncheck | 135 #include "printing/pdf_metafile_skia.h" // nogncheck |
135 #endif | 136 #endif |
136 | 137 |
137 #if defined(OS_CHROMEOS) | 138 #if defined(OS_CHROMEOS) |
138 #include "ui/events/keycodes/keyboard_codes_posix.h" | 139 #include "ui/events/keycodes/keyboard_codes_posix.h" |
139 #endif | 140 #endif |
140 | 141 |
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1797 if (!num_pages) | 1798 if (!num_pages) |
1798 return 0; | 1799 return 0; |
1799 current_print_settings_ = print_settings; | 1800 current_print_settings_ = print_settings; |
1800 canvas_.reset(); | 1801 canvas_.reset(); |
1801 ranges_.clear(); | 1802 ranges_.clear(); |
1802 return num_pages; | 1803 return num_pages; |
1803 } | 1804 } |
1804 | 1805 |
1805 void PepperPluginInstanceImpl::PrintPage(int page_number, | 1806 void PepperPluginInstanceImpl::PrintPage(int page_number, |
1806 blink::WebCanvas* canvas) { | 1807 blink::WebCanvas* canvas) { |
1807 #if defined(ENABLE_PRINTING) | 1808 #if BUILDFLAG(ENABLE_PRINTING) |
1808 DCHECK(plugin_print_interface_); | 1809 DCHECK(plugin_print_interface_); |
1809 PP_PrintPageNumberRange_Dev page_range; | 1810 PP_PrintPageNumberRange_Dev page_range; |
1810 page_range.first_page_number = page_range.last_page_number = page_number; | 1811 page_range.first_page_number = page_range.last_page_number = page_number; |
1811 // The canvas only has a metafile on it for print preview. | 1812 // The canvas only has a metafile on it for print preview. |
1812 bool save_for_later = | 1813 bool save_for_later = |
1813 (printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas) != NULL); | 1814 (printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas) != NULL); |
1814 #if defined(OS_MACOSX) | 1815 #if defined(OS_MACOSX) |
1815 save_for_later = save_for_later && skia::IsPreviewMetafile(*canvas); | 1816 save_for_later = save_for_later && skia::IsPreviewMetafile(*canvas); |
1816 #endif // defined(OS_MACOSX) | 1817 #endif // defined(OS_MACOSX) |
1817 if (save_for_later) { | 1818 if (save_for_later) { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2011 return false; | 2012 return false; |
2012 WebView* view = frame->view(); | 2013 WebView* view = frame->view(); |
2013 if (!view) | 2014 if (!view) |
2014 return false; | 2015 return false; |
2015 | 2016 |
2016 return view->isAcceleratedCompositingActive(); | 2017 return view->isAcceleratedCompositingActive(); |
2017 } | 2018 } |
2018 | 2019 |
2019 bool PepperPluginInstanceImpl::PrintPDFOutput(PP_Resource print_output, | 2020 bool PepperPluginInstanceImpl::PrintPDFOutput(PP_Resource print_output, |
2020 blink::WebCanvas* canvas) { | 2021 blink::WebCanvas* canvas) { |
2021 #if defined(ENABLE_PRINTING) | 2022 #if BUILDFLAG(ENABLE_PRINTING) |
2022 ppapi::thunk::EnterResourceNoLock<PPB_Buffer_API> enter(print_output, true); | 2023 ppapi::thunk::EnterResourceNoLock<PPB_Buffer_API> enter(print_output, true); |
2023 if (enter.failed()) | 2024 if (enter.failed()) |
2024 return false; | 2025 return false; |
2025 | 2026 |
2026 BufferAutoMapper mapper(enter.object()); | 2027 BufferAutoMapper mapper(enter.object()); |
2027 if (!mapper.data() || !mapper.size()) { | 2028 if (!mapper.data() || !mapper.size()) { |
2028 NOTREACHED(); | 2029 NOTREACHED(); |
2029 return false; | 2030 return false; |
2030 } | 2031 } |
2031 | 2032 |
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3435 const cc::TextureMailbox& mailbox) const { | 3436 const cc::TextureMailbox& mailbox) const { |
3436 auto it = | 3437 auto it = |
3437 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), | 3438 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), |
3438 [&mailbox](const TextureMailboxRefCount& ref_count) { | 3439 [&mailbox](const TextureMailboxRefCount& ref_count) { |
3439 return ref_count.first.mailbox() == mailbox.mailbox(); | 3440 return ref_count.first.mailbox() == mailbox.mailbox(); |
3440 }); | 3441 }); |
3441 return it != texture_ref_counts_.end(); | 3442 return it != texture_ref_counts_.end(); |
3442 } | 3443 } |
3443 | 3444 |
3444 } // namespace content | 3445 } // namespace content |
OLD | NEW |