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.
5 #ifndef PDF_PREVIEW_MODE_CLIENT_H_
6 #define PDF_PREVIEW_MODE_CLIENT_H_
13 #include "base/callback_forward.h"
14 #include "pdf/pdf_engine.h"
16 namespace chrome_pdf {
18 // The interface that's provided to the print preview rendering engine.
19 class PreviewModeClient : public PDFEngine::Client {
23 virtual void PreviewDocumentLoadFailed() = 0;
24 virtual void PreviewDocumentLoadComplete() = 0;
27 explicit PreviewModeClient(Client* client);
28 ~PreviewModeClient() override;
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,
60 std::unique_ptr<UrlLoader> CreateUrlLoader() override;
61 std::vector<SearchStringResult> SearchString(const char16_t* string,
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,
76 base::TimeDelta delay) override;
79 Client* const client_;
82 } // namespace chrome_pdf
84 #endif // PDF_PREVIEW_MODE_CLIENT_H_