OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 AtomicString toRawAtomicString() const; | 196 AtomicString toRawAtomicString() const; |
197 | 197 |
198 // This method checks for equality, ignoring the value of document.domain | 198 // This method checks for equality, ignoring the value of document.domain |
199 // (and whether it was set) but considering the host. It is used for postMes sage. | 199 // (and whether it was set) but considering the host. It is used for postMes sage. |
200 bool isSameSchemeHostPort(const SecurityOrigin*) const; | 200 bool isSameSchemeHostPort(const SecurityOrigin*) const; |
201 | 201 |
202 bool needsDatabaseIdentifierQuirkForFiles() const { return m_needsDatabaseId entifierQuirkForFiles; } | 202 bool needsDatabaseIdentifierQuirkForFiles() const { return m_needsDatabaseId entifierQuirkForFiles; } |
203 | 203 |
204 static const String& urlWithUniqueSecurityOrigin(); | 204 static const String& urlWithUniqueSecurityOrigin(); |
205 | 205 |
206 // A SecurityOrigin can be configured/mutated to take global origin | |
207 // policy constraints and overrides into account. These policy overrides | |
208 // can be transferred from one SecurityOrigin and applied to another. | |
209 class PolicyOverrides { | |
Mike West
2014/09/26 11:29:10
It might be simpler to model this as a struct; the
| |
210 public: | |
211 PolicyOverrides() | |
212 : m_grantUniversalAccess(false) | |
213 , m_enforceFilePathSeparation(false) | |
214 { | |
215 } | |
216 | |
217 PolicyOverrides(bool grantUniversalAccess, bool enforceFilePathSeparatio n) | |
218 : m_grantUniversalAccess(grantUniversalAccess) | |
219 , m_enforceFilePathSeparation(enforceFilePathSeparation) | |
220 { | |
221 } | |
222 | |
223 // Mirrors what SecurityOrigin::grantUniversalAccess() grants. | |
224 bool grantUniversalAccess() const { return m_grantUniversalAccess; } | |
225 | |
226 // Mirrors what SecurityOrigin::enforceFilePathSeparation() grants. | |
227 bool enforceFilePathSeparation() const { return m_enforceFilePathSeparat ion; } | |
Mike West
2014/09/26 11:29:10
These both sound a bit strange. Perhaps "doesGrant
| |
228 | |
229 private: | |
230 bool m_grantUniversalAccess; | |
231 bool m_enforceFilePathSeparation; | |
232 }; | |
233 | |
234 // Return the origin policy overrides of this origin. | |
235 PolicyOverrides policyOverrides() const; | |
236 | |
237 // Apply the overrides to this origin. Overrides that | |
238 // are set will be enabled, those that aren't will be | |
239 // cleared. | |
240 void applyPolicyOverrides(const PolicyOverrides&); | |
241 | |
206 private: | 242 private: |
207 SecurityOrigin(); | 243 SecurityOrigin(); |
208 explicit SecurityOrigin(const KURL&); | 244 explicit SecurityOrigin(const KURL&); |
209 explicit SecurityOrigin(const SecurityOrigin*); | 245 explicit SecurityOrigin(const SecurityOrigin*); |
210 | 246 |
211 // FIXME: Rename this function to something more semantic. | 247 // FIXME: Rename this function to something more semantic. |
212 bool passesFileCheck(const SecurityOrigin*) const; | 248 bool passesFileCheck(const SecurityOrigin*) const; |
213 void buildRawString(StringBuilder&) const; | 249 void buildRawString(StringBuilder&) const; |
214 | 250 |
215 String m_protocol; | 251 String m_protocol; |
216 String m_host; | 252 String m_host; |
217 String m_domain; | 253 String m_domain; |
218 String m_filePath; | 254 String m_filePath; |
219 unsigned short m_port; | 255 unsigned short m_port; |
220 bool m_isUnique; | 256 bool m_isUnique; |
221 bool m_universalAccess; | 257 bool m_universalAccess; |
222 bool m_domainWasSetInDOM; | 258 bool m_domainWasSetInDOM; |
223 bool m_canLoadLocalResources; | 259 bool m_canLoadLocalResources; |
224 bool m_enforceFilePathSeparation; | 260 bool m_enforceFilePathSeparation; |
225 bool m_needsDatabaseIdentifierQuirkForFiles; | 261 bool m_needsDatabaseIdentifierQuirkForFiles; |
226 }; | 262 }; |
227 | 263 |
228 } // namespace blink | 264 } // namespace blink |
229 | 265 |
230 #endif // SecurityOrigin_h | 266 #endif // SecurityOrigin_h |
OLD | NEW |