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