OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2007, 2008, 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2007, 2008, 2011, 2012 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. | 3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. |
4 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. | 4 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 class KURLCharsetConverter final : public url::CharsetConverter { | 95 class KURLCharsetConverter final : public url::CharsetConverter { |
96 DISALLOW_NEW(); | 96 DISALLOW_NEW(); |
97 public: | 97 public: |
98 // The encoding parameter may be 0, but in this case the object must not be
called. | 98 // The encoding parameter may be 0, but in this case the object must not be
called. |
99 explicit KURLCharsetConverter(const WTF::TextEncoding* encoding) | 99 explicit KURLCharsetConverter(const WTF::TextEncoding* encoding) |
100 : m_encoding(encoding) | 100 : m_encoding(encoding) |
101 { | 101 { |
102 } | 102 } |
103 | 103 |
104 void ConvertFromUTF16(const url::UTF16Char* input, int inputLength, url::Can
onOutput* output) override | 104 void ConvertFromUTF16(const base::char16* input, int inputLength, url::Canon
Output* output) override |
105 { | 105 { |
106 CString encoded = m_encoding->encode(String(input, inputLength), WTF::UR
LEncodedEntitiesForUnencodables); | 106 CString encoded = m_encoding->encode(String(input, inputLength), WTF::UR
LEncodedEntitiesForUnencodables); |
107 output->Append(encoded.data(), static_cast<int>(encoded.length())); | 107 output->Append(encoded.data(), static_cast<int>(encoded.length())); |
108 } | 108 } |
109 | 109 |
110 private: | 110 private: |
111 const WTF::TextEncoding* m_encoding; | 111 const WTF::TextEncoding* m_encoding; |
112 }; | 112 }; |
113 | 113 |
114 } // namespace | 114 } // namespace |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 // without modification. However, I'm concerned about | 669 // without modification. However, I'm concerned about |
670 // https://bugs.webkit.org/show_bug.cgi?id=20559 so am keeping this old | 670 // https://bugs.webkit.org/show_bug.cgi?id=20559 so am keeping this old |
671 // custom code for now. Using their version will also fix the bug that | 671 // custom code for now. Using their version will also fix the bug that |
672 // we ignore the encoding. | 672 // we ignore the encoding. |
673 // | 673 // |
674 // FIXME b/1350291: This does not get called very often. We just convert | 674 // FIXME b/1350291: This does not get called very often. We just convert |
675 // first to 8-bit UTF-8, then unescape, then back to 16-bit. This kind of | 675 // first to 8-bit UTF-8, then unescape, then back to 16-bit. This kind of |
676 // sucks, and we don't use the encoding properly, which will make some | 676 // sucks, and we don't use the encoding properly, which will make some |
677 // obscure anchor navigations fail. | 677 // obscure anchor navigations fail. |
678 StringUTF8Adaptor stringUTF8(string); | 678 StringUTF8Adaptor stringUTF8(string); |
679 url::RawCanonOutputT<url::UTF16Char> unescaped; | 679 url::RawCanonOutputT<base::char16> unescaped; |
680 url::DecodeURLEscapeSequences(stringUTF8.data(), stringUTF8.length(), &unesc
aped); | 680 url::DecodeURLEscapeSequences(stringUTF8.data(), stringUTF8.length(), &unesc
aped); |
681 return StringImpl::create8BitIfPossible(reinterpret_cast<UChar*>(unescaped.d
ata()), unescaped.length()); | 681 return StringImpl::create8BitIfPossible(reinterpret_cast<UChar*>(unescaped.d
ata()), unescaped.length()); |
682 } | 682 } |
683 | 683 |
684 String encodeWithURLEscapeSequences(const String& notEncodedString) | 684 String encodeWithURLEscapeSequences(const String& notEncodedString) |
685 { | 685 { |
686 CString utf8 = UTF8Encoding().encode(notEncodedString, WTF::URLEncodedEntiti
esForUnencodables); | 686 CString utf8 = UTF8Encoding().encode(notEncodedString, WTF::URLEncodedEntiti
esForUnencodables); |
687 | 687 |
688 url::RawCanonOutputT<char> buffer; | 688 url::RawCanonOutputT<char> buffer; |
689 int inputLength = utf8.length(); | 689 int inputLength = utf8.length(); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 m_string = AtomicString::fromUTF8(output.data(), output.length()); | 914 m_string = AtomicString::fromUTF8(output.data(), output.length()); |
915 } | 915 } |
916 | 916 |
917 bool KURL::isSafeToSendToAnotherThread() const | 917 bool KURL::isSafeToSendToAnotherThread() const |
918 { | 918 { |
919 return m_string.isSafeToSendToAnotherThread() | 919 return m_string.isSafeToSendToAnotherThread() |
920 && (!m_innerURL || m_innerURL->isSafeToSendToAnotherThread()); | 920 && (!m_innerURL || m_innerURL->isSafeToSendToAnotherThread()); |
921 } | 921 } |
922 | 922 |
923 } // namespace blink | 923 } // namespace blink |
OLD | NEW |