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_
11 #include "pdf/pdf_engine.h"
13 namespace chrome_pdf
{
15 // The interface that's provided to the print preview rendering engine.
16 class PreviewModeClient
: public PDFEngine::Client
{
20 virtual void PreviewDocumentLoadFailed() = 0;
21 virtual void PreviewDocumentLoadComplete() = 0;
23 explicit PreviewModeClient(Client
* client
);
24 virtual ~PreviewModeClient() {}
26 // PDFEngine::Client implementation.
27 virtual void DocumentSizeUpdated(const pp::Size
& size
);
28 virtual void Invalidate(const pp::Rect
& rect
);
29 virtual void Scroll(const pp::Point
& point
);
30 virtual void ScrollToX(int position
);
31 virtual void ScrollToY(int position
);
32 virtual void ScrollToPage(int page
);
33 virtual void NavigateTo(const std::string
& url
, bool open_in_new_tab
);
34 virtual void UpdateCursor(PP_CursorType_Dev cursor
);
35 virtual void UpdateTickMarks(const std::vector
<pp::Rect
>& tickmarks
);
36 virtual void NotifyNumberOfFindResultsChanged(int total
,
38 virtual void NotifySelectedFindResultChanged(int current_find_index
);
39 virtual void GetDocumentPassword(
40 pp::CompletionCallbackWithOutput
<pp::Var
> callback
);
41 virtual void Alert(const std::string
& message
);
42 virtual bool Confirm(const std::string
& message
);
43 virtual std::string
Prompt(const std::string
& question
,
44 const std::string
& default_answer
);
45 virtual std::string
GetURL();
46 virtual void Email(const std::string
& to
,
47 const std::string
& cc
,
48 const std::string
& bcc
,
49 const std::string
& subject
,
50 const std::string
& body
);
52 virtual void SubmitForm(const std::string
& url
,
55 virtual std::string
ShowFileSelectionDialog();
56 virtual pp::URLLoader
CreateURLLoader();
57 virtual void ScheduleCallback(int id
, int delay_in_ms
);
58 virtual void SearchString(const base::char16
* string
,
59 const base::char16
* term
,
61 std::vector
<SearchStringResult
>* results
);
62 virtual void DocumentPaintOccurred();
63 virtual void DocumentLoadComplete(int page_count
);
64 virtual void DocumentLoadFailed();
65 virtual pp::Instance
* GetPluginInstance();
66 virtual void DocumentHasUnsupportedFeature(const std::string
& feature
);
67 virtual void DocumentLoadProgress(uint32 available
, uint32 doc_size
);
68 virtual void FormTextFieldFocusChange(bool in_focus
);
69 virtual bool IsPrintPreview();
75 } // namespace chrome_pdf
77 #endif // PDF_PREVIEW_MODE_CLIENT_H_