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_INSTANCE_H_ | 5 #ifndef PDF_INSTANCE_H_ |
6 #define PDF_INSTANCE_H_ | 6 #define PDF_INSTANCE_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 public pp::Printing_Dev, | 51 public pp::Printing_Dev, |
52 public pp::Selection_Dev, | 52 public pp::Selection_Dev, |
53 public pp::WidgetClient_Dev, | 53 public pp::WidgetClient_Dev, |
54 public pp::Zoom_Dev, | 54 public pp::Zoom_Dev, |
55 public PaintManager::Client, | 55 public PaintManager::Client, |
56 public PDFEngine::Client, | 56 public PDFEngine::Client, |
57 public PreviewModeClient::Client, | 57 public PreviewModeClient::Client, |
58 public ControlOwner { | 58 public ControlOwner { |
59 public: | 59 public: |
60 explicit Instance(PP_Instance instance); | 60 explicit Instance(PP_Instance instance); |
61 virtual ~Instance(); | 61 ~Instance() override; |
62 | 62 |
63 // pp::Instance implementation. | 63 // pp::Instance implementation. |
64 virtual bool Init(uint32_t argc, | 64 bool Init(uint32_t argc, |
65 const char* argn[], | 65 const char* argn[], |
66 const char* argv[]) override; | 66 const char* argv[]) override; |
67 virtual bool HandleDocumentLoad(const pp::URLLoader& loader) override; | 67 bool HandleDocumentLoad(const pp::URLLoader& loader) override; |
68 virtual bool HandleInputEvent(const pp::InputEvent& event) override; | 68 bool HandleInputEvent(const pp::InputEvent& event) override; |
69 virtual void DidChangeView(const pp::View& view) override; | 69 void DidChangeView(const pp::View& view) override; |
70 virtual pp::Var GetInstanceObject() override; | 70 pp::Var GetInstanceObject() override; |
71 | 71 |
72 // pp::Find_Private implementation. | 72 // pp::Find_Private implementation. |
73 virtual bool StartFind(const std::string& text, bool case_sensitive) override; | 73 bool StartFind(const std::string& text, bool case_sensitive) override; |
74 virtual void SelectFindResult(bool forward) override; | 74 void SelectFindResult(bool forward) override; |
75 virtual void StopFind() override; | 75 void StopFind() override; |
76 | 76 |
77 // pp::PaintManager::Client implementation. | 77 // pp::PaintManager::Client implementation. |
78 virtual void OnPaint(const std::vector<pp::Rect>& paint_rects, | 78 void OnPaint(const std::vector<pp::Rect>& paint_rects, |
79 std::vector<PaintManager::ReadyRect>* ready, | 79 std::vector<PaintManager::ReadyRect>* ready, |
80 std::vector<pp::Rect>* pending) override; | 80 std::vector<pp::Rect>* pending) override; |
81 | 81 |
82 // pp::Printing_Dev implementation. | 82 // pp::Printing_Dev implementation. |
83 virtual uint32_t QuerySupportedPrintOutputFormats() override; | 83 uint32_t QuerySupportedPrintOutputFormats() override; |
84 virtual int32_t PrintBegin( | 84 int32_t PrintBegin( |
85 const PP_PrintSettings_Dev& print_settings) override; | 85 const PP_PrintSettings_Dev& print_settings) override; |
86 virtual pp::Resource PrintPages( | 86 pp::Resource PrintPages( |
87 const PP_PrintPageNumberRange_Dev* page_ranges, | 87 const PP_PrintPageNumberRange_Dev* page_ranges, |
88 uint32_t page_range_count) override; | 88 uint32_t page_range_count) override; |
89 virtual void PrintEnd() override; | 89 void PrintEnd() override; |
90 virtual bool IsPrintScalingDisabled() override; | 90 bool IsPrintScalingDisabled() override; |
91 | 91 |
92 // pp::Private implementation. | 92 // pp::Private implementation. |
93 virtual pp::Var GetLinkAtPosition(const pp::Point& point); | 93 virtual pp::Var GetLinkAtPosition(const pp::Point& point); |
94 virtual void GetPrintPresetOptionsFromDocument( | 94 virtual void GetPrintPresetOptionsFromDocument( |
95 PP_PdfPrintPresetOptions_Dev* options); | 95 PP_PdfPrintPresetOptions_Dev* options); |
96 | 96 |
97 // PPP_Selection_Dev implementation. | 97 // PPP_Selection_Dev implementation. |
98 virtual pp::Var GetSelectedText(bool html) override; | 98 pp::Var GetSelectedText(bool html) override; |
99 | 99 |
100 // WidgetClient_Dev implementation. | 100 // WidgetClient_Dev implementation. |
101 virtual void InvalidateWidget(pp::Widget_Dev widget, | 101 void InvalidateWidget(pp::Widget_Dev widget, |
102 const pp::Rect& dirty_rect) override; | 102 const pp::Rect& dirty_rect) override; |
103 virtual void ScrollbarValueChanged(pp::Scrollbar_Dev scrollbar, | 103 void ScrollbarValueChanged(pp::Scrollbar_Dev scrollbar, |
104 uint32_t value) override; | 104 uint32_t value) override; |
105 virtual void ScrollbarOverlayChanged(pp::Scrollbar_Dev scrollbar, | 105 void ScrollbarOverlayChanged(pp::Scrollbar_Dev scrollbar, |
106 bool overlay) override; | 106 bool overlay) override; |
107 | 107 |
108 // pp::Zoom_Dev implementation. | 108 // pp::Zoom_Dev implementation. |
109 virtual void Zoom(double scale, bool text_only) override; | 109 void Zoom(double scale, bool text_only) override; |
110 void ZoomChanged(double factor); // Override. | 110 void ZoomChanged(double factor); // Override. |
111 | 111 |
112 void FlushCallback(int32_t result); | 112 void FlushCallback(int32_t result); |
113 void DidOpen(int32_t result); | 113 void DidOpen(int32_t result); |
114 void DidOpenPreview(int32_t result); | 114 void DidOpenPreview(int32_t result); |
115 // If the given widget intersects the rectangle, paints it and adds the | 115 // If the given widget intersects the rectangle, paints it and adds the |
116 // rect to ready. | 116 // rect to ready. |
117 void PaintIfWidgetIntersects(pp::Widget_Dev* widget, | 117 void PaintIfWidgetIntersects(pp::Widget_Dev* widget, |
118 const pp::Rect& rect, | 118 const pp::Rect& rect, |
119 std::vector<PaintManager::ReadyRect>* ready, | 119 std::vector<PaintManager::ReadyRect>* ready, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 bool dont_paint() const { return dont_paint_; } | 187 bool dont_paint() const { return dont_paint_; } |
188 void set_dont_paint(bool dont_paint) { dont_paint_ = dont_paint; } | 188 void set_dont_paint(bool dont_paint) { dont_paint_ = dont_paint; } |
189 | 189 |
190 // Called by PDFScriptableObject. | 190 // Called by PDFScriptableObject. |
191 bool HasScriptableMethod(const pp::Var& method, pp::Var* exception); | 191 bool HasScriptableMethod(const pp::Var& method, pp::Var* exception); |
192 pp::Var CallScriptableMethod(const pp::Var& method, | 192 pp::Var CallScriptableMethod(const pp::Var& method, |
193 const std::vector<pp::Var>& args, | 193 const std::vector<pp::Var>& args, |
194 pp::Var* exception); | 194 pp::Var* exception); |
195 | 195 |
196 // PreviewModeClient::Client implementation. | 196 // PreviewModeClient::Client implementation. |
197 virtual void PreviewDocumentLoadComplete() override; | 197 void PreviewDocumentLoadComplete() override; |
198 virtual void PreviewDocumentLoadFailed() override; | 198 void PreviewDocumentLoadFailed() override; |
199 | 199 |
200 // Helper functions for implementing PPP_PDF. | 200 // Helper functions for implementing PPP_PDF. |
201 void RotateClockwise(); | 201 void RotateClockwise(); |
202 void RotateCounterclockwise(); | 202 void RotateCounterclockwise(); |
203 | 203 |
204 // Helper function to inform when mouse pointer is on scrollbar, returns true | 204 // Helper function to inform when mouse pointer is on scrollbar, returns true |
205 // when mouse is on vertical or horizaontal scrollbar else returns false. | 205 // when mouse is on vertical or horizaontal scrollbar else returns false. |
206 bool IsMouseOnScrollbar(const pp::InputEvent& event); | 206 bool IsMouseOnScrollbar(const pp::InputEvent& event); |
207 | 207 |
208 private: | 208 private: |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 const std::vector<pp::Var>& args, | 530 const std::vector<pp::Var>& args, |
531 pp::Var* exception); | 531 pp::Var* exception); |
532 | 532 |
533 private: | 533 private: |
534 Instance* instance_; | 534 Instance* instance_; |
535 }; | 535 }; |
536 | 536 |
537 } // namespace chrome_pdf | 537 } // namespace chrome_pdf |
538 | 538 |
539 #endif // PDF_INSTANCE_H_ | 539 #endif // PDF_INSTANCE_H_ |
OLD | NEW |