| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // We finished getting the pdf file, so load it. This will complete | 211 // We finished getting the pdf file, so load it. This will complete |
| 212 // asynchronously (due to password fetching) and may be run multiple times. | 212 // asynchronously (due to password fetching) and may be run multiple times. |
| 213 void LoadDocument(); | 213 void LoadDocument(); |
| 214 | 214 |
| 215 // Try loading the document. Returns true if the document is successfully | 215 // Try loading the document. Returns true if the document is successfully |
| 216 // loaded or is already loaded otherwise it will return false. If there is a | 216 // loaded or is already loaded otherwise it will return false. If there is a |
| 217 // password, then |password| is non-empty. If the document could not be loaded | 217 // password, then |password| is non-empty. If the document could not be loaded |
| 218 // and needs a password, |needs_password| will be set to true. | 218 // and needs a password, |needs_password| will be set to true. |
| 219 bool TryLoadingDoc(const std::string& password, bool* needs_password); | 219 bool TryLoadingDoc(const std::string& password, bool* needs_password); |
| 220 | 220 |
| 221 // Ask the user for the document password and then continue loading the | 221 // Asks the user for the document password and then continue loading the |
| 222 // document. | 222 // document. |
| 223 void GetPasswordAndLoad(); | 223 void GetPasswordAndLoad(); |
| 224 | 224 |
| 225 // Called when the password has been retrieved. | 225 // Called when the password has been retrieved. |
| 226 void OnGetPasswordComplete(int32_t result, | 226 void OnGetPasswordComplete(int32_t result, |
| 227 const pp::Var& password); | 227 const pp::Var& password); |
| 228 | 228 |
| 229 // Continues loading the document when the password has been retrieved, or if | 229 // Continues loading the document when the password has been retrieved, or if |
| 230 // there is no password. If there is no password, then |password| is empty. | 230 // there is no password. If there is no password, then |password| is empty. |
| 231 void ContinueLoadingDocument(const std::string& password); | 231 void ContinueLoadingDocument(const std::string& password); |
| 232 | 232 |
| 233 // Finish loading the document and notify the client that the document has | 233 // Finishes loading the document. Recalculate the document size if there were |
| 234 // been loaded. This should only be run after |doc_| has been loaded and the | 234 // pages that were not previously available. |
| 235 // document is fully downloaded. If this has been run once, it will result in | 235 // Also notifies the client that the document has been loaded. |
| 236 // a no-op. | 236 // This should only be called after |doc_| has been loaded and the document is |
| 237 // fully downloaded. |
| 238 // If this has been run once, it will not notify the client again. |
| 237 void FinishLoadingDocument(); | 239 void FinishLoadingDocument(); |
| 238 | 240 |
| 239 // Loads information about the pages in the document and calculate the | 241 // Loads information about the pages in the document and calculate the |
| 240 // document size. | 242 // document size. |
| 241 void LoadPageInfo(bool reload); | 243 void LoadPageInfo(bool reload); |
| 242 | 244 |
| 243 // Calculate which pages should be displayed right now. | 245 // Calculates which pages should be displayed right now. |
| 244 void CalculateVisiblePages(); | 246 void CalculateVisiblePages(); |
| 245 | 247 |
| 246 // Returns true iff the given page index is visible. CalculateVisiblePages | 248 // Returns true iff the given page index is visible. CalculateVisiblePages |
| 247 // must have been called first. | 249 // must have been called first. |
| 248 bool IsPageVisible(int index) const; | 250 bool IsPageVisible(int index) const; |
| 249 | 251 |
| 250 // Checks if a page is now available, and if so marks it as such and returns | 252 // Checks if a page is now available, and if so marks it as such and returns |
| 251 // true. Otherwise, it will return false and will add the index to the given | 253 // true. Otherwise, it will return false and will add the index to the given |
| 252 // array if it's not already there. | 254 // array if it's not already there. |
| 253 bool CheckPageAvailable(int index, std::vector<int>* pending); | 255 bool CheckPageAvailable(int index, std::vector<int>* pending); |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 bool GetPDFPageSizeByIndex(const void* pdf_buffer, | 755 bool GetPDFPageSizeByIndex(const void* pdf_buffer, |
| 754 int pdf_buffer_size, | 756 int pdf_buffer_size, |
| 755 int page_number, | 757 int page_number, |
| 756 double* width, | 758 double* width, |
| 757 double* height) override; | 759 double* height) override; |
| 758 }; | 760 }; |
| 759 | 761 |
| 760 } // namespace chrome_pdf | 762 } // namespace chrome_pdf |
| 761 | 763 |
| 762 #endif // PDF_PDFIUM_PDFIUM_ENGINE_H_ | 764 #endif // PDF_PDFIUM_PDFIUM_ENGINE_H_ |
| OLD | NEW |