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.
4 
5 #include "pdf/preview_mode_client.h"
6 
7 #include <stdint.h>
8 
9 #include <memory>
10 #include <string>
11 #include <utility>
12 
13 #include "base/callback.h"
14 #include "base/notreached.h"
15 #include "pdf/document_layout.h"
16 #include "pdf/ppapi_migration/url_loader.h"
17 
18 namespace chrome_pdf {
19 
PreviewModeClient(Client * client)20 PreviewModeClient::PreviewModeClient(Client* client) : client_(client) {}
21 
ProposeDocumentLayout(const DocumentLayout & layout)22 void PreviewModeClient::ProposeDocumentLayout(const DocumentLayout& layout) {
23   // This will be invoked if the PreviewModeClient is used, which currently
24   // occurs if and only if loading a non-PDF document with more than 1 page.
25 }
26 
Invalidate(const gfx::Rect & rect)27 void PreviewModeClient::Invalidate(const gfx::Rect& rect) {
28   NOTREACHED();
29 }
30 
DidScroll(const gfx::Vector2d & point)31 void PreviewModeClient::DidScroll(const gfx::Vector2d& point) {
32   NOTREACHED();
33 }
34 
ScrollToX(int x_in_screen_coords)35 void PreviewModeClient::ScrollToX(int x_in_screen_coords) {
36   NOTREACHED();
37 }
38 
ScrollToY(int y_in_screen_coords,bool compensate_for_toolbar)39 void PreviewModeClient::ScrollToY(int y_in_screen_coords,
40                                   bool compensate_for_toolbar) {
41   NOTREACHED();
42 }
43 
ScrollBy(const gfx::Vector2d & scroll_delta)44 void PreviewModeClient::ScrollBy(const gfx::Vector2d& scroll_delta) {
45   NOTREACHED();
46 }
47 
ScrollToPage(int page)48 void PreviewModeClient::ScrollToPage(int page) {
49   NOTREACHED();
50 }
51 
NavigateTo(const std::string & url,WindowOpenDisposition disposition)52 void PreviewModeClient::NavigateTo(const std::string& url,
53                                    WindowOpenDisposition disposition) {
54   NOTREACHED();
55 }
56 
UpdateCursor(PP_CursorType_Dev cursor)57 void PreviewModeClient::UpdateCursor(PP_CursorType_Dev cursor) {
58   NOTREACHED();
59 }
60 
UpdateTickMarks(const std::vector<gfx::Rect> & tickmarks)61 void PreviewModeClient::UpdateTickMarks(
62     const std::vector<gfx::Rect>& tickmarks) {
63   NOTREACHED();
64 }
65 
NotifyNumberOfFindResultsChanged(int total,bool final_result)66 void PreviewModeClient::NotifyNumberOfFindResultsChanged(int total,
67                                                          bool final_result) {
68   NOTREACHED();
69 }
70 
NotifySelectedFindResultChanged(int current_find_index)71 void PreviewModeClient::NotifySelectedFindResultChanged(
72     int current_find_index) {
73   NOTREACHED();
74 }
75 
GetDocumentPassword(base::OnceCallback<void (const std::string &)> callback)76 void PreviewModeClient::GetDocumentPassword(
77     base::OnceCallback<void(const std::string&)> callback) {
78   std::move(callback).Run("");
79 }
80 
Alert(const std::string & message)81 void PreviewModeClient::Alert(const std::string& message) {
82   NOTREACHED();
83 }
84 
Confirm(const std::string & message)85 bool PreviewModeClient::Confirm(const std::string& message) {
86   NOTREACHED();
87   return false;
88 }
89 
Prompt(const std::string & question,const std::string & default_answer)90 std::string PreviewModeClient::Prompt(const std::string& question,
91                                       const std::string& default_answer) {
92   NOTREACHED();
93   return std::string();
94 }
95 
GetURL()96 std::string PreviewModeClient::GetURL() {
97   NOTREACHED();
98   return std::string();
99 }
100 
Email(const std::string & to,const std::string & cc,const std::string & bcc,const std::string & subject,const std::string & body)101 void PreviewModeClient::Email(const std::string& to,
102                               const std::string& cc,
103                               const std::string& bcc,
104                               const std::string& subject,
105                               const std::string& body) {
106   NOTREACHED();
107 }
108 
Print()109 void PreviewModeClient::Print() {
110   NOTREACHED();
111 }
112 
SubmitForm(const std::string & url,const void * data,int length)113 void PreviewModeClient::SubmitForm(const std::string& url,
114                                    const void* data,
115                                    int length) {
116   NOTREACHED();
117 }
118 
CreateUrlLoader()119 std::unique_ptr<UrlLoader> PreviewModeClient::CreateUrlLoader() {
120   NOTREACHED();
121   return nullptr;
122 }
123 
124 std::vector<PDFEngine::Client::SearchStringResult>
SearchString(const base::char16 * string,const base::char16 * term,bool case_sensitive)125 PreviewModeClient::SearchString(const base::char16* string,
126                                 const base::char16* term,
127                                 bool case_sensitive) {
128   NOTREACHED();
129   return std::vector<SearchStringResult>();
130 }
131 
DocumentLoadComplete(const PDFEngine::DocumentFeatures & document_features)132 void PreviewModeClient::DocumentLoadComplete(
133     const PDFEngine::DocumentFeatures& document_features) {
134   client_->PreviewDocumentLoadComplete();
135 }
136 
DocumentLoadFailed()137 void PreviewModeClient::DocumentLoadFailed() {
138   client_->PreviewDocumentLoadFailed();
139 }
140 
GetPluginInstance()141 pp::Instance* PreviewModeClient::GetPluginInstance() {
142   return nullptr;
143 }
144 
DocumentHasUnsupportedFeature(const std::string & feature)145 void PreviewModeClient::DocumentHasUnsupportedFeature(
146     const std::string& feature) {
147   NOTREACHED();
148 }
149 
FormTextFieldFocusChange(bool in_focus)150 void PreviewModeClient::FormTextFieldFocusChange(bool in_focus) {
151   NOTREACHED();
152 }
153 
IsPrintPreview()154 bool PreviewModeClient::IsPrintPreview() {
155   return true;
156 }
157 
GetToolbarHeightInScreenCoords()158 float PreviewModeClient::GetToolbarHeightInScreenCoords() {
159   return 0.0f;
160 }
161 
GetBackgroundColor()162 uint32_t PreviewModeClient::GetBackgroundColor() {
163   NOTREACHED();
164   return 0;
165 }
166 
SetSelectedText(const std::string & selected_text)167 void PreviewModeClient::SetSelectedText(const std::string& selected_text) {
168   NOTREACHED();
169 }
170 
SetLinkUnderCursor(const std::string & link_under_cursor)171 void PreviewModeClient::SetLinkUnderCursor(
172     const std::string& link_under_cursor) {
173   NOTREACHED();
174 }
175 
IsValidLink(const std::string & url)176 bool PreviewModeClient::IsValidLink(const std::string& url) {
177   NOTREACHED();
178   return false;
179 }
180 
181 }  // namespace chrome_pdf
182