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

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: PPP_Pdf changes Created 6 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 "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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/WebElement.h" 111 #include "third_party/WebKit/public/web/WebElement.h"
112 #include "third_party/WebKit/public/web/WebInputEvent.h" 112 #include "third_party/WebKit/public/web/WebInputEvent.h"
113 #include "third_party/WebKit/public/web/WebLocalFrame.h" 113 #include "third_party/WebKit/public/web/WebLocalFrame.h"
114 #include "third_party/WebKit/public/web/WebPluginContainer.h" 114 #include "third_party/WebKit/public/web/WebPluginContainer.h"
115 #include "third_party/WebKit/public/web/WebPrintParams.h" 115 #include "third_party/WebKit/public/web/WebPrintParams.h"
116 #include "third_party/WebKit/public/web/WebPrintPresetOptions.h"
116 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" 117 #include "third_party/WebKit/public/web/WebPrintScalingOption.h"
117 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" 118 #include "third_party/WebKit/public/web/WebScopedUserGesture.h"
118 #include "third_party/WebKit/public/web/WebScriptSource.h" 119 #include "third_party/WebKit/public/web/WebScriptSource.h"
119 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" 120 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
120 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" 121 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
121 #include "third_party/WebKit/public/web/WebView.h" 122 #include "third_party/WebKit/public/web/WebView.h"
122 #include "third_party/khronos/GLES2/gl2.h" 123 #include "third_party/khronos/GLES2/gl2.h"
123 #include "third_party/skia/include/core/SkCanvas.h" 124 #include "third_party/skia/include/core/SkCanvas.h"
124 #include "third_party/skia/include/core/SkRect.h" 125 #include "third_party/skia/include/core/SkRect.h"
125 #include "ui/gfx/image/image_skia.h" 126 #include "ui/gfx/image/image_skia.h"
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 plugin_mouse_lock_interface_ = static_cast<const PPP_MouseLock*>( 1528 plugin_mouse_lock_interface_ = static_cast<const PPP_MouseLock*>(
1528 module_->GetPluginInterface(PPP_MOUSELOCK_INTERFACE)); 1529 module_->GetPluginInterface(PPP_MOUSELOCK_INTERFACE));
1529 } 1530 }
1530 1531
1531 return !!plugin_mouse_lock_interface_; 1532 return !!plugin_mouse_lock_interface_;
1532 } 1533 }
1533 1534
1534 bool PepperPluginInstanceImpl::LoadPdfInterface() { 1535 bool PepperPluginInstanceImpl::LoadPdfInterface() {
1535 if (!checked_for_plugin_pdf_interface_) { 1536 if (!checked_for_plugin_pdf_interface_) {
1536 checked_for_plugin_pdf_interface_ = true; 1537 checked_for_plugin_pdf_interface_ = true;
1537 plugin_pdf_interface_ = static_cast<const PPP_Pdf_1*>( 1538 plugin_pdf_interface_ = static_cast<const PPP_Pdf_2*>(
1538 module_->GetPluginInterface(PPP_PDF_INTERFACE_1)); 1539 module_->GetPluginInterface(PPP_PDF_INTERFACE_2));
1539 } 1540 }
1540 1541
1541 return !!plugin_pdf_interface_; 1542 return !!plugin_pdf_interface_;
1542 } 1543 }
1543 1544
1544 bool PepperPluginInstanceImpl::LoadPrintInterface() { 1545 bool PepperPluginInstanceImpl::LoadPrintInterface() {
1545 // Only check for the interface if the plugin has dev permission. 1546 // Only check for the interface if the plugin has dev permission.
1546 if (!module_->permissions().HasPermission(ppapi::PERMISSION_DEV)) 1547 if (!module_->permissions().HasPermission(ppapi::PERMISSION_DEV))
1547 return false; 1548 return false;
1548 if (!plugin_print_interface_) { 1549 if (!plugin_print_interface_) {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 DCHECK(plugin_print_interface_); 1835 DCHECK(plugin_print_interface_);
1835 if (plugin_print_interface_) 1836 if (plugin_print_interface_)
1836 plugin_print_interface_->End(pp_instance()); 1837 plugin_print_interface_->End(pp_instance());
1837 1838
1838 memset(&current_print_settings_, 0, sizeof(current_print_settings_)); 1839 memset(&current_print_settings_, 0, sizeof(current_print_settings_));
1839 #if defined(OS_MACOSX) 1840 #if defined(OS_MACOSX)
1840 last_printed_page_ = NULL; 1841 last_printed_page_ = NULL;
1841 #endif // defined(OS_MACOSX) 1842 #endif // defined(OS_MACOSX)
1842 } 1843 }
1843 1844
1845 bool PepperPluginInstanceImpl::GetPrintPresetOptionsFromDocument(
1846 blink::WebPrintPresetOptions& preset_options) {
1847 // Keep a reference on the stack. See NOTE above.
1848 scoped_refptr<PepperPluginInstanceImpl> ref(this);
1849 if (!LoadPdfInterface())
1850 return false;
1851
1852 PP_PrintPresetOptions_Dev options;
1853 if (!plugin_pdf_interface_->GetPrintPresetOptionsFromDocument(pp_instance(),
1854 options))
1855 return false;
1856
1857 preset_options.isScalingDisabled = options.is_scaling_disabled;
1858 preset_options.copies = options.copies;
1859
1860 return true;
1861 }
1862
1844 bool PepperPluginInstanceImpl::CanRotateView() { 1863 bool PepperPluginInstanceImpl::CanRotateView() {
1845 if (!LoadPdfInterface()) 1864 if (!LoadPdfInterface())
1846 return false; 1865 return false;
1847 1866
1848 return true; 1867 return true;
1849 } 1868 }
1850 1869
1851 void PepperPluginInstanceImpl::RotateView(WebPlugin::RotationType type) { 1870 void PepperPluginInstanceImpl::RotateView(WebPlugin::RotationType type) {
1852 if (!LoadPdfInterface()) 1871 if (!LoadPdfInterface())
1853 return; 1872 return;
(...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after
3377 // Running out-of-process. Initiate an IPC call to notify the plugin 3396 // Running out-of-process. Initiate an IPC call to notify the plugin
3378 // process. 3397 // process.
3379 ppapi::proxy::HostDispatcher* dispatcher = 3398 ppapi::proxy::HostDispatcher* dispatcher =
3380 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); 3399 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance());
3381 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( 3400 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad(
3382 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); 3401 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data));
3383 } 3402 }
3384 } 3403 }
3385 3404
3386 } // namespace content 3405 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698