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

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

Issue 1881013004: Convert pdf/ to use std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « pdf/pdfium/pdfium_engine.h ('k') | pdf/pdfium/pdfium_page.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 #include "pdf/pdfium/pdfium_engine.h" 5 #include "pdf/pdfium/pdfium_engine.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory>
11 #include <set> 12 #include <set>
12 13
13 #include "base/i18n/icu_encoding_detection.h" 14 #include "base/i18n/icu_encoding_detection.h"
14 #include "base/i18n/icu_string_conversions.h" 15 #include "base/i18n/icu_string_conversions.h"
15 #include "base/json/json_writer.h" 16 #include "base/json/json_writer.h"
16 #include "base/lazy_instance.h" 17 #include "base/lazy_instance.h"
17 #include "base/logging.h" 18 #include "base/logging.h"
18 #include "base/macros.h" 19 #include "base/macros.h"
19 #include "base/memory/scoped_ptr.h"
20 #include "base/numerics/safe_conversions.h" 20 #include "base/numerics/safe_conversions.h"
21 #include "base/stl_util.h" 21 #include "base/stl_util.h"
22 #include "base/strings/string_number_conversions.h" 22 #include "base/strings/string_number_conversions.h"
23 #include "base/strings/string_piece.h" 23 #include "base/strings/string_piece.h"
24 #include "base/strings/string_util.h" 24 #include "base/strings/string_util.h"
25 #include "base/strings/utf_string_conversions.h" 25 #include "base/strings/utf_string_conversions.h"
26 #include "base/values.h" 26 #include "base/values.h"
27 #include "gin/array_buffer.h" 27 #include "gin/array_buffer.h"
28 #include "gin/public/gin_embedders.h" 28 #include "gin/public/gin_embedders.h"
29 #include "gin/public/isolate_holder.h" 29 #include "gin/public/isolate_holder.h"
(...skipping 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2289 2289
2290 std::string PDFiumEngine::GetPageAsJSON(int index) { 2290 std::string PDFiumEngine::GetPageAsJSON(int index) {
2291 if (!(HasPermission(PERMISSION_COPY) || 2291 if (!(HasPermission(PERMISSION_COPY) ||
2292 HasPermission(PERMISSION_COPY_ACCESSIBLE))) { 2292 HasPermission(PERMISSION_COPY_ACCESSIBLE))) {
2293 return "{}"; 2293 return "{}";
2294 } 2294 }
2295 2295
2296 if (index < 0 || static_cast<size_t>(index) > pages_.size() - 1) 2296 if (index < 0 || static_cast<size_t>(index) > pages_.size() - 1)
2297 return "{}"; 2297 return "{}";
2298 2298
2299 scoped_ptr<base::Value> node( 2299 std::unique_ptr<base::Value> node(
2300 pages_[index]->GetAccessibleContentAsValue(current_rotation_)); 2300 pages_[index]->GetAccessibleContentAsValue(current_rotation_));
2301 std::string page_json; 2301 std::string page_json;
2302 base::JSONWriter::Write(*node, &page_json); 2302 base::JSONWriter::Write(*node, &page_json);
2303 return page_json; 2303 return page_json;
2304 } 2304 }
2305 2305
2306 bool PDFiumEngine::GetPrintScaling() { 2306 bool PDFiumEngine::GetPrintScaling() {
2307 return !!FPDF_VIEWERREF_GetPrintScaling(doc_); 2307 return !!FPDF_VIEWERREF_GetPrintScaling(doc_);
2308 } 2308 }
2309 2309
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after
3873 FPDF_DOCUMENT doc = 3873 FPDF_DOCUMENT doc =
3874 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); 3874 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr);
3875 if (!doc) 3875 if (!doc)
3876 return false; 3876 return false;
3877 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; 3877 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0;
3878 FPDF_CloseDocument(doc); 3878 FPDF_CloseDocument(doc);
3879 return success; 3879 return success;
3880 } 3880 }
3881 3881
3882 } // namespace chrome_pdf 3882 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « pdf/pdfium/pdfium_engine.h ('k') | pdf/pdfium/pdfium_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698