OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 | 49 |
50 void WebSecurityOrigin::assign(const WebSecurityOrigin& other) | 50 void WebSecurityOrigin::assign(const WebSecurityOrigin& other) |
51 { | 51 { |
52 WebSecurityOriginPrivate* p = const_cast<WebSecurityOriginPrivate*>(other.m_private); | 52 WebSecurityOriginPrivate* p = const_cast<WebSecurityOriginPrivate*>(other.m_private); |
53 if (p) | 53 if (p) |
54 p->ref(); | 54 p->ref(); |
55 assign(p); | 55 assign(p); |
56 } | 56 } |
57 | 57 |
| 58 WebString WebSecurityOrigin::protocol() const |
| 59 { |
| 60 ASSERT(m_private); |
| 61 return m_private->protocol(); |
| 62 } |
| 63 |
| 64 WebString WebSecurityOrigin::host() const |
| 65 { |
| 66 ASSERT(m_private); |
| 67 return m_private->host(); |
| 68 } |
| 69 |
| 70 unsigned short WebSecurityOrigin::port() const |
| 71 { |
| 72 ASSERT(m_private); |
| 73 return m_private->port(); |
| 74 } |
| 75 |
| 76 bool WebSecurityOrigin::isEmpty() const |
| 77 { |
| 78 ASSERT(m_private); |
| 79 return m_private->isEmpty(); |
| 80 } |
| 81 |
| 82 WebString WebSecurityOrigin::toString() const |
| 83 { |
| 84 // FIXME: We should not support calling this method when m_private is null. |
| 85 if (m_private) |
| 86 return m_private->toString(); |
| 87 |
| 88 return WebString::fromUTF8("null"); |
| 89 } |
| 90 |
58 WebString WebSecurityOrigin::databaseIdentifier() | 91 WebString WebSecurityOrigin::databaseIdentifier() |
59 { | 92 { |
| 93 // FIXME: We should not support calling this method when m_private is null. |
60 if (m_private) | 94 if (m_private) |
61 return m_private->databaseIdentifier(); | 95 return m_private->databaseIdentifier(); |
62 | 96 |
63 return WebString::fromUTF8("null"); | 97 return WebString::fromUTF8("null"); |
64 } | 98 } |
65 | 99 |
66 WebString WebSecurityOrigin::toString() const | |
67 { | |
68 if (m_private) | |
69 return m_private->toString(); | |
70 | |
71 return WebString::fromUTF8("null"); | |
72 } | |
73 | |
74 WebSecurityOrigin::WebSecurityOrigin(const WTF::PassRefPtr<WebCore::SecurityOrigin>& origin) | 100 WebSecurityOrigin::WebSecurityOrigin(const WTF::PassRefPtr<WebCore::SecurityOrigin>& origin) |
75 : m_private(static_cast<WebSecurityOriginPrivate*>(origin.releaseRef())) | 101 : m_private(static_cast<WebSecurityOriginPrivate*>(origin.releaseRef())) |
76 { | 102 { |
77 } | 103 } |
78 | 104 |
79 WebSecurityOrigin& WebSecurityOrigin::operator=(const WTF::PassRefPtr<WebCore::SecurityOrigin>& origin) | 105 WebSecurityOrigin& WebSecurityOrigin::operator=(const WTF::PassRefPtr<WebCore::SecurityOrigin>& origin) |
80 { | 106 { |
81 assign(static_cast<WebSecurityOriginPrivate*>(origin.releaseRef())); | 107 assign(static_cast<WebSecurityOriginPrivate*>(origin.releaseRef())); |
82 return *this; | 108 return *this; |
83 } | 109 } |
84 | 110 |
85 WebSecurityOrigin::operator WTF::PassRefPtr<WebCore::SecurityOrigin>() const | 111 WebSecurityOrigin::operator WTF::PassRefPtr<WebCore::SecurityOrigin>() const |
86 { | 112 { |
87 return PassRefPtr<SecurityOrigin>(const_cast<WebSecurityOriginPrivate*>(m_private)); | 113 return PassRefPtr<SecurityOrigin>(const_cast<WebSecurityOriginPrivate*>(m_private)); |
88 } | 114 } |
89 | 115 |
90 void WebSecurityOrigin::assign(WebSecurityOriginPrivate* p) | 116 void WebSecurityOrigin::assign(WebSecurityOriginPrivate* p) |
91 { | 117 { |
92 // p is already ref'd for us by the caller | 118 // p is already ref'd for us by the caller |
93 if (m_private) | 119 if (m_private) |
94 m_private->deref(); | 120 m_private->deref(); |
95 m_private = p; | 121 m_private = p; |
96 } | 122 } |
97 | 123 |
98 } // namespace WebKit | 124 } // namespace WebKit |
OLD | NEW |