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,
73 PP_RESOURCEIMAGE_PDF_BUTTON_PRINT_DISABLED
= 45
77 PP_PDFFEATURE_HIDPI
= 0,
78 PP_PDFFEATURE_PRINTING
= 1
81 struct PP_PrivateFontFileDescription
{
87 struct PP_PrivateFindResult
{
93 // Returns a localized string.
94 struct PP_Var (*GetLocalizedString
)(PP_Instance instance
,
95 PP_ResourceString string_id
);
97 // Returns a resource image.
98 PP_Resource (*GetResourceImage
)(PP_Instance instance
,
99 PP_ResourceImage image_id
);
101 // Returns a resource identifying a font file corresponding to the given font
102 // request after applying the browser-specific fallback.
104 // Currently Linux-only.
105 PP_Resource (*GetFontFileWithFallback
)(
106 PP_Instance instance
,
107 const struct PP_BrowserFont_Trusted_Description
* description
,
108 PP_PrivateFontCharset charset
);
110 // Given a resource previously returned by GetFontFileWithFallback, returns
111 // a pointer to the requested font table. Linux only.
112 bool (*GetFontTableForPrivateFontFile
)(PP_Resource font_file
,
115 uint32_t* output_length
);
117 // Search the given string using ICU. Use PPB_Core's MemFree on results when
119 void (*SearchString
)(
120 PP_Instance instance
,
121 const unsigned short* string
,
122 const unsigned short* term
,
124 struct PP_PrivateFindResult
** results
,
127 // Since WebFrame doesn't know about PPAPI requests, it'll think the page has
128 // finished loading even if there are outstanding requests by the plugin.
129 // Take this out once WebFrame knows about requests by PPAPI plugins.
130 void (*DidStartLoading
)(PP_Instance instance
);
131 void (*DidStopLoading
)(PP_Instance instance
);
133 // Sets content restriction for a full-page plugin (i.e. can't copy/print).
134 // The value is a bitfield of ContentRestriction enums.
135 void (*SetContentRestriction
)(PP_Instance instance
, int restrictions
);
137 // Use UMA so we know average pdf page count.
138 void (*HistogramPDFPageCount
)(PP_Instance instance
, int count
);
140 // Notifies the browser that the given action has been performed.
141 void (*UserMetricsRecordAction
)(PP_Instance instance
, struct PP_Var action
);
143 // Notifies the browser that the PDF has an unsupported feature.
144 void (*HasUnsupportedFeature
)(PP_Instance instance
);
146 // Invoke SaveAs... dialog, similar to the right-click or wrench menu.
147 void (*SaveAs
)(PP_Instance instance
);
149 // Invoke Print dialog for plugin.
150 void (*Print
)(PP_Instance instance
);
152 PP_Bool(*IsFeatureEnabled
)(PP_Instance instance
, PP_PDFFeature feature
);
154 // Returns a resource image appropriate for a device with |scale| density.
155 // Returns 0 (NULL resource) if there is no resource at that scale
156 PP_Resource (*GetResourceImageForScale
)(PP_Instance instance
,
157 PP_ResourceImage image_id
,
161 #endif // PPAPI_C_PRIVATE_PPB_PDF_H_