blob: 4b9c2e6250869b4a72c351ccb1b71c2c96b70a58 [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
K. Moon82fd9de2020-07-08 16:17:3213#include "base/callback_forward.h"
[email protected]1b1e9eff2014-05-20 01:56:4014#include "pdf/pdf_engine.h"
15
K. Moon30466c92020-07-21 21:46:0316namespace gfx {
Ankit Kumar 🌪️b5b4be92020-08-29 07:49:2717class Rect;
K. Moon30466c92020-07-21 21:46:0318class Vector2d;
19} // namespace gfx
20
[email protected]1b1e9eff2014-05-20 01:56:4021namespace chrome_pdf {
22
23// The interface that's provided to the print preview rendering engine.
24class PreviewModeClient : public PDFEngine::Client {
25 public:
26 class Client {
27 public:
28 virtual void PreviewDocumentLoadFailed() = 0;
29 virtual void PreviewDocumentLoadComplete() = 0;
30 };
thestig986386202015-12-29 22:38:1531
[email protected]1b1e9eff2014-05-20 01:56:4032 explicit PreviewModeClient(Client* client);
thestig986386202015-12-29 22:38:1533 ~PreviewModeClient() override {}
[email protected]1b1e9eff2014-05-20 01:56:4034
35 // PDFEngine::Client implementation.
K Moonbf59df52019-09-27 00:32:5836 void ProposeDocumentLayout(const DocumentLayout& layout) override;
Ankit Kumar 🌪️56d27512020-09-03 23:18:1437 void Invalidate(const gfx::Rect& rect) override;
K. Moon30466c92020-07-21 21:46:0338 void DidScroll(const gfx::Vector2d& offset) override;
Henrique Nakashima2ab2e4e92017-09-26 16:11:0739 void ScrollToX(int x_in_screen_coords) override;
40 void ScrollToY(int y_in_screen_coords, bool compensate_for_toolbar) override;
Ankit Kumar 🌪️7f59e782020-08-18 22:31:2941 void ScrollBy(const gfx::Vector2d& scroll_delta) override;
thestig986386202015-12-29 22:38:1542 void ScrollToPage(int page) override;
jaepark1b44ac412016-07-26 17:24:0143 void NavigateTo(const std::string& url,
44 WindowOpenDisposition disposition) override;
thestig986386202015-12-29 22:38:1545 void UpdateCursor(PP_CursorType_Dev cursor) override;
Ankit Kumar 🌪️b5b4be92020-08-29 07:49:2746 void UpdateTickMarks(const std::vector<gfx::Rect>& tickmarks) override;
thestig986386202015-12-29 22:38:1547 void NotifyNumberOfFindResultsChanged(int total, bool final_result) override;
48 void NotifySelectedFindResultChanged(int current_find_index) override;
49 void GetDocumentPassword(
K. Moon82fd9de2020-07-08 16:17:3250 base::OnceCallback<void(const std::string&)> callback) override;
thestig986386202015-12-29 22:38:1551 void Alert(const std::string& message) override;
52 bool Confirm(const std::string& message) override;
53 std::string Prompt(const std::string& question,
54 const std::string& default_answer) override;
55 std::string GetURL() override;
56 void Email(const std::string& to,
57 const std::string& cc,
58 const std::string& bcc,
59 const std::string& subject,
60 const std::string& body) override;
61 void Print() override;
62 void SubmitForm(const std::string& url,
63 const void* data,
64 int length) override;
K. Moon071f48d2020-09-10 17:07:1865 std::unique_ptr<UrlLoader> CreateUrlLoader() override;
Lei Zhang49baa882017-10-20 23:31:4166 std::vector<SearchStringResult> SearchString(const base::char16* string,
67 const base::char16* term,
68 bool case_sensitive) override;
Henrique Nakashimaf14fd482017-10-16 18:29:0169 void DocumentLoadComplete(
Lei Zhangaa417f02019-07-16 00:25:2370 const PDFEngine::DocumentFeatures& document_features) override;
thestig986386202015-12-29 22:38:1571 void DocumentLoadFailed() override;
72 pp::Instance* GetPluginInstance() override;
73 void DocumentHasUnsupportedFeature(const std::string& feature) override;
thestig986386202015-12-29 22:38:1574 void FormTextFieldFocusChange(bool in_focus) override;
75 bool IsPrintPreview() override;
Virender Singh05d6d362020-02-06 21:39:5176 float GetToolbarHeightInScreenCoords() override;
thestig986386202015-12-29 22:38:1577 uint32_t GetBackgroundColor() override;
[email protected]1b1e9eff2014-05-20 01:56:4078
79 private:
thestig986386202015-12-29 22:38:1580 Client* const client_;
[email protected]1b1e9eff2014-05-20 01:56:4081};
82
83} // namespace chrome_pdf
84
85#endif // PDF_PREVIEW_MODE_CLIENT_H_