Upload upstream chromium 67.0.3396
[platform/framework/web/chromium-efl.git] / pdf / preview_mode_client.h
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
3 // found in the LICENSE file.
4
5 #ifndef PDF_PREVIEW_MODE_CLIENT_H_
6 #define PDF_PREVIEW_MODE_CLIENT_H_
7
8 #include <stdint.h>
9
10 #include <string>
11 #include <vector>
12
13 #include "pdf/pdf_engine.h"
14
15 namespace chrome_pdf {
16
17 // The interface that's provided to the print preview rendering engine.
18 class PreviewModeClient : public PDFEngine::Client {
19  public:
20   class Client {
21    public:
22     virtual void PreviewDocumentLoadFailed() = 0;
23     virtual void PreviewDocumentLoadComplete() = 0;
24   };
25
26   explicit PreviewModeClient(Client* client);
27   ~PreviewModeClient() override {}
28
29   // PDFEngine::Client implementation.
30   void DocumentSizeUpdated(const pp::Size& size) override;
31   void Invalidate(const pp::Rect& rect) override;
32   void DidScroll(const pp::Point& point) override;
33   void ScrollToX(int x_in_screen_coords) override;
34   void ScrollToY(int y_in_screen_coords, bool compensate_for_toolbar) override;
35   void ScrollBy(const pp::Point& point) override;
36   void ScrollToPage(int page) override;
37   void NavigateTo(const std::string& url,
38                   WindowOpenDisposition disposition) override;
39   void UpdateCursor(PP_CursorType_Dev cursor) override;
40   void UpdateTickMarks(const std::vector<pp::Rect>& tickmarks) override;
41   void NotifyNumberOfFindResultsChanged(int total, bool final_result) override;
42   void NotifySelectedFindResultChanged(int current_find_index) override;
43   void NotifyPageBecameVisible(
44       const PDFEngine::PageFeatures* page_features) override;
45   void GetDocumentPassword(
46       pp::CompletionCallbackWithOutput<pp::Var> callback) override;
47   void Alert(const std::string& message) override;
48   bool Confirm(const std::string& message) override;
49   std::string Prompt(const std::string& question,
50                      const std::string& default_answer) override;
51   std::string GetURL() override;
52   void Email(const std::string& to,
53              const std::string& cc,
54              const std::string& bcc,
55              const std::string& subject,
56              const std::string& body) override;
57   void Print() override;
58   void SubmitForm(const std::string& url,
59                   const void* data,
60                   int length) override;
61   pp::URLLoader CreateURLLoader() override;
62   void ScheduleCallback(int id, base::TimeDelta delay) override;
63   void ScheduleTouchTimerCallback(int id, base::TimeDelta delay) override;
64   std::vector<SearchStringResult> SearchString(const base::char16* string,
65                                                const base::char16* term,
66                                                bool case_sensitive) override;
67   void DocumentPaintOccurred() override;
68   void DocumentLoadComplete(
69       const PDFEngine::DocumentFeatures& document_features,
70       uint32_t file_size) override;
71   void DocumentLoadFailed() override;
72   void FontSubstituted() override;
73   pp::Instance* GetPluginInstance() override;
74   void DocumentHasUnsupportedFeature(const std::string& feature) override;
75   void DocumentLoadProgress(uint32_t available, uint32_t doc_size) override;
76   void FormTextFieldFocusChange(bool in_focus) override;
77   bool IsPrintPreview() override;
78   void CancelBrowserDownload() override;
79   float GetToolbarHeightInScreenCoords() override;
80   uint32_t GetBackgroundColor() override;
81
82  private:
83   Client* const client_;
84 };
85
86 }  // namespace chrome_pdf
87
88 #endif  // PDF_PREVIEW_MODE_CLIENT_H_