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 "net/base/net_util.h" | 5 #include "net/base/net_util.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 | 486 |
487 class HostComponentTransform : public AppendComponentTransform { | 487 class HostComponentTransform : public AppendComponentTransform { |
488 public: | 488 public: |
489 explicit HostComponentTransform(const std::string& languages) | 489 explicit HostComponentTransform(const std::string& languages) |
490 : languages_(languages) { | 490 : languages_(languages) { |
491 } | 491 } |
492 | 492 |
493 private: | 493 private: |
494 virtual base::string16 Execute( | 494 virtual base::string16 Execute( |
495 const std::string& component_text, | 495 const std::string& component_text, |
496 base::OffsetAdjuster::Adjustments* adjustments) const OVERRIDE { | 496 base::OffsetAdjuster::Adjustments* adjustments) const override { |
497 return IDNToUnicodeWithAdjustments(component_text, languages_, | 497 return IDNToUnicodeWithAdjustments(component_text, languages_, |
498 adjustments); | 498 adjustments); |
499 } | 499 } |
500 | 500 |
501 const std::string& languages_; | 501 const std::string& languages_; |
502 }; | 502 }; |
503 | 503 |
504 class NonHostComponentTransform : public AppendComponentTransform { | 504 class NonHostComponentTransform : public AppendComponentTransform { |
505 public: | 505 public: |
506 explicit NonHostComponentTransform(UnescapeRule::Type unescape_rules) | 506 explicit NonHostComponentTransform(UnescapeRule::Type unescape_rules) |
507 : unescape_rules_(unescape_rules) { | 507 : unescape_rules_(unescape_rules) { |
508 } | 508 } |
509 | 509 |
510 private: | 510 private: |
511 virtual base::string16 Execute( | 511 virtual base::string16 Execute( |
512 const std::string& component_text, | 512 const std::string& component_text, |
513 base::OffsetAdjuster::Adjustments* adjustments) const OVERRIDE { | 513 base::OffsetAdjuster::Adjustments* adjustments) const override { |
514 return (unescape_rules_ == UnescapeRule::NONE) ? | 514 return (unescape_rules_ == UnescapeRule::NONE) ? |
515 base::UTF8ToUTF16WithAdjustments(component_text, adjustments) : | 515 base::UTF8ToUTF16WithAdjustments(component_text, adjustments) : |
516 UnescapeAndDecodeUTF8URLComponentWithAdjustments(component_text, | 516 UnescapeAndDecodeUTF8URLComponentWithAdjustments(component_text, |
517 unescape_rules_, adjustments); | 517 unescape_rules_, adjustments); |
518 } | 518 } |
519 | 519 |
520 const UnescapeRule::Type unescape_rules_; | 520 const UnescapeRule::Type unescape_rules_; |
521 }; | 521 }; |
522 | 522 |
523 // Transforms the portion of |spec| covered by |original_component| according to | 523 // Transforms the portion of |spec| covered by |original_component| according to |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 if (offset_for_adjustment) | 821 if (offset_for_adjustment) |
822 offsets.push_back(*offset_for_adjustment); | 822 offsets.push_back(*offset_for_adjustment); |
823 base::string16 result = FormatUrlWithOffsets(url, languages, format_types, | 823 base::string16 result = FormatUrlWithOffsets(url, languages, format_types, |
824 unescape_rules, new_parsed, prefix_end, &offsets); | 824 unescape_rules, new_parsed, prefix_end, &offsets); |
825 if (offset_for_adjustment) | 825 if (offset_for_adjustment) |
826 *offset_for_adjustment = offsets[0]; | 826 *offset_for_adjustment = offsets[0]; |
827 return result; | 827 return result; |
828 } | 828 } |
829 | 829 |
830 } // namespace net | 830 } // namespace net |
OLD | NEW |