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

Side by Side Diff: ppapi/proxy/ppp_pdf_proxy.cc

Issue 375253002: [Chrome] Support NumCopies print preset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback (oop proxy, out-param) 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
« ppapi/c/private/ppp_pdf.h ('K') | « ppapi/proxy/ppp_pdf_proxy.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 "ppapi/proxy/ppp_pdf_proxy.h" 5 #include "ppapi/proxy/ppp_pdf_proxy.h"
6 6
7 #include "ppapi/proxy/host_dispatcher.h" 7 #include "ppapi/proxy/host_dispatcher.h"
8 #include "ppapi/proxy/ppapi_messages.h" 8 #include "ppapi/proxy/ppapi_messages.h"
9 #include "ppapi/shared_impl/proxy_lock.h" 9 #include "ppapi/shared_impl/proxy_lock.h"
10 10
11 namespace ppapi { 11 namespace ppapi {
12 namespace proxy { 12 namespace proxy {
13 13
14 namespace { 14 namespace {
15 15
16 #if !defined(OS_NACL) 16 #if !defined(OS_NACL)
17 PP_Var GetLinkAtPosition(PP_Instance instance, PP_Point point) { 17 PP_Var GetLinkAtPosition(PP_Instance instance, PP_Point point) {
18 // This isn't implemented in the out of process case. 18 // This isn't implemented in the out of process case.
19 return PP_MakeUndefined(); 19 return PP_MakeUndefined();
20 } 20 }
21 21
22 void Transform(PP_Instance instance, PP_PrivatePageTransformType type) { 22 void Transform(PP_Instance instance, PP_PrivatePageTransformType type) {
23 bool clockwise = type == PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CW; 23 bool clockwise = type == PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CW;
24 HostDispatcher::GetForInstance(instance)->Send( 24 HostDispatcher::GetForInstance(instance)->Send(
25 new PpapiMsg_PPPPdf_Rotate(API_ID_PPP_PDF, instance, clockwise)); 25 new PpapiMsg_PPPPdf_Rotate(API_ID_PPP_PDF, instance, clockwise));
26 } 26 }
27 27
28 PP_Bool GetPrintPresetOptionsFromDocument(PP_Instance instance,
29 PP_PrintPresetOptions_Dev* options) {
30 PP_Bool ret = PP_FALSE;
31 HostDispatcher::GetForInstance(instance)
32 ->Send(new PpapiMsg_PPPPdf_PrintPresetOptions(
33 API_ID_PPP_PDF, instance, options, &ret));
34 return ret;
35 }
36
28 const PPP_Pdf ppp_pdf_interface = { 37 const PPP_Pdf ppp_pdf_interface = {
29 &GetLinkAtPosition, 38 &GetLinkAtPosition,
30 &Transform, 39 &Transform,
40 &GetPrintPresetOptionsFromDocument
31 }; 41 };
32 #else 42 #else
33 // The NaCl plugin doesn't need the host side interface - stub it out. 43 // The NaCl plugin doesn't need the host side interface - stub it out.
34 const PPP_Pdf ppp_pdf_interface = {}; 44 const PPP_Pdf ppp_pdf_interface = {};
35 #endif 45 #endif
36 46
37 } // namespace 47 } // namespace
38 48
39 PPP_Pdf_Proxy::PPP_Pdf_Proxy(Dispatcher* dispatcher) 49 PPP_Pdf_Proxy::PPP_Pdf_Proxy(Dispatcher* dispatcher)
40 : InterfaceProxy(dispatcher), 50 : InterfaceProxy(dispatcher),
(...skipping 12 matching lines...) Expand all
53 return &ppp_pdf_interface; 63 return &ppp_pdf_interface;
54 } 64 }
55 65
56 bool PPP_Pdf_Proxy::OnMessageReceived(const IPC::Message& msg) { 66 bool PPP_Pdf_Proxy::OnMessageReceived(const IPC::Message& msg) {
57 if (!dispatcher()->IsPlugin()) 67 if (!dispatcher()->IsPlugin())
58 return false; 68 return false;
59 69
60 bool handled = true; 70 bool handled = true;
61 IPC_BEGIN_MESSAGE_MAP(PPP_Pdf_Proxy, msg) 71 IPC_BEGIN_MESSAGE_MAP(PPP_Pdf_Proxy, msg)
62 IPC_MESSAGE_HANDLER(PpapiMsg_PPPPdf_Rotate, OnPluginMsgRotate) 72 IPC_MESSAGE_HANDLER(PpapiMsg_PPPPdf_Rotate, OnPluginMsgRotate)
73 IPC_MESSAGE_HANDLER(PpapiMsg_PPPPdf_PrintPresetOptions,
74 OnPluginMsgPrintPresetOptions)
63 IPC_MESSAGE_UNHANDLED(handled = false) 75 IPC_MESSAGE_UNHANDLED(handled = false)
64 IPC_END_MESSAGE_MAP() 76 IPC_END_MESSAGE_MAP()
65 return handled; 77 return handled;
66 } 78 }
67 79
68 void PPP_Pdf_Proxy::OnPluginMsgRotate(PP_Instance instance, bool clockwise) { 80 void PPP_Pdf_Proxy::OnPluginMsgRotate(PP_Instance instance, bool clockwise) {
69 PP_PrivatePageTransformType type = clockwise ? 81 PP_PrivatePageTransformType type = clockwise ?
70 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CW : 82 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CW :
71 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CCW; 83 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CCW;
72 if (ppp_pdf_) 84 if (ppp_pdf_)
73 CallWhileUnlocked(ppp_pdf_->Transform, instance, type); 85 CallWhileUnlocked(ppp_pdf_->Transform, instance, type);
74 } 86 }
75 87
88 void PPP_Pdf_Proxy::OnPluginMsgPrintPresetOptions(
89 PP_Instance instance,
90 PP_PrintPresetOptions_Dev* options,
91 PP_Bool* result) {
92 if (ppp_pdf_) {
93 *result = CallWhileUnlocked(
94 ppp_pdf_->GetPrintPresetOptionsFromDocument, instance, options);
95 }
96 }
97
76 } // namespace proxy 98 } // namespace proxy
77 } // namespace ppapi 99 } // namespace ppapi
OLDNEW
« ppapi/c/private/ppp_pdf.h ('K') | « ppapi/proxy/ppp_pdf_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698