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 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 10 matching lines...) Expand all Loading... |
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #include "platform/weborigin/KnownPorts.h" | 27 #include "platform/weborigin/KnownPorts.h" |
28 | 28 |
29 #include "net/base/port_util.h" | 29 #include "net/base/port_util.h" |
30 #include "platform/weborigin/KURL.h" | 30 #include "platform/weborigin/KURL.h" |
31 #include "wtf/text/StringUTF8Adaptor.h" | 31 #include "platform/wtf/text/StringUTF8Adaptor.h" |
32 #include "wtf/text/WTFString.h" | 32 #include "platform/wtf/text/WTFString.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 bool isDefaultPortForProtocol(unsigned short port, | 36 bool isDefaultPortForProtocol(unsigned short port, |
37 const WTF::String& protocol) { | 37 const WTF::String& protocol) { |
38 if (protocol.isEmpty()) | 38 if (protocol.isEmpty()) |
39 return false; | 39 return false; |
40 | 40 |
41 switch (port) { | 41 switch (port) { |
42 case 80: | 42 case 80: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 protocol = emptyString; | 74 protocol = emptyString; |
75 unsigned short effectivePort = url.port(); | 75 unsigned short effectivePort = url.port(); |
76 if (!effectivePort) | 76 if (!effectivePort) |
77 effectivePort = defaultPortForProtocol(protocol); | 77 effectivePort = defaultPortForProtocol(protocol); |
78 StringUTF8Adaptor utf8(protocol); | 78 StringUTF8Adaptor utf8(protocol); |
79 return net::IsPortAllowedForScheme(effectivePort, | 79 return net::IsPortAllowedForScheme(effectivePort, |
80 std::string(utf8.data(), utf8.length())); | 80 std::string(utf8.data(), utf8.length())); |
81 } | 81 } |
82 | 82 |
83 } // namespace blink | 83 } // namespace blink |
OLD | NEW |