Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: third_party/WebKit/Source/modules/webdatabase/DatabaseAuthorizer.h

Issue 2879893004: Add UseCounter for FTS3 virtual tables in WebSQL. (Closed)
Patch Set: Rebased Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19 matching lines...) Expand all
30 30
31 #include "platform/heap/Handle.h" 31 #include "platform/heap/Handle.h"
32 #include "platform/wtf/Forward.h" 32 #include "platform/wtf/Forward.h"
33 #include "platform/wtf/text/WTFString.h" 33 #include "platform/wtf/text/WTFString.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 extern const int kSQLAuthAllow; 37 extern const int kSQLAuthAllow;
38 extern const int kSQLAuthDeny; 38 extern const int kSQLAuthDeny;
39 39
40 class DatabaseContext;
41
40 class DatabaseAuthorizer 42 class DatabaseAuthorizer
41 : public GarbageCollectedFinalized<DatabaseAuthorizer> { 43 : public GarbageCollectedFinalized<DatabaseAuthorizer> {
42 public: 44 public:
43 enum Permissions { 45 enum Permissions {
44 kReadWriteMask = 0, 46 kReadWriteMask = 0,
45 kReadOnlyMask = 1 << 1, 47 kReadOnlyMask = 1 << 1,
46 kNoAccessMask = 1 << 2 48 kNoAccessMask = 1 << 2
47 }; 49 };
48 50
49 static DatabaseAuthorizer* Create(const String& database_info_table_name); 51 static DatabaseAuthorizer* Create(DatabaseContext*,
50 DEFINE_INLINE_TRACE() {} 52 const String& database_info_table_name);
53 DECLARE_TRACE();
51 54
52 int CreateTable(const String& table_name); 55 int CreateTable(const String& table_name);
53 int CreateTempTable(const String& table_name); 56 int CreateTempTable(const String& table_name);
54 int DropTable(const String& table_name); 57 int DropTable(const String& table_name);
55 int DropTempTable(const String& table_name); 58 int DropTempTable(const String& table_name);
56 int AllowAlterTable(const String& database_name, const String& table_name); 59 int AllowAlterTable(const String& database_name, const String& table_name);
57 60
58 int CreateIndex(const String& index_name, const String& table_name); 61 int CreateIndex(const String& index_name, const String& table_name);
59 int CreateTempIndex(const String& index_name, const String& table_name); 62 int CreateTempIndex(const String& index_name, const String& table_name);
60 int DropIndex(const String& index_name, const String& table_name); 63 int DropIndex(const String& index_name, const String& table_name);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 void Reset(); 99 void Reset();
97 void ResetDeletes(); 100 void ResetDeletes();
98 101
99 bool LastActionWasInsert() const { return last_action_was_insert_; } 102 bool LastActionWasInsert() const { return last_action_was_insert_; }
100 bool LastActionChangedDatabase() const { 103 bool LastActionChangedDatabase() const {
101 return last_action_changed_database_; 104 return last_action_changed_database_;
102 } 105 }
103 bool HadDeletes() const { return had_deletes_; } 106 bool HadDeletes() const { return had_deletes_; }
104 107
105 private: 108 private:
106 explicit DatabaseAuthorizer(const String& database_info_table_name); 109 explicit DatabaseAuthorizer(DatabaseContext*,
110 const String& database_info_table_name);
107 void AddWhitelistedFunctions(); 111 void AddWhitelistedFunctions();
108 int DenyBasedOnTableName(const String&) const; 112 int DenyBasedOnTableName(const String&) const;
109 int UpdateDeletesBasedOnTableName(const String&); 113 int UpdateDeletesBasedOnTableName(const String&);
110 bool AllowWrite(); 114 bool AllowWrite();
111 115
112 int permissions_; 116 int permissions_;
113 bool security_enabled_ : 1; 117 bool security_enabled_ : 1;
114 bool last_action_was_insert_ : 1; 118 bool last_action_was_insert_ : 1;
115 bool last_action_changed_database_ : 1; 119 bool last_action_changed_database_ : 1;
116 bool had_deletes_ : 1; 120 bool had_deletes_ : 1;
117 121
118 const String database_info_table_name_; 122 const String database_info_table_name_;
123
124 Member<DatabaseContext> database_context_;
119 }; 125 };
120 126
121 } // namespace blink 127 } // namespace blink
122 128
123 #endif // DatabaseAuthorizer_h 129 #endif // DatabaseAuthorizer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698