Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: pdf/pdfium/pdfium_engine.h

Issue 2000323005: PDF: Use an empty password as a sentinel value for no password. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pdf/pdfium/pdfium_engine.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 // PDFium interface to request download of the block of data. 198 // PDFium interface to request download of the block of data.
199 static void AddSegment(FX_DOWNLOADHINTS* param, 199 static void AddSegment(FX_DOWNLOADHINTS* param,
200 size_t offset, size_t size); 200 size_t offset, size_t size);
201 201
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 207 // loaded or is already loaded otherwise it will return false. If there is a
208 // |with_password| is set to true, the document will be loaded with 208 // password, then |password| is non-empty. If the document could not be loaded
209 // |password|. If the document could not be loaded and needs a password, 209 // and needs a password, |needs_password| will be set to true.
210 // |needs_password| will be set to true. 210 bool TryLoadingDoc(const std::string& password, bool* needs_password);
211 bool TryLoadingDoc(bool with_password,
212 const std::string& password,
213 bool* needs_password);
214 211
215 // Ask the user for the document password and then continue loading the 212 // Ask the user for the document password and then continue loading the
216 // document. 213 // document.
217 void GetPasswordAndLoad(); 214 void GetPasswordAndLoad();
218 215
219 // Called when the password has been retrieved. 216 // Called when the password has been retrieved.
220 void OnGetPasswordComplete(int32_t result, 217 void OnGetPasswordComplete(int32_t result,
221 const pp::Var& password); 218 const pp::Var& password);
222 219
223 // 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
224 // there is no password. 221 // there is no password. If there is no password, then |password| is empty.
225 void ContinueLoadingDocument(bool has_password, 222 void ContinueLoadingDocument(const std::string& password);
226 const std::string& password);
227 223
228 // Finish loading the document and notify the client that the document has 224 // Finish loading the document and notify the client that the document has
229 // been loaded. This should only be run after |doc_| has been loaded and the 225 // been loaded. This should only be run after |doc_| has been loaded and the
230 // document is fully downloaded. If this has been run once, it will result in 226 // document is fully downloaded. If this has been run once, it will result in
231 // a no-op. 227 // a no-op.
232 void FinishLoadingDocument(); 228 void FinishLoadingDocument();
233 229
234 // Loads information about the pages in the document and calculate the 230 // Loads information about the pages in the document and calculate the
235 // document size. 231 // document size.
236 void LoadPageInfo(bool reload); 232 void LoadPageInfo(bool reload);
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 bool GetPDFPageSizeByIndex(const void* pdf_buffer, 744 bool GetPDFPageSizeByIndex(const void* pdf_buffer,
749 int pdf_buffer_size, 745 int pdf_buffer_size,
750 int page_number, 746 int page_number,
751 double* width, 747 double* width,
752 double* height) override; 748 double* height) override;
753 }; 749 };
754 750
755 } // namespace chrome_pdf 751 } // namespace chrome_pdf
756 752
757 #endif // PDF_PDFIUM_PDFIUM_ENGINE_H_ 753 #endif // PDF_PDFIUM_PDFIUM_ENGINE_H_
OLDNEW
« no previous file with comments | « no previous file | pdf/pdfium/pdfium_engine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698