1 // Copyright (c) 2011 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.
5 #ifndef PPAPI_C_PRIVATE_PPB_PDF_H_
6 #define PPAPI_C_PRIVATE_PPB_PDF_H_
8 #include "ppapi/c/dev/ppb_font_dev.h"
9 #include "ppapi/c/pp_bool.h"
10 #include "ppapi/c/pp_instance.h"
11 #include "ppapi/c/pp_resource.h"
12 #include "ppapi/c/pp_var.h"
13 #include "ppapi/c/private/pp_private_font_charset.h"
15 #define PPB_PDF_INTERFACE "PPB_PDF;1"
17 // From the public PPB_Font_Dev file.
18 struct PP_FontDescription_Dev
;
21 PP_RESOURCESTRING_PDFGETPASSWORD
= 0,
22 PP_RESOURCESTRING_PDFLOADING
= 1,
23 PP_RESOURCESTRING_PDFLOAD_FAILED
= 2,
24 PP_RESOURCESTRING_PDFPROGRESSLOADING
= 3
28 PP_RESOURCEIMAGE_PDF_BUTTON_FTP
= 0,
29 PP_RESOURCEIMAGE_PDF_BUTTON_FTP_HOVER
= 1,
30 PP_RESOURCEIMAGE_PDF_BUTTON_FTP_PRESSED
= 2,
31 PP_RESOURCEIMAGE_PDF_BUTTON_FTW
= 3,
32 PP_RESOURCEIMAGE_PDF_BUTTON_FTW_HOVER
= 4,
33 PP_RESOURCEIMAGE_PDF_BUTTON_FTW_PRESSED
= 5,
34 PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN
= 6,
35 PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_HOVER
= 7,
36 PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_PRESSED
= 8,
37 PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT
= 9,
38 PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT_HOVER
= 10,
39 PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT_PRESSED
= 11,
40 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_0
= 12,
41 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_1
= 13,
42 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_2
= 14,
43 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_3
= 15,
44 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_4
= 16,
45 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_5
= 17,
46 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_6
= 18,
47 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_7
= 19,
48 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_8
= 20,
49 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_9
= 21,
50 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_NUM_BACKGROUND
= 22,
51 PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_0
= 23,
52 PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_1
= 24,
53 PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_2
= 25,
54 PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_3
= 26,
55 PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_4
= 27,
56 PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_5
= 28,
57 PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_6
= 29,
58 PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_7
= 30,
59 PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_8
= 31,
60 PP_RESOURCEIMAGE_PDF_PROGRESS_BAR_BACKGROUND
= 32,
61 PP_RESOURCEIMAGE_PDF_PAGE_DROPSHADOW
= 33,
62 PP_RESOURCEIMAGE_PDF_BUTTON_SAVE
= 34,
63 PP_RESOURCEIMAGE_PDF_BUTTON_SAVE_HOVER
= 35,
64 PP_RESOURCEIMAGE_PDF_BUTTON_SAVE_PRESSED
= 36,
65 PP_RESOURCEIMAGE_PDF_BUTTON_PRINT
= 37,
66 PP_RESOURCEIMAGE_PDF_BUTTON_PRINT_HOVER
= 38,
67 PP_RESOURCEIMAGE_PDF_BUTTON_PRINT_PRESSED
= 39,
68 PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_END
= 40,
69 PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_END_HOVER
= 41,
70 PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_END_PRESSED
= 42,
71 PP_RESOURCEIMAGE_PDF_PAN_SCROLL_ICON
= 43,
72 PP_RESOURCEIMAGE_PDF_PAGE_INDICATOR_BACKGROUND
= 44
76 PP_PDFFEATURE_HIDPI
= 0,
77 PP_PDFFEATURE_PRINTING
= 1
80 struct PP_PrivateFontFileDescription
{
86 struct PP_PrivateFindResult
{
92 // Returns a localized string.
93 struct PP_Var (*GetLocalizedString
)(PP_Instance instance
,
94 PP_ResourceString string_id
);
96 // Returns a resource image.
97 PP_Resource (*GetResourceImage
)(PP_Instance instance
,
98 PP_ResourceImage image_id
);
100 // Returns a resource identifying a font file corresponding to the given font
101 // request after applying the browser-specific fallback.
103 // Currently Linux-only.
104 PP_Resource (*GetFontFileWithFallback
)(
105 PP_Instance instance
,
106 const struct PP_BrowserFont_Trusted_Description
* description
,
107 PP_PrivateFontCharset charset
);
109 // Given a resource previously returned by GetFontFileWithFallback, returns
110 // a pointer to the requested font table. Linux only.
111 bool (*GetFontTableForPrivateFontFile
)(PP_Resource font_file
,
114 uint32_t* output_length
);
116 // Search the given string using ICU. Use PPB_Core's MemFree on results when
118 void (*SearchString
)(
119 PP_Instance instance
,
120 const unsigned short* string
,
121 const unsigned short* term
,
123 struct PP_PrivateFindResult
** results
,
126 // Since WebFrame doesn't know about PPAPI requests, it'll think the page has
127 // finished loading even if there are outstanding requests by the plugin.
128 // Take this out once WebFrame knows about requests by PPAPI plugins.
129 void (*DidStartLoading
)(PP_Instance instance
);
130 void (*DidStopLoading
)(PP_Instance instance
);
132 // Sets content restriction for a full-page plugin (i.e. can't copy/print).
133 // The value is a bitfield of ContentRestriction enums.
134 void (*SetContentRestriction
)(PP_Instance instance
, int restrictions
);
136 // Use UMA so we know average pdf page count.
137 void (*HistogramPDFPageCount
)(PP_Instance instance
, int count
);
139 // Notifies the browser that the given action has been performed.
140 void (*UserMetricsRecordAction
)(PP_Instance instance
, struct PP_Var action
);
142 // Notifies the browser that the PDF has an unsupported feature.
143 void (*HasUnsupportedFeature
)(PP_Instance instance
);
145 // Invoke SaveAs... dialog, similar to the right-click or wrench menu.
146 void (*SaveAs
)(PP_Instance instance
);
148 // Invoke Print dialog for plugin.
149 void (*Print
)(PP_Instance instance
);
151 PP_Bool(*IsFeatureEnabled
)(PP_Instance instance
, PP_PDFFeature feature
);
153 // Returns a resource image appropriate for a device with |scale| density.
154 // Returns 0 (NULL resource) if there is no resource at that scale
155 PP_Resource (*GetResourceImageForScale
)(PP_Instance instance
,
156 PP_ResourceImage image_id
,
160 #endif // PPAPI_C_PRIVATE_PPB_PDF_H_