OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PDF_PDF_ENGINE_H_ | 5 #ifndef PDF_PDF_ENGINE_H_ |
6 #define PDF_PDF_ENGINE_H_ | 6 #define PDF_PDF_ENGINE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 enum DocumentPermission { | 54 enum DocumentPermission { |
55 PERMISSION_COPY, | 55 PERMISSION_COPY, |
56 PERMISSION_COPY_ACCESSIBLE, | 56 PERMISSION_COPY_ACCESSIBLE, |
57 PERMISSION_PRINT_LOW_QUALITY, | 57 PERMISSION_PRINT_LOW_QUALITY, |
58 PERMISSION_PRINT_HIGH_QUALITY, | 58 PERMISSION_PRINT_HIGH_QUALITY, |
59 }; | 59 }; |
60 | 60 |
61 // The interface that's provided to the rendering engine. | 61 // The interface that's provided to the rendering engine. |
62 class Client { | 62 class Client { |
63 public: | 63 public: |
| 64 // JavaScript counterpart of the enum is in navigator.js |
| 65 // and they need to stay in sync. |
| 66 enum class NavigateOption { |
| 67 OPEN_IN_CURRENT_TAB = 0, |
| 68 OPEN_IN_NEW_BACKGROUND_TAB, |
| 69 OPEN_IN_NEW_FOREGROUND_TAB, |
| 70 OPEN_IN_NEW_WINDOW, |
| 71 }; |
| 72 |
64 virtual ~Client() {} | 73 virtual ~Client() {} |
65 | 74 |
66 // Informs the client about the document's size in pixels. | 75 // Informs the client about the document's size in pixels. |
67 virtual void DocumentSizeUpdated(const pp::Size& size) = 0; | 76 virtual void DocumentSizeUpdated(const pp::Size& size) = 0; |
68 | 77 |
69 // Informs the client that the given rect needs to be repainted. | 78 // Informs the client that the given rect needs to be repainted. |
70 virtual void Invalidate(const pp::Rect& rect) = 0; | 79 virtual void Invalidate(const pp::Rect& rect) = 0; |
71 | 80 |
72 // Informs the client to scroll the plugin area by the given offset. | 81 // Informs the client to scroll the plugin area by the given offset. |
73 virtual void Scroll(const pp::Point& point) = 0; | 82 virtual void Scroll(const pp::Point& point) = 0; |
74 | 83 |
75 // Scroll the horizontal/vertical scrollbars to a given position. | 84 // Scroll the horizontal/vertical scrollbars to a given position. |
76 virtual void ScrollToX(int position) = 0; | 85 virtual void ScrollToX(int position) = 0; |
77 virtual void ScrollToY(int position) = 0; | 86 virtual void ScrollToY(int position) = 0; |
78 | 87 |
79 // Scroll to the specified page. | 88 // Scroll to the specified page. |
80 virtual void ScrollToPage(int page) = 0; | 89 virtual void ScrollToPage(int page) = 0; |
81 | 90 |
82 // Navigate to the given url. | 91 // Navigate to the given url. |
83 virtual void NavigateTo(const std::string& url, bool open_in_new_tab) = 0; | 92 virtual void NavigateTo(const std::string& url, NavigateOption option) = 0; |
84 | 93 |
85 // Updates the cursor. | 94 // Updates the cursor. |
86 virtual void UpdateCursor(PP_CursorType_Dev cursor) = 0; | 95 virtual void UpdateCursor(PP_CursorType_Dev cursor) = 0; |
87 | 96 |
88 // Updates the tick marks in the vertical scrollbar. | 97 // Updates the tick marks in the vertical scrollbar. |
89 virtual void UpdateTickMarks(const std::vector<pp::Rect>& tickmarks) = 0; | 98 virtual void UpdateTickMarks(const std::vector<pp::Rect>& tickmarks) = 0; |
90 | 99 |
91 // Updates the number of find results for the current search term. If | 100 // Updates the number of find results for the current search term. If |
92 // there are no matches 0 should be passed in. Only when the plugin has | 101 // there are no matches 0 should be passed in. Only when the plugin has |
93 // finished searching should it pass in the final count with final_result | 102 // finished searching should it pass in the final count with final_result |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 359 |
351 // See the definition of GetPDFPageSizeByIndex in pdf.cc for details. | 360 // See the definition of GetPDFPageSizeByIndex in pdf.cc for details. |
352 virtual bool GetPDFPageSizeByIndex(const void* pdf_buffer, | 361 virtual bool GetPDFPageSizeByIndex(const void* pdf_buffer, |
353 int pdf_buffer_size, int page_number, | 362 int pdf_buffer_size, int page_number, |
354 double* width, double* height) = 0; | 363 double* width, double* height) = 0; |
355 }; | 364 }; |
356 | 365 |
357 } // namespace chrome_pdf | 366 } // namespace chrome_pdf |
358 | 367 |
359 #endif // PDF_PDF_ENGINE_H_ | 368 #endif // PDF_PDF_ENGINE_H_ |
OLD | NEW |