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

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

Issue 881013002: Roll pdfium to eef005055d6aafc2cc6066af37ce47d8b15ec7cd (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « DEPS ('k') | no next file » | 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 #include "pdf/pdfium/pdfium_engine.h" 5 #include "pdf/pdfium/pdfium_engine.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 2374 matching lines...) Expand 10 before | Expand all | Expand 10 after
2385 return -1; 2385 return -1;
2386 dest = FPDFBookmark_GetDest(doc_, bookmark); 2386 dest = FPDFBookmark_GetDest(doc_, bookmark);
2387 } 2387 }
2388 return dest ? FPDFDest_GetPageIndex(doc_, dest) : -1; 2388 return dest ? FPDFDest_GetPageIndex(doc_, dest) : -1;
2389 } 2389 }
2390 2390
2391 pp::VarDictionary PDFiumEngine::GetNamedDestinations() { 2391 pp::VarDictionary PDFiumEngine::GetNamedDestinations() {
2392 pp::VarDictionary named_destinations; 2392 pp::VarDictionary named_destinations;
2393 for (unsigned long i = 0; i < FPDF_CountNamedDests(doc_); i++) { 2393 for (unsigned long i = 0; i < FPDF_CountNamedDests(doc_); i++) {
2394 base::string16 name; 2394 base::string16 name;
2395 unsigned long buffer_bytes; 2395 long buffer_bytes;
2396 FPDF_GetNamedDest(doc_, i, NULL, buffer_bytes); 2396 FPDF_GetNamedDest(doc_, i, NULL, buffer_bytes);
2397 size_t name_length = buffer_bytes / sizeof(base::string16::value_type); 2397 size_t name_length = buffer_bytes / sizeof(base::string16::value_type);
2398 if (name_length > 0) { 2398 if (name_length > 0) {
2399 PDFiumAPIStringBufferAdapter<base::string16> api_string_adapter( 2399 PDFiumAPIStringBufferAdapter<base::string16> api_string_adapter(
2400 &name, name_length, true); 2400 &name, name_length, true);
2401 FPDF_DEST dest = FPDF_GetNamedDest(doc_, i, api_string_adapter.GetData(), 2401 FPDF_DEST dest = FPDF_GetNamedDest(doc_, i, api_string_adapter.GetData(),
2402 buffer_bytes); 2402 buffer_bytes);
2403 api_string_adapter.Close(name_length); 2403 api_string_adapter.Close(name_length);
2404 if (dest) { 2404 if (dest) {
2405 std::string named_dest = base::UTF16ToUTF8(name); 2405 std::string named_dest = base::UTF16ToUTF8(name);
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after
4017 double* height) { 4017 double* height) {
4018 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); 4018 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL);
4019 if (!doc) 4019 if (!doc)
4020 return false; 4020 return false;
4021 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; 4021 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0;
4022 FPDF_CloseDocument(doc); 4022 FPDF_CloseDocument(doc);
4023 return success; 4023 return success;
4024 } 4024 }
4025 4025
4026 } // namespace chrome_pdf 4026 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698