OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 20 matching lines...) Expand all Loading... |
31 #include "config.h" | 31 #include "config.h" |
32 #include "public/web/WebSecurityOrigin.h" | 32 #include "public/web/WebSecurityOrigin.h" |
33 | 33 |
34 #include "platform/weborigin/DatabaseIdentifier.h" | 34 #include "platform/weborigin/DatabaseIdentifier.h" |
35 #include "platform/weborigin/KURL.h" | 35 #include "platform/weborigin/KURL.h" |
36 #include "platform/weborigin/SecurityOrigin.h" | 36 #include "platform/weborigin/SecurityOrigin.h" |
37 #include "public/platform/WebString.h" | 37 #include "public/platform/WebString.h" |
38 #include "public/platform/WebURL.h" | 38 #include "public/platform/WebURL.h" |
39 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
40 | 40 |
41 using namespace blink; | |
42 | |
43 namespace blink { | 41 namespace blink { |
44 | 42 |
45 class WebSecurityOriginPrivate : public SecurityOrigin { | 43 class WebSecurityOriginPrivate : public SecurityOrigin { |
46 }; | 44 }; |
47 | 45 |
48 WebSecurityOrigin WebSecurityOrigin::createFromDatabaseIdentifier(const WebStrin
g& databaseIdentifier) | 46 WebSecurityOrigin WebSecurityOrigin::createFromDatabaseIdentifier(const WebStrin
g& databaseIdentifier) |
49 { | 47 { |
50 return WebSecurityOrigin(createSecurityOriginFromDatabaseIdentifier(database
Identifier)); | 48 return WebSecurityOrigin(createSecurityOriginFromDatabaseIdentifier(database
Identifier)); |
51 } | 49 } |
52 | 50 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 ASSERT(m_private); | 128 ASSERT(m_private); |
131 return createDatabaseIdentifierFromSecurityOrigin(m_private); | 129 return createDatabaseIdentifierFromSecurityOrigin(m_private); |
132 } | 130 } |
133 | 131 |
134 bool WebSecurityOrigin::canAccessPasswordManager() const | 132 bool WebSecurityOrigin::canAccessPasswordManager() const |
135 { | 133 { |
136 ASSERT(m_private); | 134 ASSERT(m_private); |
137 return m_private->canAccessPasswordManager(); | 135 return m_private->canAccessPasswordManager(); |
138 } | 136 } |
139 | 137 |
140 WebSecurityOrigin::WebSecurityOrigin(const WTF::PassRefPtr<blink::SecurityOrigin
>& origin) | 138 WebSecurityOrigin::WebSecurityOrigin(const WTF::PassRefPtr<SecurityOrigin>& orig
in) |
141 : m_private(static_cast<WebSecurityOriginPrivate*>(origin.leakRef())) | 139 : m_private(static_cast<WebSecurityOriginPrivate*>(origin.leakRef())) |
142 { | 140 { |
143 } | 141 } |
144 | 142 |
145 WebSecurityOrigin& WebSecurityOrigin::operator=(const WTF::PassRefPtr<blink::Sec
urityOrigin>& origin) | 143 WebSecurityOrigin& WebSecurityOrigin::operator=(const WTF::PassRefPtr<SecurityOr
igin>& origin) |
146 { | 144 { |
147 assign(static_cast<WebSecurityOriginPrivate*>(origin.leakRef())); | 145 assign(static_cast<WebSecurityOriginPrivate*>(origin.leakRef())); |
148 return *this; | 146 return *this; |
149 } | 147 } |
150 | 148 |
151 WebSecurityOrigin::operator WTF::PassRefPtr<blink::SecurityOrigin>() const | 149 WebSecurityOrigin::operator WTF::PassRefPtr<SecurityOrigin>() const |
152 { | 150 { |
153 return PassRefPtr<SecurityOrigin>(const_cast<WebSecurityOriginPrivate*>(m_pr
ivate)); | 151 return PassRefPtr<SecurityOrigin>(const_cast<WebSecurityOriginPrivate*>(m_pr
ivate)); |
154 } | 152 } |
155 | 153 |
156 SecurityOrigin* WebSecurityOrigin::get() const | 154 SecurityOrigin* WebSecurityOrigin::get() const |
157 { | 155 { |
158 return m_private; | 156 return m_private; |
159 } | 157 } |
160 | 158 |
161 void WebSecurityOrigin::assign(WebSecurityOriginPrivate* p) | 159 void WebSecurityOrigin::assign(WebSecurityOriginPrivate* p) |
162 { | 160 { |
163 // p is already ref'd for us by the caller | 161 // p is already ref'd for us by the caller |
164 if (m_private) | 162 if (m_private) |
165 m_private->deref(); | 163 m_private->deref(); |
166 m_private = p; | 164 m_private = p; |
167 } | 165 } |
168 | 166 |
169 void WebSecurityOrigin::grantLoadLocalResources() const | 167 void WebSecurityOrigin::grantLoadLocalResources() const |
170 { | 168 { |
171 get()->grantLoadLocalResources(); | 169 get()->grantLoadLocalResources(); |
172 } | 170 } |
173 | 171 |
174 } // namespace blink | 172 } // namespace blink |
OLD | NEW |