Upload upstream chromium 73.0.3683.0
[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 Invalidate(const pp::Rect& rect) override;
31   void DidScroll(const pp::Point& point) override;
32   void ScrollToX(int x_in_screen_coords) override;
33   void ScrollToY(int y_in_screen_coords, bool compensate_for_toolbar) override;
34   void ScrollBy(const pp::Point& point) override;
35   void ScrollToPage(int page) override;
36   void NavigateTo(const std::string& url,
37                   WindowOpenDisposition disposition) override;
38   void UpdateCursor(PP_CursorType_Dev cursor) override;
39   void UpdateTickMarks(const std::vector<pp::Rect>& tickmarks) override;
40   void NotifyNumberOfFindResultsChanged(int total, bool final_result) override;
41   void NotifySelectedFindResultChanged(int current_find_index) override;
42   void GetDocumentPassword(
43       pp::CompletionCallbackWithOutput<pp::Var> callback) override;
44   void Alert(const std::string& message) override;
45   bool Confirm(const std::string& message) override;
46   std::string Prompt(const std::string& question,
47                      const std::string& default_answer) override;
48   std::string GetURL() override;
49   void Email(const std::string& to,
50              const std::string& cc,
51              const std::string& bcc,
52              const std::string& subject,
53              const std::string& body) override;
54   void Print() override;
55   void SubmitForm(const std::string& url,
56                   const void* data,
57                   int length) override;
58   pp::URLLoader CreateURLLoader() override;
59   std::vector<SearchStringResult> SearchString(const base::char16* string,
60                                                const base::char16* term,
61                                                bool case_sensitive) override;
62   void DocumentLoadComplete(
63       const PDFEngine::DocumentFeatures& document_features,
64       uint32_t file_size) override;
65   void DocumentLoadFailed() override;
66   void FontSubstituted() override;
67   pp::Instance* GetPluginInstance() override;
68   void DocumentHasUnsupportedFeature(const std::string& feature) override;
69   void FormTextFieldFocusChange(bool in_focus) override;
70   bool IsPrintPreview() override;
71   float GetToolbarHeightInScreenCoords() override;
72   uint32_t GetBackgroundColor() override;
73
74  private:
75   Client* const client_;
76 };
77
78 }  // namespace chrome_pdf
79
80 #endif  // PDF_PREVIEW_MODE_CLIENT_H_