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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 if (before_text.size() > 0) | 233 if (before_text.size() > 0) |
234 text_nodes->Append(CreateTextNode(before_text)); | 234 text_nodes->Append(CreateTextNode(before_text)); |
235 } else { | 235 } else { |
236 text_nodes->Append(CreateTextNode(text_utf8)); | 236 text_nodes->Append(CreateTextNode(text_utf8)); |
237 } | 237 } |
238 | 238 |
239 node->Set(kTextBoxNodes, text_nodes); // Takes ownership of |text_nodes|. | 239 node->Set(kTextBoxNodes, text_nodes); // Takes ownership of |text_nodes|. |
240 return node; | 240 return node; |
241 } | 241 } |
242 | 242 |
243 base::Value* PDFiumPage::CreateTextNode(std::string text) { | 243 base::Value* PDFiumPage::CreateTextNode(const std::string& text) { |
244 base::DictionaryValue* node = new base::DictionaryValue(); | 244 base::DictionaryValue* node = new base::DictionaryValue(); |
245 node->SetString(kTextNodeType, kTextNodeTypeText); | 245 node->SetString(kTextNodeType, kTextNodeTypeText); |
246 node->SetString(kTextNodeText, text); | 246 node->SetString(kTextNodeText, text); |
247 return node; | 247 return node; |
248 } | 248 } |
249 | 249 |
250 base::Value* PDFiumPage::CreateURLNode(std::string text, std::string url) { | 250 base::Value* PDFiumPage::CreateURLNode(const std::string& text, |
| 251 const std::string& url) { |
251 base::DictionaryValue* node = new base::DictionaryValue(); | 252 base::DictionaryValue* node = new base::DictionaryValue(); |
252 node->SetString(kTextNodeType, kTextNodeTypeURL); | 253 node->SetString(kTextNodeType, kTextNodeTypeURL); |
253 node->SetString(kTextNodeText, text); | 254 node->SetString(kTextNodeText, text); |
254 node->SetString(kTextNodeURL, url); | 255 node->SetString(kTextNodeURL, url); |
255 return node; | 256 return node; |
256 } | 257 } |
257 | 258 |
258 PDFiumPage::Area PDFiumPage::GetCharIndex(const pp::Point& point, | 259 PDFiumPage::Area PDFiumPage::GetCharIndex(const pp::Point& point, |
259 int rotation, | 260 int rotation, |
260 int* char_index, | 261 int* char_index, |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 page_->loading_count_--; | 527 page_->loading_count_--; |
527 } | 528 } |
528 | 529 |
529 PDFiumPage::Link::Link() { | 530 PDFiumPage::Link::Link() { |
530 } | 531 } |
531 | 532 |
532 PDFiumPage::Link::~Link() { | 533 PDFiumPage::Link::~Link() { |
533 } | 534 } |
534 | 535 |
535 } // namespace chrome_pdf | 536 } // namespace chrome_pdf |
OLD | NEW |