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

Side by Side Diff: content/renderer/pepper/pepper_plugin_instance_impl.cc

Issue 375253002: [Chrome] Support NumCopies print preset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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 "content/renderer/pepper/pepper_plugin_instance_impl.h" 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 #include "third_party/WebKit/public/platform/WebURLError.h" 105 #include "third_party/WebKit/public/platform/WebURLError.h"
106 #include "third_party/WebKit/public/platform/WebURLRequest.h" 106 #include "third_party/WebKit/public/platform/WebURLRequest.h"
107 #include "third_party/WebKit/public/web/WebBindings.h" 107 #include "third_party/WebKit/public/web/WebBindings.h"
108 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" 108 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
109 #include "third_party/WebKit/public/web/WebDataSource.h" 109 #include "third_party/WebKit/public/web/WebDataSource.h"
110 #include "third_party/WebKit/public/web/WebDocument.h" 110 #include "third_party/WebKit/public/web/WebDocument.h"
111 #include "third_party/WebKit/public/web/WebInputEvent.h" 111 #include "third_party/WebKit/public/web/WebInputEvent.h"
112 #include "third_party/WebKit/public/web/WebLocalFrame.h" 112 #include "third_party/WebKit/public/web/WebLocalFrame.h"
113 #include "third_party/WebKit/public/web/WebPluginContainer.h" 113 #include "third_party/WebKit/public/web/WebPluginContainer.h"
114 #include "third_party/WebKit/public/web/WebPrintParams.h" 114 #include "third_party/WebKit/public/web/WebPrintParams.h"
115 #include "third_party/WebKit/public/web/WebPrintPresetOptions.h"
115 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" 116 #include "third_party/WebKit/public/web/WebPrintScalingOption.h"
116 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" 117 #include "third_party/WebKit/public/web/WebScopedUserGesture.h"
117 #include "third_party/WebKit/public/web/WebScriptSource.h" 118 #include "third_party/WebKit/public/web/WebScriptSource.h"
118 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" 119 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
119 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" 120 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
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/gfx/image/image_skia.h" 123 #include "ui/gfx/image/image_skia.h"
123 #include "ui/gfx/image/image_skia_rep.h" 124 #include "ui/gfx/image/image_skia_rep.h"
124 #include "ui/gfx/range/range.h" 125 #include "ui/gfx/range/range.h"
(...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 plugin_mouse_lock_interface_ = static_cast<const PPP_MouseLock*>( 1498 plugin_mouse_lock_interface_ = static_cast<const PPP_MouseLock*>(
1498 module_->GetPluginInterface(PPP_MOUSELOCK_INTERFACE)); 1499 module_->GetPluginInterface(PPP_MOUSELOCK_INTERFACE));
1499 } 1500 }
1500 1501
1501 return !!plugin_mouse_lock_interface_; 1502 return !!plugin_mouse_lock_interface_;
1502 } 1503 }
1503 1504
1504 bool PepperPluginInstanceImpl::LoadPdfInterface() { 1505 bool PepperPluginInstanceImpl::LoadPdfInterface() {
1505 if (!checked_for_plugin_pdf_interface_) { 1506 if (!checked_for_plugin_pdf_interface_) {
1506 checked_for_plugin_pdf_interface_ = true; 1507 checked_for_plugin_pdf_interface_ = true;
1507 plugin_pdf_interface_ = static_cast<const PPP_Pdf_1*>( 1508 plugin_pdf_interface_ = static_cast<const PPP_Pdf*>(
1508 module_->GetPluginInterface(PPP_PDF_INTERFACE_1)); 1509 module_->GetPluginInterface(PPP_PDF_INTERFACE_1));
1509 } 1510 }
1510 1511
1511 return !!plugin_pdf_interface_; 1512 return !!plugin_pdf_interface_;
1512 } 1513 }
1513 1514
1514 bool PepperPluginInstanceImpl::LoadPrintInterface() { 1515 bool PepperPluginInstanceImpl::LoadPrintInterface() {
1515 // Only check for the interface if the plugin has dev permission. 1516 // Only check for the interface if the plugin has dev permission.
1516 if (!module_->permissions().HasPermission(ppapi::PERMISSION_DEV)) 1517 if (!module_->permissions().HasPermission(ppapi::PERMISSION_DEV))
1517 return false; 1518 return false;
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1807 DCHECK(plugin_print_interface_); 1808 DCHECK(plugin_print_interface_);
1808 if (plugin_print_interface_) 1809 if (plugin_print_interface_)
1809 plugin_print_interface_->End(pp_instance()); 1810 plugin_print_interface_->End(pp_instance());
1810 1811
1811 memset(&current_print_settings_, 0, sizeof(current_print_settings_)); 1812 memset(&current_print_settings_, 0, sizeof(current_print_settings_));
1812 #if defined(OS_MACOSX) 1813 #if defined(OS_MACOSX)
1813 last_printed_page_ = NULL; 1814 last_printed_page_ = NULL;
1814 #endif // defined(OS_MACOSX) 1815 #endif // defined(OS_MACOSX)
1815 } 1816 }
1816 1817
1818 bool PepperPluginInstanceImpl::GetPrintPresetOptionsFromDocument(
1819 blink::WebPrintPresetOptions* preset_options) {
1820 // Keep a reference on the stack. See NOTE above.
1821 scoped_refptr<PepperPluginInstanceImpl> ref(this);
1822 if (!LoadPdfInterface())
1823 return false;
1824
1825 PP_PdfPrintPresetOptions_Dev options;
1826 if (!plugin_pdf_interface_->GetPrintPresetOptionsFromDocument(pp_instance(),
1827 &options)) {
1828 return false;
1829 }
1830
1831 preset_options->isScalingDisabled = PP_ToBool(options.is_scaling_disabled);
1832 preset_options->copies = options.copies;
1833
1834 return true;
1835 }
1836
1817 bool PepperPluginInstanceImpl::CanRotateView() { 1837 bool PepperPluginInstanceImpl::CanRotateView() {
1818 if (!LoadPdfInterface()) 1838 if (!LoadPdfInterface())
1819 return false; 1839 return false;
1820 1840
1821 return true; 1841 return true;
1822 } 1842 }
1823 1843
1824 void PepperPluginInstanceImpl::RotateView(WebPlugin::RotationType type) { 1844 void PepperPluginInstanceImpl::RotateView(WebPlugin::RotationType type) {
1825 if (!LoadPdfInterface()) 1845 if (!LoadPdfInterface())
1826 return; 1846 return;
(...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after
3276 // Running out-of-process. Initiate an IPC call to notify the plugin 3296 // Running out-of-process. Initiate an IPC call to notify the plugin
3277 // process. 3297 // process.
3278 ppapi::proxy::HostDispatcher* dispatcher = 3298 ppapi::proxy::HostDispatcher* dispatcher =
3279 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); 3299 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance());
3280 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( 3300 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad(
3281 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); 3301 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data));
3282 } 3302 }
3283 } 3303 }
3284 3304
3285 } // namespace content 3305 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_plugin_instance_impl.h ('k') | content/renderer/pepper/pepper_webplugin_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698