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