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

Side by Side Diff: Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp

Issue 13843016: Prepare to remove WebSecurityOrigin from IDB backend (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove unused static Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 180 }
181 allowed = bridge->result(); 181 allowed = bridge->result();
182 } 182 }
183 183
184 if (!allowed) 184 if (!allowed)
185 callbacks->onError(WebIDBDatabaseError(IDBDatabaseException::UnknownErro r, "The user denied permission to access the database.")); 185 callbacks->onError(WebIDBDatabaseError(IDBDatabaseException::UnknownErro r, "The user denied permission to access the database."));
186 186
187 return allowed; 187 return allowed;
188 } 188 }
189 189
190 static WebFrameImpl* getWebFrame(ScriptExecutionContext* context) 190 void IDBFactoryBackendProxy::getDatabaseNames(PassRefPtr<IDBCallbacks> prpCallba cks, const String& databaseIdentifier, ScriptExecutionContext* context, const St ring& dataDir)
191 {
192 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument() || context->isWorkerC ontext());
193 if (context->isDocument()) {
194 Document* document = static_cast<Document*>(context);
195 return WebFrameImpl::fromFrame(document->frame());
196 }
197 return 0;
198 }
199
200 void IDBFactoryBackendProxy::getDatabaseNames(PassRefPtr<IDBCallbacks> prpCallba cks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext* context, const String& dataDir)
201 { 191 {
202 RefPtr<IDBCallbacks> callbacks(prpCallbacks); 192 RefPtr<IDBCallbacks> callbacks(prpCallbacks);
203 WebSecurityOrigin origin(securityOrigin); 193 WebSecurityOrigin origin(context->securityOrigin());
204 if (!allowIndexedDB(context, "Database Listing", origin, callbacks)) 194 if (!allowIndexedDB(context, "Database Listing", origin, callbacks))
205 return; 195 return;
206 196
207 WebFrameImpl* webFrame = getWebFrame(context); 197 m_webIDBFactory->getDatabaseNames(new WebIDBCallbacksImpl(callbacks), databa seIdentifier, dataDir);
208 m_webIDBFactory->getDatabaseNames(new WebIDBCallbacksImpl(callbacks), origin , webFrame, dataDir);
209 } 198 }
210 199
211 void IDBFactoryBackendProxy::open(const String& name, int64_t version, int64_t t ransactionId, PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<IDBDatabaseCallb acks> prpDatabaseCallbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExe cutionContext* context, const String& dataDir) 200 void IDBFactoryBackendProxy::open(const String& name, int64_t version, int64_t t ransactionId, PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<IDBDatabaseCallb acks> prpDatabaseCallbacks, const String& databaseIdentifier, ScriptExecutionCon text* context, const String& dataDir)
212 { 201 {
213 RefPtr<IDBCallbacks> callbacks(prpCallbacks); 202 RefPtr<IDBCallbacks> callbacks(prpCallbacks);
214 RefPtr<IDBDatabaseCallbacks> databaseCallbacks(prpDatabaseCallbacks); 203 RefPtr<IDBDatabaseCallbacks> databaseCallbacks(prpDatabaseCallbacks);
215 WebSecurityOrigin origin(securityOrigin); 204 WebSecurityOrigin origin(context->securityOrigin());
216 if (!allowIndexedDB(context, name, origin, callbacks)) 205 if (!allowIndexedDB(context, name, origin, callbacks))
217 return; 206 return;
218 207
219 WebFrameImpl* webFrame = getWebFrame(context); 208 m_webIDBFactory->open(name, version, transactionId, new WebIDBCallbacksImpl( callbacks), new WebIDBDatabaseCallbacksImpl(databaseCallbacks), databaseIdentifi er, dataDir);
220 m_webIDBFactory->open(name, version, transactionId, new WebIDBCallbacksImpl( callbacks), new WebIDBDatabaseCallbacksImpl(databaseCallbacks), origin, webFrame , dataDir);
221 } 209 }
222 210
223 void IDBFactoryBackendProxy::deleteDatabase(const String& name, PassRefPtr<IDBCa llbacks> prpCallbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutio nContext* context, const String& dataDir) 211 void IDBFactoryBackendProxy::deleteDatabase(const String& name, PassRefPtr<IDBCa llbacks> prpCallbacks, const String& databaseIdentifier, ScriptExecutionContext* context, const String& dataDir)
224 { 212 {
225 RefPtr<IDBCallbacks> callbacks(prpCallbacks); 213 RefPtr<IDBCallbacks> callbacks(prpCallbacks);
226 WebSecurityOrigin origin(securityOrigin); 214 WebSecurityOrigin origin(context->securityOrigin());
227 if (!allowIndexedDB(context, name, origin, callbacks)) 215 if (!allowIndexedDB(context, name, origin, callbacks))
228 return; 216 return;
229 217
230 WebFrameImpl* webFrame = getWebFrame(context); 218 m_webIDBFactory->deleteDatabase(name, new WebIDBCallbacksImpl(callbacks), da tabaseIdentifier, dataDir);
231 m_webIDBFactory->deleteDatabase(name, new WebIDBCallbacksImpl(callbacks), or igin, webFrame, dataDir);
232 } 219 }
233 220
234 } // namespace WebKit 221 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/IDBFactoryBackendProxy.h ('k') | Source/WebKit/chromium/src/WebIDBFactoryImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698