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

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

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix platform specific stuff Created 5 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
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 2427 matching lines...) Expand 10 before | Expand all | Expand 10 after
2438 HasPermission(PERMISSION_COPY_ACCESSIBLE))) { 2438 HasPermission(PERMISSION_COPY_ACCESSIBLE))) {
2439 return "{}"; 2439 return "{}";
2440 } 2440 }
2441 2441
2442 if (index < 0 || static_cast<size_t>(index) > pages_.size() - 1) 2442 if (index < 0 || static_cast<size_t>(index) > pages_.size() - 1)
2443 return "{}"; 2443 return "{}";
2444 2444
2445 scoped_ptr<base::Value> node( 2445 scoped_ptr<base::Value> node(
2446 pages_[index]->GetAccessibleContentAsValue(current_rotation_)); 2446 pages_[index]->GetAccessibleContentAsValue(current_rotation_));
2447 std::string page_json; 2447 std::string page_json;
2448 base::JSONWriter::Write(node.get(), &page_json); 2448 base::JSONWriter::Write(*node, &page_json);
2449 return page_json; 2449 return page_json;
2450 } 2450 }
2451 2451
2452 bool PDFiumEngine::GetPrintScaling() { 2452 bool PDFiumEngine::GetPrintScaling() {
2453 return !!FPDF_VIEWERREF_GetPrintScaling(doc_); 2453 return !!FPDF_VIEWERREF_GetPrintScaling(doc_);
2454 } 2454 }
2455 2455
2456 int PDFiumEngine::GetCopiesToPrint() { 2456 int PDFiumEngine::GetCopiesToPrint() {
2457 return FPDF_VIEWERREF_GetNumCopies(doc_); 2457 return FPDF_VIEWERREF_GetNumCopies(doc_);
2458 } 2458 }
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after
4016 double* height) { 4016 double* height) {
4017 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); 4017 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL);
4018 if (!doc) 4018 if (!doc)
4019 return false; 4019 return false;
4020 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; 4020 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0;
4021 FPDF_CloseDocument(doc); 4021 FPDF_CloseDocument(doc);
4022 return success; 4022 return success;
4023 } 4023 }
4024 4024
4025 } // namespace chrome_pdf 4025 } // namespace chrome_pdf
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698