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

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

Issue 22577010: Printing: Add a basic printing mode without print preview and cloud print. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years, 4 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/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 if (!num_pages) 1514 if (!num_pages)
1515 return 0; 1515 return 0;
1516 current_print_settings_ = print_settings; 1516 current_print_settings_ = print_settings;
1517 canvas_.clear(); 1517 canvas_.clear();
1518 ranges_.clear(); 1518 ranges_.clear();
1519 return num_pages; 1519 return num_pages;
1520 } 1520 }
1521 1521
1522 bool PepperPluginInstanceImpl::PrintPage(int page_number, 1522 bool PepperPluginInstanceImpl::PrintPage(int page_number,
1523 WebKit::WebCanvas* canvas) { 1523 WebKit::WebCanvas* canvas) {
1524 #if defined(ENABLE_PRINTING) 1524 #if defined(ENABLE_FULL_PRINTING)
1525 DCHECK(plugin_print_interface_); 1525 DCHECK(plugin_print_interface_);
1526 PP_PrintPageNumberRange_Dev page_range; 1526 PP_PrintPageNumberRange_Dev page_range;
1527 page_range.first_page_number = page_range.last_page_number = page_number; 1527 page_range.first_page_number = page_range.last_page_number = page_number;
1528 // The canvas only has a metafile on it for print preview. 1528 // The canvas only has a metafile on it for print preview.
1529 bool save_for_later = 1529 bool save_for_later =
1530 (printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas) != NULL); 1530 (printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas) != NULL);
1531 #if defined(OS_MACOSX) || defined(OS_WIN) 1531 #if defined(OS_MACOSX) || defined(OS_WIN)
1532 save_for_later = save_for_later && skia::IsPreviewMetafile(*canvas); 1532 save_for_later = save_for_later && skia::IsPreviewMetafile(*canvas);
1533 #endif 1533 #endif
1534 if (save_for_later) { 1534 if (save_for_later) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 return false; 1693 return false;
1694 WebView* view = frame->view(); 1694 WebView* view = frame->view();
1695 if (!view) 1695 if (!view)
1696 return false; 1696 return false;
1697 1697
1698 return view->isAcceleratedCompositingActive(); 1698 return view->isAcceleratedCompositingActive();
1699 } 1699 }
1700 1700
1701 bool PepperPluginInstanceImpl::PrintPDFOutput(PP_Resource print_output, 1701 bool PepperPluginInstanceImpl::PrintPDFOutput(PP_Resource print_output,
1702 WebKit::WebCanvas* canvas) { 1702 WebKit::WebCanvas* canvas) {
1703 #if defined(ENABLE_PRINTING) 1703 #if defined(ENABLE_FULL_PRINTING)
1704 ppapi::thunk::EnterResourceNoLock<PPB_Buffer_API> enter(print_output, true); 1704 ppapi::thunk::EnterResourceNoLock<PPB_Buffer_API> enter(print_output, true);
1705 if (enter.failed()) 1705 if (enter.failed())
1706 return false; 1706 return false;
1707 1707
1708 BufferAutoMapper mapper(enter.object()); 1708 BufferAutoMapper mapper(enter.object());
1709 if (!mapper.data() || !mapper.size()) { 1709 if (!mapper.data() || !mapper.size()) {
1710 NOTREACHED(); 1710 NOTREACHED();
1711 return false; 1711 return false;
1712 } 1712 }
1713 #if defined(OS_WIN) 1713 #if defined(OS_WIN)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 1778
1779 ret = render_proc(static_cast<unsigned char*>(mapper.data()), mapper.size(), 1779 ret = render_proc(static_cast<unsigned char*>(mapper.data()), mapper.size(),
1780 0, dc, current_print_settings_.dpi, 1780 0, dc, current_print_settings_.dpi,
1781 current_print_settings_.dpi, 0, 0, size_in_pixels.width(), 1781 current_print_settings_.dpi, 0, 0, size_in_pixels.width(),
1782 size_in_pixels.height(), true, false, true, true, true); 1782 size_in_pixels.height(), true, false, true, true, true);
1783 skia::EndPlatformPaint(canvas); 1783 skia::EndPlatformPaint(canvas);
1784 } 1784 }
1785 #endif // defined(OS_WIN) 1785 #endif // defined(OS_WIN)
1786 1786
1787 return ret; 1787 return ret;
1788 #else // defined(ENABLE_PRINTING) 1788 #else // defined(ENABLE_FULL_PRINTING)
1789 return false; 1789 return false;
1790 #endif 1790 #endif
1791 } 1791 }
1792 1792
1793 static void IgnoreCallback(unsigned, bool) {} 1793 static void IgnoreCallback(unsigned, bool) {}
1794 1794
1795 void PepperPluginInstanceImpl::UpdateLayer() { 1795 void PepperPluginInstanceImpl::UpdateLayer() {
1796 if (!container_) 1796 if (!container_)
1797 return; 1797 return;
1798 1798
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
2897 // Running out-of-process. Initiate an IPC call to notify the plugin 2897 // Running out-of-process. Initiate an IPC call to notify the plugin
2898 // process. 2898 // process.
2899 ppapi::proxy::HostDispatcher* dispatcher = 2899 ppapi::proxy::HostDispatcher* dispatcher =
2900 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); 2900 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance());
2901 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( 2901 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad(
2902 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); 2902 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data));
2903 } 2903 }
2904 } 2904 }
2905 2905
2906 } // namespace content 2906 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/pepper/pepper_print_settings_manager.cc ('k') | printing/printing.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698