Upload upstream chromium 94.0.4606.31
[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 "base/callback_forward.h"
14 #include "pdf/pdf_engine.h"
15
16 namespace chrome_pdf {
17
18 // The interface that's provided to the print preview rendering engine.
19 class PreviewModeClient : public PDFEngine::Client {
20  public:
21   class Client {
22    public:
23     virtual void PreviewDocumentLoadFailed() = 0;
24     virtual void PreviewDocumentLoadComplete() = 0;
25   };
26
27   explicit PreviewModeClient(Client* client);
28   ~PreviewModeClient() override;
29
30   // PDFEngine::Client implementation.
31   void ProposeDocumentLayout(const DocumentLayout& layout) override;
32   void Invalidate(const gfx::Rect& rect) override;
33   void DidScroll(const gfx::Vector2d& offset) override;
34   void ScrollToX(int x_in_screen_coords) override;
35   void ScrollToY(int y_in_screen_coords) override;
36   void ScrollBy(const gfx::Vector2d& scroll_delta) override;
37   void ScrollToPage(int page) override;
38   void NavigateTo(const std::string& url,
39                   WindowOpenDisposition disposition) override;
40   void UpdateCursor(ui::mojom::CursorType cursor_type) override;
41   void UpdateTickMarks(const std::vector<gfx::Rect>& tickmarks) override;
42   void NotifyNumberOfFindResultsChanged(int total, bool final_result) override;
43   void NotifySelectedFindResultChanged(int current_find_index) override;
44   void GetDocumentPassword(
45       base::OnceCallback<void(const std::string&)> callback) override;
46   void Alert(const std::string& message) override;
47   bool Confirm(const std::string& message) override;
48   std::string Prompt(const std::string& question,
49                      const std::string& default_answer) override;
50   std::string GetURL() override;
51   void Email(const std::string& to,
52              const std::string& cc,
53              const std::string& bcc,
54              const std::string& subject,
55              const std::string& body) override;
56   void Print() override;
57   void SubmitForm(const std::string& url,
58                   const void* data,
59                   int length) override;
60   std::unique_ptr<UrlLoader> CreateUrlLoader() override;
61   std::vector<SearchStringResult> SearchString(const char16_t* string,
62                                                const char16_t* term,
63                                                bool case_sensitive) override;
64   void DocumentLoadComplete() override;
65   void DocumentLoadFailed() override;
66   void DocumentHasUnsupportedFeature(const std::string& feature) override;
67   void FormTextFieldFocusChange(bool in_focus) override;
68   bool IsPrintPreview() const override;
69   SkColor GetBackgroundColor() override;
70   void SetSelectedText(const std::string& selected_text) override;
71   void SetLinkUnderCursor(const std::string& link_under_cursor) override;
72   bool IsValidLink(const std::string& url) override;
73   void ScheduleTaskOnMainThread(const base::Location& from_here,
74                                 ResultCallback callback,
75                                 int32_t result,
76                                 base::TimeDelta delay) override;
77
78  private:
79   Client* const client_;
80 };
81
82 }  // namespace chrome_pdf
83
84 #endif  // PDF_PREVIEW_MODE_CLIENT_H_