| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_PREVIEW_MODE_CLIENT_H_ | 5 #ifndef PDF_PREVIEW_MODE_CLIENT_H_ |
| 6 #define PDF_PREVIEW_MODE_CLIENT_H_ | 6 #define PDF_PREVIEW_MODE_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "pdf/pdf_engine.h" | 13 #include "pdf/pdf_engine.h" |
| 14 | 14 |
| 15 namespace chrome_pdf { | 15 namespace chrome_pdf { |
| 16 | 16 |
| 17 // The interface that's provided to the print preview rendering engine. | 17 // The interface that's provided to the print preview rendering engine. |
| 18 class PreviewModeClient : public PDFEngine::Client { | 18 class PreviewModeClient : public PDFEngine::Client { |
| 19 public: | 19 public: |
| 20 class Client { | 20 class Client { |
| 21 public: | 21 public: |
| 22 virtual void PreviewDocumentLoadFailed() = 0; | 22 virtual void PreviewDocumentLoadFailed() = 0; |
| 23 virtual void PreviewDocumentLoadComplete() = 0; | 23 virtual void PreviewDocumentLoadComplete() = 0; |
| 24 }; | 24 }; |
| 25 |
| 25 explicit PreviewModeClient(Client* client); | 26 explicit PreviewModeClient(Client* client); |
| 26 virtual ~PreviewModeClient() {} | 27 ~PreviewModeClient() override {} |
| 27 | 28 |
| 28 // PDFEngine::Client implementation. | 29 // PDFEngine::Client implementation. |
| 29 virtual void DocumentSizeUpdated(const pp::Size& size); | 30 void DocumentSizeUpdated(const pp::Size& size) override; |
| 30 virtual void Invalidate(const pp::Rect& rect); | 31 void Invalidate(const pp::Rect& rect) override; |
| 31 virtual void Scroll(const pp::Point& point); | 32 void Scroll(const pp::Point& point) override; |
| 32 virtual void ScrollToX(int position); | 33 void ScrollToX(int position) override; |
| 33 virtual void ScrollToY(int position); | 34 void ScrollToY(int position) override; |
| 34 virtual void ScrollToPage(int page); | 35 void ScrollToPage(int page) override; |
| 35 virtual void NavigateTo(const std::string& url, bool open_in_new_tab); | 36 void NavigateTo(const std::string& url, bool open_in_new_tab) override; |
| 36 virtual void UpdateCursor(PP_CursorType_Dev cursor); | 37 void UpdateCursor(PP_CursorType_Dev cursor) override; |
| 37 virtual void UpdateTickMarks(const std::vector<pp::Rect>& tickmarks); | 38 void UpdateTickMarks(const std::vector<pp::Rect>& tickmarks) override; |
| 38 virtual void NotifyNumberOfFindResultsChanged(int total, | 39 void NotifyNumberOfFindResultsChanged(int total, bool final_result) override; |
| 39 bool final_result); | 40 void NotifySelectedFindResultChanged(int current_find_index) override; |
| 40 virtual void NotifySelectedFindResultChanged(int current_find_index); | 41 void GetDocumentPassword( |
| 41 virtual void GetDocumentPassword( | 42 pp::CompletionCallbackWithOutput<pp::Var> callback) override; |
| 42 pp::CompletionCallbackWithOutput<pp::Var> callback); | 43 void Alert(const std::string& message) override; |
| 43 virtual void Alert(const std::string& message); | 44 bool Confirm(const std::string& message) override; |
| 44 virtual bool Confirm(const std::string& message); | 45 std::string Prompt(const std::string& question, |
| 45 virtual std::string Prompt(const std::string& question, | 46 const std::string& default_answer) override; |
| 46 const std::string& default_answer); | 47 std::string GetURL() override; |
| 47 virtual std::string GetURL(); | 48 void Email(const std::string& to, |
| 48 virtual void Email(const std::string& to, | 49 const std::string& cc, |
| 49 const std::string& cc, | 50 const std::string& bcc, |
| 50 const std::string& bcc, | 51 const std::string& subject, |
| 51 const std::string& subject, | 52 const std::string& body) override; |
| 52 const std::string& body); | 53 void Print() override; |
| 53 virtual void Print(); | 54 void SubmitForm(const std::string& url, |
| 54 virtual void SubmitForm(const std::string& url, | 55 const void* data, |
| 55 const void* data, | 56 int length) override; |
| 56 int length); | 57 std::string ShowFileSelectionDialog() override; |
| 57 virtual std::string ShowFileSelectionDialog(); | 58 pp::URLLoader CreateURLLoader() override; |
| 58 virtual pp::URLLoader CreateURLLoader(); | 59 void ScheduleCallback(int id, int delay_in_ms) override; |
| 59 virtual void ScheduleCallback(int id, int delay_in_ms); | 60 void SearchString(const base::char16* string, |
| 60 virtual void SearchString(const base::char16* string, | 61 const base::char16* term, |
| 61 const base::char16* term, | 62 bool case_sensitive, |
| 62 bool case_sensitive, | 63 std::vector<SearchStringResult>* results) override; |
| 63 std::vector<SearchStringResult>* results); | 64 void DocumentPaintOccurred() override; |
| 64 virtual void DocumentPaintOccurred(); | 65 void DocumentLoadComplete(int page_count) override; |
| 65 virtual void DocumentLoadComplete(int page_count); | 66 void DocumentLoadFailed() override; |
| 66 virtual void DocumentLoadFailed(); | 67 pp::Instance* GetPluginInstance() override; |
| 67 virtual pp::Instance* GetPluginInstance(); | 68 void DocumentHasUnsupportedFeature(const std::string& feature) override; |
| 68 virtual void DocumentHasUnsupportedFeature(const std::string& feature); | 69 void DocumentLoadProgress(uint32_t available, uint32_t doc_size) override; |
| 69 virtual void DocumentLoadProgress(uint32_t available, uint32_t doc_size); | 70 void FormTextFieldFocusChange(bool in_focus) override; |
| 70 virtual void FormTextFieldFocusChange(bool in_focus); | 71 bool IsPrintPreview() override; |
| 71 virtual bool IsPrintPreview(); | 72 uint32_t GetBackgroundColor() override; |
| 72 virtual uint32_t GetBackgroundColor(); | |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 Client* client_; | 75 Client* const client_; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 } // namespace chrome_pdf | 78 } // namespace chrome_pdf |
| 79 | 79 |
| 80 #endif // PDF_PREVIEW_MODE_CLIENT_H_ | 80 #endif // PDF_PREVIEW_MODE_CLIENT_H_ |
| OLD | NEW |