| 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 #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 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1856 result.append(selection_[i].GetText()); | 1856 result.append(selection_[i].GetText()); |
| 1857 } | 1857 } |
| 1858 } | 1858 } |
| 1859 | 1859 |
| 1860 return base::UTF16ToUTF8(result); | 1860 return base::UTF16ToUTF8(result); |
| 1861 } | 1861 } |
| 1862 | 1862 |
| 1863 std::string PDFiumEngine::GetLinkAtPosition(const pp::Point& point) { | 1863 std::string PDFiumEngine::GetLinkAtPosition(const pp::Point& point) { |
| 1864 int temp; | 1864 int temp; |
| 1865 PDFiumPage::LinkTarget target; | 1865 PDFiumPage::LinkTarget target; |
| 1866 PDFiumPage::Area area = GetCharIndex(point, &temp, &temp, &target); | 1866 pp::Point point_in_page( |
| 1867 static_cast<int>((point.x() + position_.x()) / current_zoom_), |
| 1868 static_cast<int>((point.y() + position_.y()) / current_zoom_)); |
| 1869 PDFiumPage::Area area = GetCharIndex(point_in_page, &temp, &temp, &target); |
| 1867 if (area == PDFiumPage::WEBLINK_AREA) | 1870 if (area == PDFiumPage::WEBLINK_AREA) |
| 1868 return target.url; | 1871 return target.url; |
| 1869 return std::string(); | 1872 return std::string(); |
| 1870 } | 1873 } |
| 1871 | 1874 |
| 1872 bool PDFiumEngine::IsSelecting() { | 1875 bool PDFiumEngine::IsSelecting() { |
| 1873 return selecting_; | 1876 return selecting_; |
| 1874 } | 1877 } |
| 1875 | 1878 |
| 1876 bool PDFiumEngine::HasPermission(DocumentPermission permission) const { | 1879 bool PDFiumEngine::HasPermission(DocumentPermission permission) const { |
| (...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3422 double* height) { | 3425 double* height) { |
| 3423 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); | 3426 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); |
| 3424 if (!doc) | 3427 if (!doc) |
| 3425 return false; | 3428 return false; |
| 3426 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 3429 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
| 3427 FPDF_CloseDocument(doc); | 3430 FPDF_CloseDocument(doc); |
| 3428 return success; | 3431 return success; |
| 3429 } | 3432 } |
| 3430 | 3433 |
| 3431 } // namespace chrome_pdf | 3434 } // namespace chrome_pdf |
| OLD | NEW |