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 "ui/base/clipboard/clipboard_util_win.h" | 5 #include "ui/base/clipboard/clipboard_util_win.h" |
6 | 6 |
7 #include <shellapi.h> | 7 #include <shellapi.h> |
8 #include <shlwapi.h> | 8 #include <shlwapi.h> |
9 #include <wininet.h> // For INTERNET_MAX_URL_LENGTH. | 9 #include <wininet.h> // For INTERNET_MAX_URL_LENGTH. |
10 | 10 |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 *base_url = cf_html.substr(src_start, src_end - src_start); | 465 *base_url = cf_html.substr(src_start, src_end - src_start); |
466 base::TrimWhitespace(*base_url, base::TRIM_ALL, base_url); | 466 base::TrimWhitespace(*base_url, base::TRIM_ALL, base_url); |
467 } | 467 } |
468 } | 468 } |
469 } | 469 } |
470 | 470 |
471 // Find the markup between "<!--StartFragment-->" and "<!--EndFragment-->". | 471 // Find the markup between "<!--StartFragment-->" and "<!--EndFragment-->". |
472 // If the comments cannot be found, like copying from OpenOffice Writer, | 472 // If the comments cannot be found, like copying from OpenOffice Writer, |
473 // we simply fall back to using StartFragment/EndFragment bytecount values | 473 // we simply fall back to using StartFragment/EndFragment bytecount values |
474 // to determine the fragment indexes. | 474 // to determine the fragment indexes. |
475 std::string cf_html_lower = StringToLowerASCII(cf_html); | 475 std::string cf_html_lower = base::StringToLowerASCII(cf_html); |
476 size_t markup_start = cf_html_lower.find("<html", 0); | 476 size_t markup_start = cf_html_lower.find("<html", 0); |
477 if (html_start) { | 477 if (html_start) { |
478 *html_start = markup_start; | 478 *html_start = markup_start; |
479 } | 479 } |
480 size_t tag_start = cf_html.find("<!--StartFragment", markup_start); | 480 size_t tag_start = cf_html.find("<!--StartFragment", markup_start); |
481 if (tag_start == std::string::npos) { | 481 if (tag_start == std::string::npos) { |
482 static std::string start_fragment_str("StartFragment:"); | 482 static std::string start_fragment_str("StartFragment:"); |
483 size_t start_fragment_start = cf_html.find(start_fragment_str); | 483 size_t start_fragment_start = cf_html.find(start_fragment_str); |
484 if (start_fragment_start != std::string::npos) { | 484 if (start_fragment_start != std::string::npos) { |
485 *fragment_start = static_cast<size_t>(atoi(cf_html.c_str() + | 485 *fragment_start = static_cast<size_t>(atoi(cf_html.c_str() + |
486 start_fragment_start + start_fragment_str.length())); | 486 start_fragment_start + start_fragment_str.length())); |
487 } | 487 } |
488 | 488 |
489 static std::string end_fragment_str("EndFragment:"); | 489 static std::string end_fragment_str("EndFragment:"); |
490 size_t end_fragment_start = cf_html.find(end_fragment_str); | 490 size_t end_fragment_start = cf_html.find(end_fragment_str); |
491 if (end_fragment_start != std::string::npos) { | 491 if (end_fragment_start != std::string::npos) { |
492 *fragment_end = static_cast<size_t>(atoi(cf_html.c_str() + | 492 *fragment_end = static_cast<size_t>(atoi(cf_html.c_str() + |
493 end_fragment_start + end_fragment_str.length())); | 493 end_fragment_start + end_fragment_str.length())); |
494 } | 494 } |
495 } else { | 495 } else { |
496 *fragment_start = cf_html.find('>', tag_start) + 1; | 496 *fragment_start = cf_html.find('>', tag_start) + 1; |
497 size_t tag_end = cf_html.rfind("<!--EndFragment", std::string::npos); | 497 size_t tag_end = cf_html.rfind("<!--EndFragment", std::string::npos); |
498 *fragment_end = cf_html.rfind('<', tag_end); | 498 *fragment_end = cf_html.rfind('<', tag_end); |
499 } | 499 } |
500 } | 500 } |
501 | 501 |
502 } // namespace ui | 502 } // namespace ui |
OLD | NEW |