blob: 0127db9a3a59d6cdde4615473bdbc5d897f9d14d [file] [log] [blame]
[email protected]1b1e9eff2014-05-20 01:56:401// 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
avia7c09d52015-12-21 19:49:438#include <stdint.h>
9
[email protected]1b1e9eff2014-05-20 01:56:4010#include <string>
11#include <vector>
12
13#include "pdf/pdf_engine.h"
14
15namespace chrome_pdf {
16
17// The interface that's provided to the print preview rendering engine.
18class PreviewModeClient : public PDFEngine::Client {
19 public:
20 class Client {
21 public:
22 virtual void PreviewDocumentLoadFailed() = 0;
23 virtual void PreviewDocumentLoadComplete() = 0;
24 };
thestig986386202015-12-29 22:38:1525
[email protected]1b1e9eff2014-05-20 01:56:4026 explicit PreviewModeClient(Client* client);
thestig986386202015-12-29 22:38:1527 ~PreviewModeClient() override {}
[email protected]1b1e9eff2014-05-20 01:56:4028
29 // PDFEngine::Client implementation.
thestig986386202015-12-29 22:38:1530 void DocumentSizeUpdated(const pp::Size& size) override;
31 void Invalidate(const pp::Rect& rect) override;
32 void Scroll(const pp::Point& point) override;
33 void ScrollToX(int position) override;
34 void ScrollToY(int position) override;
35 void ScrollToPage(int page) override;
36 void NavigateTo(const std::string& url, bool open_in_new_tab) override;
37 void UpdateCursor(PP_CursorType_Dev cursor) override;
38 void UpdateTickMarks(const std::vector<pp::Rect>& tickmarks) override;
39 void NotifyNumberOfFindResultsChanged(int total, bool final_result) override;
40 void NotifySelectedFindResultChanged(int current_find_index) override;
41 void GetDocumentPassword(
42 pp::CompletionCallbackWithOutput<pp::Var> callback) override;
43 void Alert(const std::string& message) override;
44 bool Confirm(const std::string& message) override;
45 std::string Prompt(const std::string& question,
46 const std::string& default_answer) override;
47 std::string GetURL() override;
48 void Email(const std::string& to,
49 const std::string& cc,
50 const std::string& bcc,
51 const std::string& subject,
52 const std::string& body) override;
53 void Print() override;
54 void SubmitForm(const std::string& url,
55 const void* data,
56 int length) override;
57 std::string ShowFileSelectionDialog() override;
58 pp::URLLoader CreateURLLoader() override;
59 void ScheduleCallback(int id, int delay_in_ms) override;
60 void SearchString(const base::char16* string,
61 const base::char16* term,
62 bool case_sensitive,
63 std::vector<SearchStringResult>* results) override;
64 void DocumentPaintOccurred() override;
65 void DocumentLoadComplete(int page_count) override;
66 void DocumentLoadFailed() override;
67 pp::Instance* GetPluginInstance() override;
68 void DocumentHasUnsupportedFeature(const std::string& feature) override;
69 void DocumentLoadProgress(uint32_t available, uint32_t doc_size) override;
70 void FormTextFieldFocusChange(bool in_focus) override;
71 bool IsPrintPreview() override;
72 uint32_t GetBackgroundColor() override;
[email protected]1b1e9eff2014-05-20 01:56:4073
74 private:
thestig986386202015-12-29 22:38:1575 Client* const client_;
[email protected]1b1e9eff2014-05-20 01:56:4076};
77
78} // namespace chrome_pdf
79
80#endif // PDF_PREVIEW_MODE_CLIENT_H_