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

Side by Side Diff: chrome/renderer/pepper/pepper_printing_renderer_host.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, 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
« no previous file with comments | « chrome/renderer/pepper/pepper_printing_renderer_host.h ('k') | pdf/instance.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/renderer/pepper/pepper_printing_renderer_host.h"
6
7 #include "chrome/common/print_messages.h"
8 #include "chrome/common/render_messages.h"
9 #include "chrome/renderer/printing/print_web_view_helper.h"
10 #include "content/public/renderer/pepper_plugin_instance.h"
11 #include "content/public/renderer/render_thread.h"
12 #include "content/public/renderer/render_view.h"
13 #include "content/public/renderer/renderer_ppapi_host.h"
14 #include "ppapi/host/dispatch_host_message.h"
15 #include "ppapi/proxy/ppapi_messages.h"
16 #include "third_party/WebKit/public/web/WebDocument.h"
17 #include "third_party/WebKit/public/web/WebElement.h"
18 #include "third_party/WebKit/public/web/WebLocalFrame.h"
19 #include "third_party/WebKit/public/web/WebPluginContainer.h"
20 #include "third_party/WebKit/public/web/WebView.h"
21
22 PepperPrintingRendererHost::PepperPrintingRendererHost(
23 content::RendererPpapiHost* host,
24 PP_Instance instance,
25 PP_Resource resource)
26 : ppapi::host::ResourceHost(host->GetPpapiHost(), instance, resource),
27 host_(host) {
28 }
29
30 PepperPrintingRendererHost::~PepperPrintingRendererHost() {
31 }
32
33 int32_t PepperPrintingRendererHost::OnResourceMessageReceived(
34 const IPC::Message& msg,
35 ppapi::host::HostMessageContext* context) {
36 PPAPI_BEGIN_MESSAGE_MAP(PepperPrintingRendererHost, msg)
37 PPAPI_DISPATCH_HOST_RESOURCE_CALL(
38 PpapiHostMsg_PrintHost_SetPrintPresetOptionsFromDocument,
39 OnHostMsgSetPrintPresetOptionsFromDocument)
40 PPAPI_END_MESSAGE_MAP()
41 return PP_ERROR_FAILED;
42 }
43
44 int32_t PepperPrintingRendererHost::OnHostMsgSetPrintPresetOptionsFromDocument(
45 ppapi::host::HostMessageContext* context,
46 PP_PrintPresetOptions_Dev& print_options) {
47 #if defined(ENABLE_FULL_PRINTING)
48 content::PepperPluginInstance* instance =
49 host_->GetPluginInstance(pp_instance());
50 if (!instance)
51 return PP_ERROR_FAILED;
52
53 PrintHostMsg_SetOptionsFromDocument_Params params;
54 params.is_scaling_disabled = print_options.is_scaling_disabled;
55 params.copies = print_options.copies;
56
57 content::RenderView* render_view = instance->GetRenderView();
58 render_view->Send(new PrintHostMsg_SetOptionsFromDocument(
59 render_view->GetRoutingID(), params));
60 return PP_OK;
61 #endif
62 return PP_ERROR_FAILED;
63 }
OLDNEW
« no previous file with comments | « chrome/renderer/pepper/pepper_printing_renderer_host.h ('k') | pdf/instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698