Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 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 16 matching lines...) Expand all Loading... | |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #include "config.h" | 29 #include "config.h" |
| 30 #include "platform/weborigin/SecurityOrigin.h" | 30 #include "platform/weborigin/SecurityOrigin.h" |
| 31 | 31 |
| 32 #include "platform/weborigin/KURL.h" | 32 #include "platform/weborigin/KURL.h" |
| 33 #include "platform/weborigin/KnownPorts.h" | 33 #include "platform/weborigin/KnownPorts.h" |
| 34 #include "platform/weborigin/SchemeRegistry.h" | 34 #include "platform/weborigin/SchemeRegistry.h" |
| 35 #include "platform/weborigin/SecurityOriginCache.h" | 35 #include "platform/weborigin/SecurityOriginCache.h" |
| 36 #include "platform/weborigin/SecurityPolicy.h" | 36 #include "platform/weborigin/SecurityPolicy.h" |
| 37 #include "public/platform/Platform.h" | |
| 37 #include "url/url_canon_ip.h" | 38 #include "url/url_canon_ip.h" |
| 38 #include "wtf/HexNumber.h" | 39 #include "wtf/HexNumber.h" |
| 39 #include "wtf/MainThread.h" | 40 #include "wtf/MainThread.h" |
| 40 #include "wtf/StdLibExtras.h" | 41 #include "wtf/StdLibExtras.h" |
| 41 #include "wtf/text/StringBuilder.h" | 42 #include "wtf/text/StringBuilder.h" |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| 45 const int InvalidPort = 0; | 46 const int InvalidPort = 0; |
| 46 const int MaxAllowedPort = 65535; | 47 const int MaxAllowedPort = 65535; |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 | 437 |
| 437 int numComponents; | 438 int numComponents; |
| 438 url::Component hostComponent(0, hostAscii.length()); | 439 url::Component hostComponent(0, hostAscii.length()); |
| 439 url::CanonHostInfo::Family family = url::IPv4AddressToNumber( | 440 url::CanonHostInfo::Family family = url::IPv4AddressToNumber( |
| 440 hostAscii.data(), hostComponent, &(ipNumber)[0], &numComponents); | 441 hostAscii.data(), hostComponent, &(ipNumber)[0], &numComponents); |
| 441 if (family != url::CanonHostInfo::IPV4) | 442 if (family != url::CanonHostInfo::IPV4) |
| 442 return false; | 443 return false; |
| 443 return ipNumber[0] == 127; | 444 return ipNumber[0] == 127; |
| 444 } | 445 } |
| 445 | 446 |
| 447 bool SecurityOrigin::isReservedIPAddress() const | |
| 448 { | |
| 449 return blink::Platform::current()->isHostnameReservedIPAddress(m_host); | |
|
abarth-chromium
2014/08/01 18:09:45
No need for blink::
| |
| 450 } | |
| 451 | |
| 446 String SecurityOrigin::toString() const | 452 String SecurityOrigin::toString() const |
| 447 { | 453 { |
| 448 if (isUnique()) | 454 if (isUnique()) |
| 449 return "null"; | 455 return "null"; |
| 450 if (m_protocol == "file" && m_enforceFilePathSeparation) | 456 if (m_protocol == "file" && m_enforceFilePathSeparation) |
| 451 return "null"; | 457 return "null"; |
| 452 return toRawString(); | 458 return toRawString(); |
| 453 } | 459 } |
| 454 | 460 |
| 455 AtomicString SecurityOrigin::toAtomicString() const | 461 AtomicString SecurityOrigin::toAtomicString() const |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 525 } | 531 } |
| 526 | 532 |
| 527 const String& SecurityOrigin::urlWithUniqueSecurityOrigin() | 533 const String& SecurityOrigin::urlWithUniqueSecurityOrigin() |
| 528 { | 534 { |
| 529 ASSERT(isMainThread()); | 535 ASSERT(isMainThread()); |
| 530 DEFINE_STATIC_LOCAL(const String, uniqueSecurityOriginURL, ("data:,")); | 536 DEFINE_STATIC_LOCAL(const String, uniqueSecurityOriginURL, ("data:,")); |
| 531 return uniqueSecurityOriginURL; | 537 return uniqueSecurityOriginURL; |
| 532 } | 538 } |
| 533 | 539 |
| 534 } // namespace blink | 540 } // namespace blink |
| OLD | NEW |