1/* Copyright (c) 2012 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. 4 */ 5 6/* This file contains PPB_PDF interface. */ 7 8enum PP_ResourceString{ 9 PP_RESOURCESTRING_PDFGETPASSWORD = 0, 10 PP_RESOURCESTRING_PDFLOADING = 1, 11 PP_RESOURCESTRING_PDFLOAD_FAILED = 2 12}; 13 14enum PP_ResourceImage{ 15 PP_RESOURCEIMAGE_PDF_BUTTON_FTH = 0, 16 PP_RESOURCEIMAGE_PDF_BUTTON_FTH_HOVER = 1, 17 PP_RESOURCEIMAGE_PDF_BUTTON_FTH_PRESSED = 2, 18 PP_RESOURCEIMAGE_PDF_BUTTON_FTW = 3, 19 PP_RESOURCEIMAGE_PDF_BUTTON_FTW_HOVER = 4, 20 PP_RESOURCEIMAGE_PDF_BUTTON_FTW_PRESSED = 5, 21 PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN = 6, 22 PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_HOVER = 7, 23 PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_PRESSED = 8, 24 PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT = 9, 25 PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT_HOVER = 10, 26 PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT_PRESSED = 11, 27 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_0 = 12, 28 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_1 = 13, 29 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_2 = 14, 30 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_3 = 15, 31 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_4 = 16, 32 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_5 = 17, 33 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_6 = 18, 34 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_7 = 19, 35 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_8 = 20, 36 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_9 = 21, 37 PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_NUM_BACKGROUND = 22 38}; 39 40enum PP_PrivateFontCharset { 41 PP_PRIVATEFONTCHARSET_ANSI = 0, 42 PP_PRIVATEFONTCHARSET_DEFAULT = 1, 43 PP_PRIVATEFONTCHARSET_SYMBOL = 2, 44 PP_PRIVATEFONTCHARSET_MAC = 77, 45 PP_PRIVATEFONTCHARSET_SHIFTJIS = 128, 46 PP_PRIVATEFONTCHARSET_HANGUL = 129, 47 PP_PRIVATEFONTCHARSET_JOHAB = 130, 48 PP_PRIVATEFONTCHARSET_GB2312 = 134, 49 PP_PRIVATEFONTCHARSET_CHINESEBIG5 = 136, 50 PP_PRIVATEFONTCHARSET_GREEK = 161, 51 PP_PRIVATEFONTCHARSET_TURKISH = 162, 52 PP_PRIVATEFONTCHARSET_VIETNAMESE = 163, 53 PP_PRIVATEFONTCHARSET_HEBREW = 177, 54 PP_PRIVATEFONTCHARSET_ARABIC = 178, 55 PP_PRIVATEFONTCHARSET_BALTIC = 186, 56 PP_PRIVATEFONTCHARSET_RUSSIAN = 204, 57 PP_PRIVATEFONTCHARSET_THAI = 222, 58 PP_PRIVATEFONTCHARSET_EASTEUROPE = 238, 59 PP_PRIVATEFONTCHARSET_OEM = 255 60}; 61 62struct PP_PrivateFontFileDescription { 63 str_t face; 64 uint32_t weight; 65 PP_Bool italic; 66}; 67 68struct PP_PrivateFindResult { 69 int32_t start_index; 70 int32_t length; 71}; 72 73interface PPB_PDF_0_1 { 74 /* Returns a localized string. */ 75 PP_Var GetLocalizedString( 76 [in] PP_Instance instance, 77 [in] PP_ResourceString string_id); 78 79 /* Returns a resource image. */ 80 PP_Resource GetResourceImage( 81 [in] PP_Instance instance, 82 [in] PP_ResourceImage image_id); 83 84 /* Returns a resource identifying a font file corresponding to the given font 85 * request after applying the browser-specific fallback. 86 * 87 * Currently Linux-only. 88 */ 89 PP_Resource GetFontFileWithFallback( 90 [in] PP_Instance instance, 91 [in] PP_FontDescription_Dev description, 92 [in] PP_PrivateFontCharset charset); 93 94 /* Given a resource previously returned by GetFontFileWithFallback, returns 95 * a pointer to the requested font table. Linux only. 96 */ 97 PP_Bool GetFontTableForPrivateFontFile( 98 [in] PP_Resource font_file, 99 [in] uint32_t table, 100 [out] mem_t output, 101 [out] uint32_t output_length); 102 103 /* Search the given string using ICU. Use PPB_Core's MemFree on results when 104 * done. 105 */ 106 void SearchString( 107 [in] PP_Instance instance, 108 [in] mem_t string, 109 [in] mem_t term, 110 [in] PP_Bool case_sensitive, 111 [out, size_is(count)] PP_PrivateFindResult[] results, 112 [out] int32_t count); 113 114 /* Since WebFrame doesn't know about PPAPI requests, it'll think the page has 115 * finished loading even if there are outstanding requests by the plugin. 116 * Take this out once WebFrame knows about requests by PPAPI plugins. 117 */ 118 void DidStartLoading( 119 [in] PP_Instance instance); 120 void DidStopLoading( 121 [in] PP_Instance instance); 122 123 /* Sets content restriction for a full-page plugin (i.e. can't copy/print). 124 * The value is a bitfield of ContentRestriction enums. 125 */ 126 void SetContentRestriction( 127 [in] PP_Instance instance, 128 [in] int32_t restrictions); 129 130 /* Use UMA so we know average pdf page count. */ 131 void HistogramPDFPageCount( 132 [in] int32_t count); 133 134 /* Notifies the browser that the given action has been performed. */ 135 void UserMetricsRecordAction( 136 [in] PP_Var action); 137 138 /* Notifies the browser that the PDF has an unsupported feature. */ 139 void HasUnsupportedFeature( 140 [in] PP_Instance instance); 141 142 /* Tells the browser to open a dialog box to receive a password from the 143 * user, masking input characters. Returns the value entered by the user, or 144 * an empty string if the user cancels instead. 145 */ 146 PP_Var ModalPromptForPassword( 147 [in] PP_Instance instance, 148 [in] PP_Var message); 149 150 /* Returns PP_TRUE if the plugin is out of process. */ 151 PP_Bool IsOutOfProcess( 152 [in] PP_Instance instance); 153 154 /* Sets the selected text of the plugin. If |selected_text| is empty, then no 155 * text is selected. */ 156 void SetSelectedText( 157 [in] PP_Instance instance, 158 [in] str_t selected_text); 159 160 /* Sets the link under the cursor. If |url| is empty, then no link is under 161 * the cursor. */ 162 void SetLinkUnderCursor( 163 [in] PP_Instance instance, 164 [in] str_t url); 165}; 166