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

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: Review feedback (move struct to PPP_Pdf) Created 6 years, 2 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 "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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 #include "third_party/WebKit/public/platform/WebURLRequest.h" 104 #include "third_party/WebKit/public/platform/WebURLRequest.h"
105 #include "third_party/WebKit/public/web/WebBindings.h" 105 #include "third_party/WebKit/public/web/WebBindings.h"
106 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" 106 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
107 #include "third_party/WebKit/public/web/WebDataSource.h" 107 #include "third_party/WebKit/public/web/WebDataSource.h"
108 #include "third_party/WebKit/public/web/WebDocument.h" 108 #include "third_party/WebKit/public/web/WebDocument.h"
109 #include "third_party/WebKit/public/web/WebElement.h" 109 #include "third_party/WebKit/public/web/WebElement.h"
110 #include "third_party/WebKit/public/web/WebInputEvent.h" 110 #include "third_party/WebKit/public/web/WebInputEvent.h"
111 #include "third_party/WebKit/public/web/WebLocalFrame.h" 111 #include "third_party/WebKit/public/web/WebLocalFrame.h"
112 #include "third_party/WebKit/public/web/WebPluginContainer.h" 112 #include "third_party/WebKit/public/web/WebPluginContainer.h"
113 #include "third_party/WebKit/public/web/WebPrintParams.h" 113 #include "third_party/WebKit/public/web/WebPrintParams.h"
114 #include "third_party/WebKit/public/web/WebPrintPresetOptions.h"
114 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" 115 #include "third_party/WebKit/public/web/WebPrintScalingOption.h"
115 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" 116 #include "third_party/WebKit/public/web/WebScopedUserGesture.h"
116 #include "third_party/WebKit/public/web/WebScriptSource.h" 117 #include "third_party/WebKit/public/web/WebScriptSource.h"
117 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" 118 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
118 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" 119 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
119 #include "third_party/WebKit/public/web/WebView.h" 120 #include "third_party/WebKit/public/web/WebView.h"
120 #include "third_party/khronos/GLES2/gl2.h" 121 #include "third_party/khronos/GLES2/gl2.h"
121 #include "ui/gfx/image/image_skia.h" 122 #include "ui/gfx/image/image_skia.h"
122 #include "ui/gfx/image/image_skia_rep.h" 123 #include "ui/gfx/image/image_skia_rep.h"
123 #include "ui/gfx/range/range.h" 124 #include "ui/gfx/range/range.h"
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 plugin_mouse_lock_interface_ = static_cast<const PPP_MouseLock*>( 1484 plugin_mouse_lock_interface_ = static_cast<const PPP_MouseLock*>(
1484 module_->GetPluginInterface(PPP_MOUSELOCK_INTERFACE)); 1485 module_->GetPluginInterface(PPP_MOUSELOCK_INTERFACE));
1485 } 1486 }
1486 1487
1487 return !!plugin_mouse_lock_interface_; 1488 return !!plugin_mouse_lock_interface_;
1488 } 1489 }
1489 1490
1490 bool PepperPluginInstanceImpl::LoadPdfInterface() { 1491 bool PepperPluginInstanceImpl::LoadPdfInterface() {
1491 if (!checked_for_plugin_pdf_interface_) { 1492 if (!checked_for_plugin_pdf_interface_) {
1492 checked_for_plugin_pdf_interface_ = true; 1493 checked_for_plugin_pdf_interface_ = true;
1493 plugin_pdf_interface_ = static_cast<const PPP_Pdf_1*>( 1494 plugin_pdf_interface_ = static_cast<const PPP_Pdf*>(
1494 module_->GetPluginInterface(PPP_PDF_INTERFACE_1)); 1495 module_->GetPluginInterface(PPP_PDF_INTERFACE_1));
1495 } 1496 }
1496 1497
1497 return !!plugin_pdf_interface_; 1498 return !!plugin_pdf_interface_;
1498 } 1499 }
1499 1500
1500 bool PepperPluginInstanceImpl::LoadPrintInterface() { 1501 bool PepperPluginInstanceImpl::LoadPrintInterface() {
1501 // Only check for the interface if the plugin has dev permission. 1502 // Only check for the interface if the plugin has dev permission.
1502 if (!module_->permissions().HasPermission(ppapi::PERMISSION_DEV)) 1503 if (!module_->permissions().HasPermission(ppapi::PERMISSION_DEV))
1503 return false; 1504 return false;
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1788 DCHECK(plugin_print_interface_); 1789 DCHECK(plugin_print_interface_);
1789 if (plugin_print_interface_) 1790 if (plugin_print_interface_)
1790 plugin_print_interface_->End(pp_instance()); 1791 plugin_print_interface_->End(pp_instance());
1791 1792
1792 memset(&current_print_settings_, 0, sizeof(current_print_settings_)); 1793 memset(&current_print_settings_, 0, sizeof(current_print_settings_));
1793 #if defined(OS_MACOSX) 1794 #if defined(OS_MACOSX)
1794 last_printed_page_ = NULL; 1795 last_printed_page_ = NULL;
1795 #endif // defined(OS_MACOSX) 1796 #endif // defined(OS_MACOSX)
1796 } 1797 }
1797 1798
1799 bool PepperPluginInstanceImpl::GetPrintPresetOptionsFromDocument(
1800 blink::WebPrintPresetOptions* preset_options) {
1801 // Keep a reference on the stack. See NOTE above.
1802 scoped_refptr<PepperPluginInstanceImpl> ref(this);
1803 if (!LoadPdfInterface())
1804 return false;
1805
1806 PPP_PdfPrintPresetOptions_Dev options;
1807 if (!plugin_pdf_interface_->GetPrintPresetOptionsFromDocument(pp_instance(),
1808 &options)) {
1809 return false;
1810 }
1811
1812 preset_options->isScalingDisabled = options.is_scaling_disabled;
1813 preset_options->copies = options.copies;
1814
1815 return true;
1816 }
1817
1798 bool PepperPluginInstanceImpl::CanRotateView() { 1818 bool PepperPluginInstanceImpl::CanRotateView() {
1799 if (!LoadPdfInterface()) 1819 if (!LoadPdfInterface())
1800 return false; 1820 return false;
1801 1821
1802 return true; 1822 return true;
1803 } 1823 }
1804 1824
1805 void PepperPluginInstanceImpl::RotateView(WebPlugin::RotationType type) { 1825 void PepperPluginInstanceImpl::RotateView(WebPlugin::RotationType type) {
1806 if (!LoadPdfInterface()) 1826 if (!LoadPdfInterface())
1807 return; 1827 return;
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after
3254 // Running out-of-process. Initiate an IPC call to notify the plugin 3274 // Running out-of-process. Initiate an IPC call to notify the plugin
3255 // process. 3275 // process.
3256 ppapi::proxy::HostDispatcher* dispatcher = 3276 ppapi::proxy::HostDispatcher* dispatcher =
3257 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); 3277 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance());
3258 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( 3278 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad(
3259 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); 3279 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data));
3260 } 3280 }
3261 } 3281 }
3262 3282
3263 } // namespace content 3283 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698