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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 8041052: Add IsScalingDisabled and PP_PRINTOUTPUTFORMAT_EMF to pepper printing interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 return true; 816 return true;
817 } 817 }
818 return false; 818 return false;
819 } 819 }
820 820
821 bool PluginInstance::SupportsPrintInterface() { 821 bool PluginInstance::SupportsPrintInterface() {
822 PP_PrintOutputFormat_Dev format; 822 PP_PrintOutputFormat_Dev format;
823 return GetPreferredPrintOutputFormat(&format); 823 return GetPreferredPrintOutputFormat(&format);
824 } 824 }
825 825
826 bool PluginInstance::IsPrintScalingDisabled() {
827 DCHECK(plugin_print_interface_);
828 if (!plugin_print_interface_)
829 return false;
830 return plugin_print_interface_->IsScalingDisabled(pp_instance());
831 }
832
826 int PluginInstance::PrintBegin(const gfx::Rect& printable_area, 833 int PluginInstance::PrintBegin(const gfx::Rect& printable_area,
827 int printer_dpi) { 834 int printer_dpi) {
828 // Keep a reference on the stack. See NOTE above. 835 // Keep a reference on the stack. See NOTE above.
829 scoped_refptr<PluginInstance> ref(this); 836 scoped_refptr<PluginInstance> ref(this);
830 PP_PrintOutputFormat_Dev format; 837 PP_PrintOutputFormat_Dev format;
831 if (!GetPreferredPrintOutputFormat(&format)) { 838 if (!GetPreferredPrintOutputFormat(&format)) {
832 // PrintBegin should not have been called since SupportsPrintInterface 839 // PrintBegin should not have been called since SupportsPrintInterface
833 // would have returned false; 840 // would have returned false;
834 NOTREACHED(); 841 NOTREACHED();
835 return 0; 842 return 0;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 { 876 {
870 return PrintPageHelper(&page_range, 1, canvas); 877 return PrintPageHelper(&page_range, 1, canvas);
871 } 878 }
872 } 879 }
873 880
874 bool PluginInstance::PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges, 881 bool PluginInstance::PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges,
875 int num_ranges, 882 int num_ranges,
876 WebKit::WebCanvas* canvas) { 883 WebKit::WebCanvas* canvas) {
877 // Keep a reference on the stack. See NOTE above. 884 // Keep a reference on the stack. See NOTE above.
878 scoped_refptr<PluginInstance> ref(this); 885 scoped_refptr<PluginInstance> ref(this);
886 DCHECK(plugin_print_interface_);
887 if (!plugin_print_interface_)
888 return false;
879 PP_Resource print_output = plugin_print_interface_->PrintPages( 889 PP_Resource print_output = plugin_print_interface_->PrintPages(
880 pp_instance(), page_ranges, num_ranges); 890 pp_instance(), page_ranges, num_ranges);
881 if (!print_output) 891 if (!print_output)
882 return false; 892 return false;
883 893
884 bool ret = false; 894 bool ret = false;
885 895
886 if (current_print_settings_.format == PP_PRINTOUTPUTFORMAT_PDF) 896 if (current_print_settings_.format == PP_PRINTOUTPUTFORMAT_PDF)
887 ret = PrintPDFOutput(print_output, canvas); 897 ret = PrintPDFOutput(print_output, canvas);
888 else if (current_print_settings_.format == PP_PRINTOUTPUTFORMAT_RASTER) 898 else if (current_print_settings_.format == PP_PRINTOUTPUTFORMAT_RASTER)
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 } 1610 }
1601 1611
1602 void PluginInstance::DoSetCursor(WebCursorInfo* cursor) { 1612 void PluginInstance::DoSetCursor(WebCursorInfo* cursor) {
1603 cursor_.reset(cursor); 1613 cursor_.reset(cursor);
1604 if (fullscreen_container_) 1614 if (fullscreen_container_)
1605 fullscreen_container_->DidChangeCursor(*cursor); 1615 fullscreen_container_->DidChangeCursor(*cursor);
1606 } 1616 }
1607 1617
1608 } // namespace ppapi 1618 } // namespace ppapi
1609 } // namespace webkit 1619 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698