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 "pdf/pdf_engine.h"
15 namespace chrome_pdf {
17 // The interface that's provided to the print preview rendering engine.
18 class PreviewModeClient : public PDFEngine::Client {
22 virtual void PreviewDocumentLoadFailed() = 0;
23 virtual void PreviewDocumentLoadComplete() = 0;
26 explicit PreviewModeClient(Client* client);
27 ~PreviewModeClient() override {}
29 // PDFEngine::Client implementation.
30 void ProposeDocumentLayout(const DocumentLayout& layout) 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 GetDocumentPassword(
44 pp::CompletionCallbackWithOutput<pp::Var> callback) override;
45 void Alert(const std::string& message) override;
46 bool Confirm(const std::string& message) override;
47 std::string Prompt(const std::string& question,
48 const std::string& default_answer) override;
49 std::string GetURL() override;
50 void Email(const std::string& to,
51 const std::string& cc,
52 const std::string& bcc,
53 const std::string& subject,
54 const std::string& body) override;
55 void Print() override;
56 void SubmitForm(const std::string& url,
59 pp::URLLoader CreateURLLoader() override;
60 std::vector<SearchStringResult> SearchString(const base::char16* string,
61 const base::char16* term,
62 bool case_sensitive) override;
63 void DocumentLoadComplete(
64 const PDFEngine::DocumentFeatures& document_features) override;
65 void DocumentLoadFailed() override;
66 pp::Instance* GetPluginInstance() override;
67 void DocumentHasUnsupportedFeature(const std::string& feature) override;
68 void FormTextFieldFocusChange(bool in_focus) override;
69 bool IsPrintPreview() override;
70 float GetToolbarHeightInScreenCoords() override;
71 uint32_t GetBackgroundColor() override;
74 Client* const client_;
77 } // namespace chrome_pdf
79 #endif // PDF_PREVIEW_MODE_CLIENT_H_