| 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 10 matching lines...) Expand all Loading... |
| 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 #ifndef DatabaseAuthorizer_h | 28 #ifndef DatabaseAuthorizer_h |
| 29 #define DatabaseAuthorizer_h | 29 #define DatabaseAuthorizer_h |
| 30 | 30 |
| 31 #include "heap/Handle.h" |
| 31 #include "wtf/Forward.h" | 32 #include "wtf/Forward.h" |
| 32 #include "wtf/HashSet.h" | 33 #include "wtf/HashSet.h" |
| 33 #include "wtf/ThreadSafeRefCounted.h" | 34 #include "wtf/ThreadSafeRefCounted.h" |
| 34 #include "wtf/text/StringHash.h" | 35 #include "wtf/text/StringHash.h" |
| 35 #include "wtf/text/WTFString.h" | 36 #include "wtf/text/WTFString.h" |
| 36 | 37 |
| 37 namespace WebCore { | 38 namespace WebCore { |
| 38 | 39 |
| 39 extern const int SQLAuthAllow; | 40 extern const int SQLAuthAllow; |
| 40 extern const int SQLAuthDeny; | 41 extern const int SQLAuthDeny; |
| 41 | 42 |
| 42 class DatabaseAuthorizer : public ThreadSafeRefCounted<DatabaseAuthorizer> { | 43 class DatabaseAuthorizer : public ThreadSafeRefCountedWillBeGarbageCollectedFina
lized<DatabaseAuthorizer> { |
| 43 public: | 44 public: |
| 44 | 45 |
| 45 enum Permissions { | 46 enum Permissions { |
| 46 ReadWriteMask = 0, | 47 ReadWriteMask = 0, |
| 47 ReadOnlyMask = 1 << 1, | 48 ReadOnlyMask = 1 << 1, |
| 48 NoAccessMask = 1 << 2 | 49 NoAccessMask = 1 << 2 |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 static PassRefPtr<DatabaseAuthorizer> create(const String& databaseInfoTable
Name); | 52 static PassRefPtrWillBeRawPtr<DatabaseAuthorizer> create(const String& datab
aseInfoTableName); |
| 53 void trace(Visitor*) { } |
| 52 | 54 |
| 53 int createTable(const String& tableName); | 55 int createTable(const String& tableName); |
| 54 int createTempTable(const String& tableName); | 56 int createTempTable(const String& tableName); |
| 55 int dropTable(const String& tableName); | 57 int dropTable(const String& tableName); |
| 56 int dropTempTable(const String& tableName); | 58 int dropTempTable(const String& tableName); |
| 57 int allowAlterTable(const String& databaseName, const String& tableName); | 59 int allowAlterTable(const String& databaseName, const String& tableName); |
| 58 | 60 |
| 59 int createIndex(const String& indexName, const String& tableName); | 61 int createIndex(const String& indexName, const String& tableName); |
| 60 int createTempIndex(const String& indexName, const String& tableName); | 62 int createTempIndex(const String& indexName, const String& tableName); |
| 61 int dropIndex(const String& indexName, const String& tableName); | 63 int dropIndex(const String& indexName, const String& tableName); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 bool m_hadDeletes : 1; | 117 bool m_hadDeletes : 1; |
| 116 | 118 |
| 117 const String m_databaseInfoTableName; | 119 const String m_databaseInfoTableName; |
| 118 | 120 |
| 119 HashSet<String, CaseFoldingHash> m_whitelistedFunctions; | 121 HashSet<String, CaseFoldingHash> m_whitelistedFunctions; |
| 120 }; | 122 }; |
| 121 | 123 |
| 122 } // namespace WebCore | 124 } // namespace WebCore |
| 123 | 125 |
| 124 #endif // DatabaseAuthorizer_h | 126 #endif // DatabaseAuthorizer_h |
| OLD | NEW |