summaryrefslogtreecommitdiff
path: root/chromium/pdf/pdf_engine.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-24 12:15:48 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-28 13:30:04 +0000
commitb014812705fc80bff0a5c120dfcef88f349816dc (patch)
tree25a2e2d9fa285f1add86aa333389a839f81a39ae /chromium/pdf/pdf_engine.h
parent9f4560b1027ae06fdb497023cdcaf91b8511fa74 (diff)
downloadqtwebengine-chromium-b014812705fc80bff0a5c120dfcef88f349816dc.tar.gz
BASELINE: Update Chromium to 68.0.3440.125
Change-Id: I23f19369e01f688e496f5bf179abb521ad73874f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/pdf/pdf_engine.h')
-rw-r--r--chromium/pdf/pdf_engine.h80
1 files changed, 47 insertions, 33 deletions
diff --git a/chromium/pdf/pdf_engine.h b/chromium/pdf/pdf_engine.h
index e547974bfa7..88d8e3fe22a 100644
--- a/chromium/pdf/pdf_engine.h
+++ b/chromium/pdf/pdf_engine.h
@@ -39,6 +39,8 @@ typedef void (*PDFEnsureTypefaceCharactersAccessible)(const LOGFONT* font,
size_t text_length);
#endif
+struct PP_PdfPrintSettings_Dev;
+
namespace pp {
class InputEvent;
class VarDictionary;
@@ -129,60 +131,63 @@ class PDFEngine {
virtual ~Client() {}
// Informs the client about the document's size in pixels.
- virtual void DocumentSizeUpdated(const pp::Size& size) = 0;
+ virtual void DocumentSizeUpdated(const pp::Size& size) {}
// Informs the client that the given rect needs to be repainted.
- virtual void Invalidate(const pp::Rect& rect) = 0;
+ virtual void Invalidate(const pp::Rect& rect) {}
// Informs the client to scroll the plugin area by the given offset.
- virtual void DidScroll(const pp::Point& point) = 0;
+ virtual void DidScroll(const pp::Point& point) {}
// Scroll the horizontal/vertical scrollbars to a given position.
// Values are in screen coordinates, where 0 is the top/left of the document
// and a positive value is the distance in pixels from that line.
// For ScrollToY, setting |compensate_for_toolbar| will align the position
// with the bottom of the toolbar so the given position is always visible.
- virtual void ScrollToX(int x_in_screen_coords) = 0;
+ virtual void ScrollToX(int x_in_screen_coords) {}
virtual void ScrollToY(int y_in_screen_coords,
- bool compensate_for_toolbar) = 0;
+ bool compensate_for_toolbar) {}
// Scroll by a given delta relative to the current position.
- virtual void ScrollBy(const pp::Point& point) = 0;
+ virtual void ScrollBy(const pp::Point& point) {}
// Scroll to zero-based |page|.
- virtual void ScrollToPage(int page) = 0;
+ virtual void ScrollToPage(int page) {}
// Navigate to the given url.
virtual void NavigateTo(const std::string& url,
- WindowOpenDisposition disposition) = 0;
+ WindowOpenDisposition disposition) {}
// Updates the cursor.
- virtual void UpdateCursor(PP_CursorType_Dev cursor) = 0;
+ virtual void UpdateCursor(PP_CursorType_Dev cursor) {}
// Updates the tick marks in the vertical scrollbar.
- virtual void UpdateTickMarks(const std::vector<pp::Rect>& tickmarks) = 0;
+ virtual void UpdateTickMarks(const std::vector<pp::Rect>& tickmarks) {}
// Updates the number of find results for the current search term. If
// there are no matches 0 should be passed in. Only when the plugin has
// finished searching should it pass in the final count with final_result
// set to true.
virtual void NotifyNumberOfFindResultsChanged(int total,
- bool final_result) = 0;
+ bool final_result) {}
// Updates the index of the currently selected search item.
- virtual void NotifySelectedFindResultChanged(int current_find_index) = 0;
+ virtual void NotifySelectedFindResultChanged(int current_find_index) {}
// Notifies a page became visible.
virtual void NotifyPageBecameVisible(
- const PDFEngine::PageFeatures* page_features) = 0;
+ const PDFEngine::PageFeatures* page_features) {}
// Prompts the user for a password to open this document. The callback is
// called when the password is retrieved.
virtual void GetDocumentPassword(
- pp::CompletionCallbackWithOutput<pp::Var> callback) = 0;
+ pp::CompletionCallbackWithOutput<pp::Var> callback) {}
+
+ // Play a "beeping" sound.
+ virtual void Beep() {}
// Puts up an alert with the given message.
- virtual void Alert(const std::string& message) = 0;
+ virtual void Alert(const std::string& message) {}
// Puts up a confirm with the given message, and returns true if the user
// presses OK, or false if they press cancel.
@@ -201,24 +206,24 @@ class PDFEngine {
const std::string& cc,
const std::string& bcc,
const std::string& subject,
- const std::string& body) = 0;
+ const std::string& body) {}
// Put up the print dialog.
- virtual void Print() = 0;
+ virtual void Print() {}
// Submit the data using HTTP POST.
virtual void SubmitForm(const std::string& url,
const void* data,
- int length) = 0;
+ int length) {}
// Creates and returns new URL loader for partial document requests.
virtual pp::URLLoader CreateURLLoader() = 0;
// Calls the client's OnCallback() function in |delay| with the given |id|.
- virtual void ScheduleCallback(int id, base::TimeDelta delay) = 0;
+ virtual void ScheduleCallback(int id, base::TimeDelta delay) {}
// Calls the client's OnTouchTimerCallback() function in |delay| with the
// given |id|.
- virtual void ScheduleTouchTimerCallback(int id, base::TimeDelta delay) = 0;
+ virtual void ScheduleTouchTimerCallback(int id, base::TimeDelta delay) {}
// Searches the given string for "term" and returns the results. Unicode-
// aware.
@@ -232,29 +237,28 @@ class PDFEngine {
bool case_sensitive) = 0;
// Notifies the client that the engine has painted a page from the document.
- virtual void DocumentPaintOccurred() = 0;
+ virtual void DocumentPaintOccurred() {}
// Notifies the client that the document has finished loading.
virtual void DocumentLoadComplete(const DocumentFeatures& document_features,
- uint32_t file_size) = 0;
+ uint32_t file_size) {}
// Notifies the client that the document has failed to load.
- virtual void DocumentLoadFailed() = 0;
+ virtual void DocumentLoadFailed() {}
// Notifies the client that the document has requested substitute fonts.
- virtual void FontSubstituted() = 0;
+ virtual void FontSubstituted() {}
virtual pp::Instance* GetPluginInstance() = 0;
// Notifies that an unsupported feature in the PDF was encountered.
- virtual void DocumentHasUnsupportedFeature(const std::string& feature) = 0;
+ virtual void DocumentHasUnsupportedFeature(const std::string& feature) {}
// Notifies the client about document load progress.
- virtual void DocumentLoadProgress(uint32_t available,
- uint32_t doc_size) = 0;
+ virtual void DocumentLoadProgress(uint32_t available, uint32_t doc_size) {}
// Notifies the client about focus changes for form text fields.
- virtual void FormTextFieldFocusChange(bool in_focus) = 0;
+ virtual void FormTextFieldFocusChange(bool in_focus) {}
// Returns true if the plugin has been opened within print preview.
virtual bool IsPrintPreview() = 0;
@@ -263,7 +267,7 @@ class PDFEngine {
virtual uint32_t GetBackgroundColor() = 0;
// Cancel browser initiated document download.
- virtual void CancelBrowserDownload() = 0;
+ virtual void CancelBrowserDownload() {}
// Sets selection status.
virtual void IsSelectingChanged(bool is_selecting) {}
@@ -280,7 +284,8 @@ class PDFEngine {
};
// Factory method to create an instance of the PDF Engine.
- static std::unique_ptr<PDFEngine> Create(Client* client);
+ static std::unique_ptr<PDFEngine> Create(Client* client,
+ bool enable_javascript);
virtual ~PDFEngine() {}
@@ -306,7 +311,8 @@ class PDFEngine {
virtual pp::Resource PrintPages(
const PP_PrintPageNumberRange_Dev* page_ranges,
uint32_t page_range_count,
- const PP_PrintSettings_Dev& print_settings) = 0;
+ const PP_PrintSettings_Dev& print_settings,
+ const PP_PdfPrintSettings_Dev& pdf_print_settings) = 0;
virtual void PrintEnd() = 0;
virtual void StartFind(const std::string& text, bool case_sensitive) = 0;
virtual bool SelectFindResult(bool forward) = 0;
@@ -315,13 +321,20 @@ class PDFEngine {
virtual void RotateClockwise() = 0;
virtual void RotateCounterclockwise() = 0;
virtual std::string GetSelectedText() = 0;
- // Returns true if focus is within an editable form text area, and false
- // otherwise.
+ // Returns true if focus is within an editable form text area.
virtual bool CanEditText() = 0;
+ // Returns true if focus is within an editable form text area and the text
+ // area has text.
+ virtual bool HasEditableText() = 0;
// Replace selected text within an editable form text area with another
// string. If there is no selected text, append the replacement text after the
// current caret position.
virtual void ReplaceSelection(const std::string& text) = 0;
+ // Methods to check if undo/redo is possible, and to perform them.
+ virtual bool CanUndo() = 0;
+ virtual bool CanRedo() = 0;
+ virtual void Undo() = 0;
+ virtual void Redo() = 0;
virtual std::string GetLinkAtPosition(const pp::Point& point) = 0;
// Checks the permissions associated with this document.
virtual bool HasPermission(DocumentPermission permission) const = 0;
@@ -443,6 +456,7 @@ class PDFEngineExports {
PDFEngineExports() {}
virtual ~PDFEngineExports() {}
+
static PDFEngineExports* Get();
#if defined(OS_WIN)