| 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 27 matching lines...) Expand all Loading... |
| 38 class KURL; | 38 class KURL; |
| 39 | 39 |
| 40 class SecurityOrigin : public ThreadSafeRefCounted<SecurityOrigin> { | 40 class SecurityOrigin : public ThreadSafeRefCounted<SecurityOrigin> { |
| 41 public: | 41 public: |
| 42 enum Policy { | 42 enum Policy { |
| 43 AlwaysDeny = 0, | 43 AlwaysDeny = 0, |
| 44 AlwaysAllow, | 44 AlwaysAllow, |
| 45 Ask | 45 Ask |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 enum StorageBlockingPolicy { | |
| 49 AllowAllStorage = 0, | |
| 50 BlockThirdPartyStorage, | |
| 51 BlockAllStorage | |
| 52 }; | |
| 53 | |
| 54 static PassRefPtr<SecurityOrigin> create(const KURL&); | 48 static PassRefPtr<SecurityOrigin> create(const KURL&); |
| 55 static PassRefPtr<SecurityOrigin> createUnique(); | 49 static PassRefPtr<SecurityOrigin> createUnique(); |
| 56 | 50 |
| 57 static PassRefPtr<SecurityOrigin> createFromDatabaseIdentifier(const String&
); | 51 static PassRefPtr<SecurityOrigin> createFromDatabaseIdentifier(const String&
); |
| 58 static PassRefPtr<SecurityOrigin> createFromString(const String&); | 52 static PassRefPtr<SecurityOrigin> createFromString(const String&); |
| 59 static PassRefPtr<SecurityOrigin> create(const String& protocol, const Strin
g& host, int port); | 53 static PassRefPtr<SecurityOrigin> create(const String& protocol, const Strin
g& host, int port); |
| 60 | 54 |
| 61 // Some URL schemes use nested URLs for their security context. For example, | 55 // Some URL schemes use nested URLs for their security context. For example, |
| 62 // filesystem URLs look like the following: | 56 // filesystem URLs look like the following: |
| 63 // | 57 // |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // | 127 // |
| 134 // Note: This method exists only to support backwards compatibility | 128 // Note: This method exists only to support backwards compatibility |
| 135 // with older versions of WebKit. | 129 // with older versions of WebKit. |
| 136 void grantLoadLocalResources(); | 130 void grantLoadLocalResources(); |
| 137 | 131 |
| 138 // Explicitly grant the ability to access very other SecurityOrigin. | 132 // Explicitly grant the ability to access very other SecurityOrigin. |
| 139 // | 133 // |
| 140 // WARNING: This is an extremely powerful ability. Use with caution! | 134 // WARNING: This is an extremely powerful ability. Use with caution! |
| 141 void grantUniversalAccess(); | 135 void grantUniversalAccess(); |
| 142 | 136 |
| 143 void setStorageBlockingPolicy(StorageBlockingPolicy policy) { m_storageBlock
ingPolicy = policy; } | |
| 144 | |
| 145 bool canAccessDatabase(const SecurityOrigin* topOrigin = 0) const { return c
anAccessStorage(topOrigin); }; | 137 bool canAccessDatabase(const SecurityOrigin* topOrigin = 0) const { return c
anAccessStorage(topOrigin); }; |
| 146 bool canAccessLocalStorage(const SecurityOrigin* topOrigin) const { return c
anAccessStorage(topOrigin); }; | 138 bool canAccessLocalStorage(const SecurityOrigin* topOrigin) const { return c
anAccessStorage(topOrigin); }; |
| 147 bool canAccessSharedWorkers(const SecurityOrigin* topOrigin) const { return
canAccessStorage(topOrigin); } | 139 bool canAccessSharedWorkers(const SecurityOrigin* topOrigin) const { return
canAccessStorage(topOrigin); } |
| 148 bool canAccessPluginStorage(const SecurityOrigin* topOrigin) const { return
canAccessStorage(topOrigin); } | 140 bool canAccessPluginStorage(const SecurityOrigin* topOrigin) const { return
canAccessStorage(topOrigin); } |
| 149 bool canAccessApplicationCache(const SecurityOrigin* topOrigin) const { retu
rn canAccessStorage(topOrigin); } | 141 bool canAccessApplicationCache(const SecurityOrigin* topOrigin) const { retu
rn canAccessStorage(topOrigin); } |
| 150 bool canAccessCookies() const { return !isUnique(); } | 142 bool canAccessCookies() const { return !isUnique(); } |
| 151 bool canAccessPasswordManager() const { return !isUnique(); } | 143 bool canAccessPasswordManager() const { return !isUnique(); } |
| 152 bool canAccessFileSystem() const { return !isUnique(); } | 144 bool canAccessFileSystem() const { return !isUnique(); } |
| 153 Policy canShowNotifications() const; | 145 Policy canShowNotifications() const; |
| 154 | 146 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 String m_protocol; | 213 String m_protocol; |
| 222 String m_host; | 214 String m_host; |
| 223 mutable String m_encodedHost; | 215 mutable String m_encodedHost; |
| 224 String m_domain; | 216 String m_domain; |
| 225 String m_filePath; | 217 String m_filePath; |
| 226 unsigned short m_port; | 218 unsigned short m_port; |
| 227 bool m_isUnique; | 219 bool m_isUnique; |
| 228 bool m_universalAccess; | 220 bool m_universalAccess; |
| 229 bool m_domainWasSetInDOM; | 221 bool m_domainWasSetInDOM; |
| 230 bool m_canLoadLocalResources; | 222 bool m_canLoadLocalResources; |
| 231 StorageBlockingPolicy m_storageBlockingPolicy; | |
| 232 bool m_enforceFilePathSeparation; | 223 bool m_enforceFilePathSeparation; |
| 233 bool m_needsDatabaseIdentifierQuirkForFiles; | 224 bool m_needsDatabaseIdentifierQuirkForFiles; |
| 234 }; | 225 }; |
| 235 | 226 |
| 236 } // namespace WebCore | 227 } // namespace WebCore |
| 237 | 228 |
| 238 #endif // SecurityOrigin_h | 229 #endif // SecurityOrigin_h |
| OLD | NEW |