OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PDF_PDFIUM_PDFIUM_ENGINE_H_ | 5 #ifndef PDF_PDFIUM_PDFIUM_ENGINE_H_ |
6 #define PDF_PDFIUM_PDFIUM_ENGINE_H_ | 6 #define PDF_PDFIUM_PDFIUM_ENGINE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // We finished getting the pdf file, so load it. This will complete | 202 // We finished getting the pdf file, so load it. This will complete |
203 // asynchronously (due to password fetching) and may be run multiple times. | 203 // asynchronously (due to password fetching) and may be run multiple times. |
204 void LoadDocument(); | 204 void LoadDocument(); |
205 | 205 |
206 // Try loading the document. Returns true if the document is successfully | 206 // Try loading the document. Returns true if the document is successfully |
207 // loaded or is already loaded otherwise it will return false. If there is a | 207 // loaded or is already loaded otherwise it will return false. If there is a |
208 // password, then |password| is non-empty. If the document could not be loaded | 208 // password, then |password| is non-empty. If the document could not be loaded |
209 // and needs a password, |needs_password| will be set to true. | 209 // and needs a password, |needs_password| will be set to true. |
210 bool TryLoadingDoc(const std::string& password, bool* needs_password); | 210 bool TryLoadingDoc(const std::string& password, bool* needs_password); |
211 | 211 |
212 // Ask the user for the document password and then continue loading the | 212 // Asks the user for the document password and then continue loading the |
213 // document. | 213 // document. |
214 void GetPasswordAndLoad(); | 214 void GetPasswordAndLoad(); |
215 | 215 |
216 // Called when the password has been retrieved. | 216 // Called when the password has been retrieved. |
217 void OnGetPasswordComplete(int32_t result, | 217 void OnGetPasswordComplete(int32_t result, |
218 const pp::Var& password); | 218 const pp::Var& password); |
219 | 219 |
220 // Continues loading the document when the password has been retrieved, or if | 220 // Continues loading the document when the password has been retrieved, or if |
221 // there is no password. If there is no password, then |password| is empty. | 221 // there is no password. If there is no password, then |password| is empty. |
222 void ContinueLoadingDocument(const std::string& password); | 222 void ContinueLoadingDocument(const std::string& password); |
223 | 223 |
224 // Finish loading the document and notify the client that the document has | 224 // Finishes loading the document. Recalculate the document size if there were |
225 // been loaded. This should only be run after |doc_| has been loaded and the | 225 // pages that were not previously available. |
226 // document is fully downloaded. If this has been run once, it will result in | 226 // Also notifies the client that the document has been loaded. |
227 // a no-op. | 227 // This should only be called after |doc_| has been loaded and the document is |
| 228 // fully downloaded. |
| 229 // If this has been run once, it will not notify the client again. |
228 void FinishLoadingDocument(); | 230 void FinishLoadingDocument(); |
229 | 231 |
230 // Loads information about the pages in the document and calculate the | 232 // Loads information about the pages in the document and calculate the |
231 // document size. | 233 // document size. |
232 void LoadPageInfo(bool reload); | 234 void LoadPageInfo(bool reload); |
233 | 235 |
234 // Calculate which pages should be displayed right now. | 236 // Calculates which pages should be displayed right now. |
235 void CalculateVisiblePages(); | 237 void CalculateVisiblePages(); |
236 | 238 |
237 // Returns true iff the given page index is visible. CalculateVisiblePages | 239 // Returns true iff the given page index is visible. CalculateVisiblePages |
238 // must have been called first. | 240 // must have been called first. |
239 bool IsPageVisible(int index) const; | 241 bool IsPageVisible(int index) const; |
240 | 242 |
241 // Checks if a page is now available, and if so marks it as such and returns | 243 // Checks if a page is now available, and if so marks it as such and returns |
242 // true. Otherwise, it will return false and will add the index to the given | 244 // true. Otherwise, it will return false and will add the index to the given |
243 // array if it's not already there. | 245 // array if it's not already there. |
244 bool CheckPageAvailable(int index, std::vector<int>* pending); | 246 bool CheckPageAvailable(int index, std::vector<int>* pending); |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 bool GetPDFPageSizeByIndex(const void* pdf_buffer, | 746 bool GetPDFPageSizeByIndex(const void* pdf_buffer, |
745 int pdf_buffer_size, | 747 int pdf_buffer_size, |
746 int page_number, | 748 int page_number, |
747 double* width, | 749 double* width, |
748 double* height) override; | 750 double* height) override; |
749 }; | 751 }; |
750 | 752 |
751 } // namespace chrome_pdf | 753 } // namespace chrome_pdf |
752 | 754 |
753 #endif // PDF_PDFIUM_PDFIUM_ENGINE_H_ | 755 #endif // PDF_PDFIUM_PDFIUM_ENGINE_H_ |
OLD | NEW |