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_PDFFEATURE_HIDPI
= 0,
22 PP_PDFFEATURE_PRINTING
= 1
25 struct PP_PrivateFontFileDescription
{
31 struct PP_PrivateFindResult
{
37 // Returns a resource identifying a font file corresponding to the given font
38 // request after applying the browser-specific fallback.
40 // Currently Linux-only.
41 PP_Resource (*GetFontFileWithFallback
)(
43 const struct PP_BrowserFont_Trusted_Description
* description
,
44 PP_PrivateFontCharset charset
);
46 // Given a resource previously returned by GetFontFileWithFallback, returns
47 // a pointer to the requested font table. Linux only.
48 bool (*GetFontTableForPrivateFontFile
)(PP_Resource font_file
,
51 uint32_t* output_length
);
53 // Search the given string using ICU. Use PPB_Core's MemFree on results when
57 const unsigned short* string
,
58 const unsigned short* term
,
60 struct PP_PrivateFindResult
** results
,
63 // Since WebFrame doesn't know about PPAPI requests, it'll think the page has
64 // finished loading even if there are outstanding requests by the plugin.
65 // Take this out once WebFrame knows about requests by PPAPI plugins.
66 void (*DidStartLoading
)(PP_Instance instance
);
67 void (*DidStopLoading
)(PP_Instance instance
);
69 // Sets content restriction for a full-page plugin (i.e. can't copy/print).
70 // The value is a bitfield of ContentRestriction enums.
71 void (*SetContentRestriction
)(PP_Instance instance
, int restrictions
);
73 // Notifies the browser that the given action has been performed.
74 void (*UserMetricsRecordAction
)(PP_Instance instance
, struct PP_Var action
);
76 // Notifies the browser that the PDF has an unsupported feature.
77 void (*HasUnsupportedFeature
)(PP_Instance instance
);
79 // Invoke SaveAs... dialog, similar to the right-click or wrench menu.
80 void (*SaveAs
)(PP_Instance instance
);
82 // Invoke Print dialog for plugin.
83 void (*Print
)(PP_Instance instance
);
85 PP_Bool(*IsFeatureEnabled
)(PP_Instance instance
, PP_PDFFeature feature
);
87 // Sets the selected text of the plugin.
88 void(*SetSelectedText
)(PP_Instance instance
, const char* selected_text
);
90 // Sets the link currently under the cursor.
91 void (*SetLinkUnderCursor
)(PP_Instance instance
, const char* url
);
93 // Gets pointers to both the mmap'd V8 snapshot files and their sizes.
94 // This is needed when loading V8's initial snapshot from external files.
95 void (*GetV8ExternalSnapshotData
)(PP_Instance instance
,
96 const char** natives_data_out
,
97 int* natives_size_out
,
98 const char** snapshot_data_out
,
99 int* snapshot_size_out
);
102 #endif // PPAPI_C_PRIVATE_PPB_PDF_H_