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

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 and run git cl format Created 4 years, 6 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 | « ppapi/proxy/ppp_pdf_proxy.h ('k') | ppapi/thunk/ppb_pdf_api.h » ('j') | 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 "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)->Send(
41 new PpapiMsg_PPPPdf_EnableAccessibility(API_ID_PPP_PDF, instance));
42 }
43
39 const PPP_Pdf ppp_pdf_interface = { 44 const PPP_Pdf ppp_pdf_interface = {
40 &GetLinkAtPosition, 45 &GetLinkAtPosition,
41 &Transform, 46 &Transform,
42 &GetPrintPresetOptionsFromDocument 47 &GetPrintPresetOptionsFromDocument,
48 &EnableAccessibility,
43 }; 49 };
44 #else 50 #else
45 // The NaCl plugin doesn't need the host side interface - stub it out. 51 // The NaCl plugin doesn't need the host side interface - stub it out.
46 const PPP_Pdf ppp_pdf_interface = {}; 52 const PPP_Pdf ppp_pdf_interface = {};
47 #endif 53 #endif
48 54
49 } // namespace 55 } // namespace
50 56
51 PPP_Pdf_Proxy::PPP_Pdf_Proxy(Dispatcher* dispatcher) 57 PPP_Pdf_Proxy::PPP_Pdf_Proxy(Dispatcher* dispatcher)
52 : InterfaceProxy(dispatcher), 58 : InterfaceProxy(dispatcher),
(...skipping 14 matching lines...) Expand all
67 73
68 bool PPP_Pdf_Proxy::OnMessageReceived(const IPC::Message& msg) { 74 bool PPP_Pdf_Proxy::OnMessageReceived(const IPC::Message& msg) {
69 if (!dispatcher()->IsPlugin()) 75 if (!dispatcher()->IsPlugin())
70 return false; 76 return false;
71 77
72 bool handled = true; 78 bool handled = true;
73 IPC_BEGIN_MESSAGE_MAP(PPP_Pdf_Proxy, msg) 79 IPC_BEGIN_MESSAGE_MAP(PPP_Pdf_Proxy, msg)
74 IPC_MESSAGE_HANDLER(PpapiMsg_PPPPdf_Rotate, OnPluginMsgRotate) 80 IPC_MESSAGE_HANDLER(PpapiMsg_PPPPdf_Rotate, OnPluginMsgRotate)
75 IPC_MESSAGE_HANDLER(PpapiMsg_PPPPdf_PrintPresetOptions, 81 IPC_MESSAGE_HANDLER(PpapiMsg_PPPPdf_PrintPresetOptions,
76 OnPluginMsgPrintPresetOptions) 82 OnPluginMsgPrintPresetOptions)
83 IPC_MESSAGE_HANDLER(PpapiMsg_PPPPdf_EnableAccessibility,
84 OnPluginMsgEnableAccessibility)
77 IPC_MESSAGE_UNHANDLED(handled = false) 85 IPC_MESSAGE_UNHANDLED(handled = false)
78 IPC_END_MESSAGE_MAP() 86 IPC_END_MESSAGE_MAP()
79 return handled; 87 return handled;
80 } 88 }
81 89
82 void PPP_Pdf_Proxy::OnPluginMsgRotate(PP_Instance instance, bool clockwise) { 90 void PPP_Pdf_Proxy::OnPluginMsgRotate(PP_Instance instance, bool clockwise) {
83 PP_PrivatePageTransformType type = clockwise ? 91 PP_PrivatePageTransformType type = clockwise ?
84 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CW : 92 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CW :
85 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CCW; 93 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CCW;
86 if (ppp_pdf_) 94 if (ppp_pdf_)
87 CallWhileUnlocked(ppp_pdf_->Transform, instance, type); 95 CallWhileUnlocked(ppp_pdf_->Transform, instance, type);
88 } 96 }
89 97
90 void PPP_Pdf_Proxy::OnPluginMsgPrintPresetOptions( 98 void PPP_Pdf_Proxy::OnPluginMsgPrintPresetOptions(
91 PP_Instance instance, 99 PP_Instance instance,
92 PP_PdfPrintPresetOptions_Dev* options, 100 PP_PdfPrintPresetOptions_Dev* options,
93 PP_Bool* result) { 101 PP_Bool* result) {
94 if (ppp_pdf_) { 102 if (ppp_pdf_) {
95 *result = CallWhileUnlocked( 103 *result = CallWhileUnlocked(
96 ppp_pdf_->GetPrintPresetOptionsFromDocument, instance, options); 104 ppp_pdf_->GetPrintPresetOptionsFromDocument, instance, options);
97 } 105 }
98 } 106 }
99 107
108 void PPP_Pdf_Proxy::OnPluginMsgEnableAccessibility(PP_Instance instance) {
109 if (ppp_pdf_)
110 CallWhileUnlocked(ppp_pdf_->EnableAccessibility, instance);
111 }
112
100 } // namespace proxy 113 } // namespace proxy
101 } // namespace ppapi 114 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppp_pdf_proxy.h ('k') | ppapi/thunk/ppb_pdf_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698