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

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

Issue 17885002: Use toDocument instead of static_cast<Document*>. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 AllowIDBParams* allowIDBParams = static_cast<AllowIDBParams*>(params); 107 AllowIDBParams* allowIDBParams = static_cast<AllowIDBParams*>(params);
108 return commonClient->allowIndexedDB(allowIDBParams->m_name); 108 return commonClient->allowIndexedDB(allowIDBParams->m_name);
109 } 109 }
110 }; 110 };
111 111
112 bool IDBFactoryBackendProxy::allowIndexedDB(ScriptExecutionContext* context, con st String& name, const WebSecurityOrigin& origin, PassRefPtr<IDBCallbacks> callb acks) 112 bool IDBFactoryBackendProxy::allowIndexedDB(ScriptExecutionContext* context, con st String& name, const WebSecurityOrigin& origin, PassRefPtr<IDBCallbacks> callb acks)
113 { 113 {
114 bool allowed; 114 bool allowed;
115 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument() || context->isWorkerG lobalScope()); 115 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument() || context->isWorkerG lobalScope());
116 if (context->isDocument()) { 116 if (context->isDocument()) {
117 Document* document = static_cast<Document*>(context); 117 Document* document = toDocument(context);
118 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); 118 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame());
119 WebViewImpl* webView = webFrame->viewImpl(); 119 WebViewImpl* webView = webFrame->viewImpl();
120 // FIXME: webView->permissionClient() returns 0 in test_shell and conten t_shell http://crbug.com/137269 120 // FIXME: webView->permissionClient() returns 0 in test_shell and conten t_shell http://crbug.com/137269
121 allowed = !webView->permissionClient() || webView->permissionClient()->a llowIndexedDB(webFrame, name, origin); 121 allowed = !webView->permissionClient() || webView->permissionClient()->a llowIndexedDB(webFrame, name, origin);
122 } else { 122 } else {
123 WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(c ontext); 123 WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(c ontext);
124 WebWorkerBase* webWorkerBase = static_cast<WebWorkerBase*>(workerGlobalS cope->thread()->workerLoaderProxy().toWebWorkerBase()); 124 WebWorkerBase* webWorkerBase = static_cast<WebWorkerBase*>(workerGlobalS cope->thread()->workerLoaderProxy().toWebWorkerBase());
125 WorkerRunLoop& runLoop = workerGlobalScope->thread()->runLoop(); 125 WorkerRunLoop& runLoop = workerGlobalScope->thread()->runLoop();
126 126
127 String mode = allowIndexedDBMode; 127 String mode = allowIndexedDBMode;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 { 167 {
168 RefPtr<IDBCallbacks> callbacks(prpCallbacks); 168 RefPtr<IDBCallbacks> callbacks(prpCallbacks);
169 WebSecurityOrigin origin(context->securityOrigin()); 169 WebSecurityOrigin origin(context->securityOrigin());
170 if (!allowIndexedDB(context, name, origin, callbacks)) 170 if (!allowIndexedDB(context, name, origin, callbacks))
171 return; 171 return;
172 172
173 m_webIDBFactory->deleteDatabase(name, new WebIDBCallbacksImpl(callbacks), da tabaseIdentifier); 173 m_webIDBFactory->deleteDatabase(name, new WebIDBCallbacksImpl(callbacks), da tabaseIdentifier);
174 } 174 }
175 175
176 } // namespace WebKit 176 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/DatabaseObserver.cpp ('k') | Source/WebKit/chromium/src/LocalFileSystemChromium.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698