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

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

Issue 1953053002: Add private PPAPI interfaces for PDFium accessibility. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback from Lei Created 4 years, 7 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 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 "build/build_config.h" 7 #include "build/build_config.h"
8 #include "ppapi/proxy/host_dispatcher.h" 8 #include "ppapi/proxy/host_dispatcher.h"
9 #include "ppapi/proxy/ppapi_messages.h" 9 #include "ppapi/proxy/ppapi_messages.h"
10 #include "ppapi/shared_impl/proxy_lock.h" 10 #include "ppapi/shared_impl/proxy_lock.h"
(...skipping 18 matching lines...) Expand all
29 PP_Bool GetPrintPresetOptionsFromDocument( 29 PP_Bool GetPrintPresetOptionsFromDocument(
30 PP_Instance instance, 30 PP_Instance instance,
31 PP_PdfPrintPresetOptions_Dev* options) { 31 PP_PdfPrintPresetOptions_Dev* options) {
32 PP_Bool ret = PP_FALSE; 32 PP_Bool ret = PP_FALSE;
33 HostDispatcher::GetForInstance(instance) 33 HostDispatcher::GetForInstance(instance)
34 ->Send(new PpapiMsg_PPPPdf_PrintPresetOptions( 34 ->Send(new PpapiMsg_PPPPdf_PrintPresetOptions(
35 API_ID_PPP_PDF, instance, options, &ret)); 35 API_ID_PPP_PDF, instance, options, &ret));
36 return ret; 36 return ret;
37 } 37 }
38 38
39 void EnableAccessibility(PP_Instance instance) {
40 HostDispatcher::GetForInstance(instance)
41 ->Send(new PpapiMsg_PPPPdf_EnableAccessibility(
42 API_ID_PPP_PDF, instance));
43 }
44
39 const PPP_Pdf ppp_pdf_interface = { 45 const PPP_Pdf ppp_pdf_interface = {
40 &GetLinkAtPosition, 46 &GetLinkAtPosition,
41 &Transform, 47 &Transform,
42 &GetPrintPresetOptionsFromDocument 48 &GetPrintPresetOptionsFromDocument,
49 &EnableAccessibility,
43 }; 50 };
44 #else 51 #else
45 // The NaCl plugin doesn't need the host side interface - stub it out. 52 // The NaCl plugin doesn't need the host side interface - stub it out.
46 const PPP_Pdf ppp_pdf_interface = {}; 53 const PPP_Pdf ppp_pdf_interface = {};
47 #endif 54 #endif
48 55
49 } // namespace 56 } // namespace
50 57
51 PPP_Pdf_Proxy::PPP_Pdf_Proxy(Dispatcher* dispatcher) 58 PPP_Pdf_Proxy::PPP_Pdf_Proxy(Dispatcher* dispatcher)
52 : InterfaceProxy(dispatcher), 59 : InterfaceProxy(dispatcher),
(...skipping 14 matching lines...) Expand all
67 74
68 bool PPP_Pdf_Proxy::OnMessageReceived(const IPC::Message& msg) { 75 bool PPP_Pdf_Proxy::OnMessageReceived(const IPC::Message& msg) {
69 if (!dispatcher()->IsPlugin()) 76 if (!dispatcher()->IsPlugin())
70 return false; 77 return false;
71 78
72 bool handled = true; 79 bool handled = true;
73 IPC_BEGIN_MESSAGE_MAP(PPP_Pdf_Proxy, msg) 80 IPC_BEGIN_MESSAGE_MAP(PPP_Pdf_Proxy, msg)
74 IPC_MESSAGE_HANDLER(PpapiMsg_PPPPdf_Rotate, OnPluginMsgRotate) 81 IPC_MESSAGE_HANDLER(PpapiMsg_PPPPdf_Rotate, OnPluginMsgRotate)
75 IPC_MESSAGE_HANDLER(PpapiMsg_PPPPdf_PrintPresetOptions, 82 IPC_MESSAGE_HANDLER(PpapiMsg_PPPPdf_PrintPresetOptions,
76 OnPluginMsgPrintPresetOptions) 83 OnPluginMsgPrintPresetOptions)
84 IPC_MESSAGE_HANDLER(PpapiMsg_PPPPdf_EnableAccessibility,
85 OnPluginMsgEnableAccessibility)
77 IPC_MESSAGE_UNHANDLED(handled = false) 86 IPC_MESSAGE_UNHANDLED(handled = false)
78 IPC_END_MESSAGE_MAP() 87 IPC_END_MESSAGE_MAP()
79 return handled; 88 return handled;
80 } 89 }
81 90
82 void PPP_Pdf_Proxy::OnPluginMsgRotate(PP_Instance instance, bool clockwise) { 91 void PPP_Pdf_Proxy::OnPluginMsgRotate(PP_Instance instance, bool clockwise) {
83 PP_PrivatePageTransformType type = clockwise ? 92 PP_PrivatePageTransformType type = clockwise ?
84 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CW : 93 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CW :
85 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CCW; 94 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CCW;
86 if (ppp_pdf_) 95 if (ppp_pdf_)
87 CallWhileUnlocked(ppp_pdf_->Transform, instance, type); 96 CallWhileUnlocked(ppp_pdf_->Transform, instance, type);
88 } 97 }
89 98
90 void PPP_Pdf_Proxy::OnPluginMsgPrintPresetOptions( 99 void PPP_Pdf_Proxy::OnPluginMsgPrintPresetOptions(
91 PP_Instance instance, 100 PP_Instance instance,
92 PP_PdfPrintPresetOptions_Dev* options, 101 PP_PdfPrintPresetOptions_Dev* options,
93 PP_Bool* result) { 102 PP_Bool* result) {
94 if (ppp_pdf_) { 103 if (ppp_pdf_) {
95 *result = CallWhileUnlocked( 104 *result = CallWhileUnlocked(
96 ppp_pdf_->GetPrintPresetOptionsFromDocument, instance, options); 105 ppp_pdf_->GetPrintPresetOptionsFromDocument, instance, options);
97 } 106 }
98 } 107 }
99 108
109 void PPP_Pdf_Proxy::OnPluginMsgEnableAccessibility(
110 PP_Instance instance) {
111 if (ppp_pdf_)
112 CallWhileUnlocked(ppp_pdf_->EnableAccessibility, instance);
113 }
114
100 } // namespace proxy 115 } // namespace proxy
101 } // namespace ppapi 116 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698