| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_page.h" | 5 #include "pdf/pdfium/pdfium_page.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 text_nodes->Append(CreateURLNode(text_utf8, targets[0].url)); | 197 text_nodes->Append(CreateURLNode(text_utf8, targets[0].url)); |
| 198 } else if (area == WEBLINK_AREA && !link) { | 198 } else if (area == WEBLINK_AREA && !link) { |
| 199 size_t start = 0; | 199 size_t start = 0; |
| 200 for (size_t i = 0; i < targets.size(); ++i) { | 200 for (size_t i = 0; i < targets.size(); ++i) { |
| 201 // If there is an extra NULL character at end, find() will not return any | 201 // If there is an extra NULL character at end, find() will not return any |
| 202 // matches. There should not be any though. | 202 // matches. There should not be any though. |
| 203 if (!targets[i].url.empty()) | 203 if (!targets[i].url.empty()) |
| 204 DCHECK(targets[i].url[targets[i].url.size() - 1] != '\0'); | 204 DCHECK(targets[i].url[targets[i].url.size() - 1] != '\0'); |
| 205 | 205 |
| 206 // PDFium may change the case of generated links. | 206 // PDFium may change the case of generated links. |
| 207 std::string lowerCaseURL = base::StringToLowerASCII(targets[i].url); | 207 std::string lowerCaseURL = base::ToLowerASCII(targets[i].url); |
| 208 std::string lowerCaseText = base::StringToLowerASCII(text_utf8); | 208 std::string lowerCaseText = base::ToLowerASCII(text_utf8); |
| 209 size_t pos = lowerCaseText.find(lowerCaseURL, start); | 209 size_t pos = lowerCaseText.find(lowerCaseURL, start); |
| 210 size_t length = targets[i].url.size(); | 210 size_t length = targets[i].url.size(); |
| 211 if (pos == std::string::npos) { | 211 if (pos == std::string::npos) { |
| 212 // Check if the link is a "mailto:" URL | 212 // Check if the link is a "mailto:" URL |
| 213 if (lowerCaseURL.compare(0, 7, "mailto:") == 0) { | 213 if (lowerCaseURL.compare(0, 7, "mailto:") == 0) { |
| 214 pos = lowerCaseText.find(lowerCaseURL.substr(7), start); | 214 pos = lowerCaseText.find(lowerCaseURL.substr(7), start); |
| 215 length -= 7; | 215 length -= 7; |
| 216 } | 216 } |
| 217 | 217 |
| 218 if (pos == std::string::npos) { | 218 if (pos == std::string::npos) { |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 page_->loading_count_--; | 508 page_->loading_count_--; |
| 509 } | 509 } |
| 510 | 510 |
| 511 PDFiumPage::Link::Link() { | 511 PDFiumPage::Link::Link() { |
| 512 } | 512 } |
| 513 | 513 |
| 514 PDFiumPage::Link::~Link() { | 514 PDFiumPage::Link::~Link() { |
| 515 } | 515 } |
| 516 | 516 |
| 517 } // namespace chrome_pdf | 517 } // namespace chrome_pdf |
| OLD | NEW |