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

Side by Side Diff: Source/WebKit/chromium/src/StorageQuotaChromium.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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 void StorageQuota::queryUsageAndQuota(ScriptExecutionContext* scriptExecutionCon text, PassRefPtr<StorageUsageCallback> successCallback, PassRefPtr<StorageErrorC allback> errorCallback) 68 void StorageQuota::queryUsageAndQuota(ScriptExecutionContext* scriptExecutionCon text, PassRefPtr<StorageUsageCallback> successCallback, PassRefPtr<StorageErrorC allback> errorCallback)
69 { 69 {
70 ASSERT(scriptExecutionContext); 70 ASSERT(scriptExecutionContext);
71 WebStorageQuotaType storageType = static_cast<WebStorageQuotaType>(m_type); 71 WebStorageQuotaType storageType = static_cast<WebStorageQuotaType>(m_type);
72 if (storageType != WebStorageQuotaTypeTemporary && storageType != WebStorage QuotaTypePersistent) { 72 if (storageType != WebStorageQuotaTypeTemporary && storageType != WebStorage QuotaTypePersistent) {
73 // Unknown storage type is requested. 73 // Unknown storage type is requested.
74 scriptExecutionContext->postTask(StorageErrorCallback::CallbackTask::cre ate(errorCallback, NOT_SUPPORTED_ERR)); 74 scriptExecutionContext->postTask(StorageErrorCallback::CallbackTask::cre ate(errorCallback, NOT_SUPPORTED_ERR));
75 return; 75 return;
76 } 76 }
77 if (scriptExecutionContext->isDocument()) { 77 if (scriptExecutionContext->isDocument()) {
78 Document* document = static_cast<Document*>(scriptExecutionContext); 78 Document* document = toDocument(scriptExecutionContext);
79 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); 79 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame());
80 webFrame->client()->queryStorageUsageAndQuota(webFrame, storageType, new WebStorageQuotaCallbacksImpl(successCallback, errorCallback)); 80 webFrame->client()->queryStorageUsageAndQuota(webFrame, storageType, new WebStorageQuotaCallbacksImpl(successCallback, errorCallback));
81 } else { 81 } else {
82 WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(s criptExecutionContext); 82 WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(s criptExecutionContext);
83 WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerGlobalScope ->thread()->workerLoaderProxy().toWebWorkerBase()); 83 WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerGlobalScope ->thread()->workerLoaderProxy().toWebWorkerBase());
84 queryUsageAndQuotaFromWorker(webWorker->commonClient(), storageType, new WebStorageQuotaCallbacksImpl(successCallback, errorCallback)); 84 queryUsageAndQuotaFromWorker(webWorker->commonClient(), storageType, new WebStorageQuotaCallbacksImpl(successCallback, errorCallback));
85 } 85 }
86 } 86 }
87 87
88 void StorageQuota::requestQuota(ScriptExecutionContext* scriptExecutionContext, unsigned long long newQuotaInBytes, PassRefPtr<StorageQuotaCallback> successCall back, PassRefPtr<StorageErrorCallback> errorCallback) 88 void StorageQuota::requestQuota(ScriptExecutionContext* scriptExecutionContext, unsigned long long newQuotaInBytes, PassRefPtr<StorageQuotaCallback> successCall back, PassRefPtr<StorageErrorCallback> errorCallback)
89 { 89 {
90 ASSERT(scriptExecutionContext); 90 ASSERT(scriptExecutionContext);
91 WebStorageQuotaType storageType = static_cast<WebStorageQuotaType>(m_type); 91 WebStorageQuotaType storageType = static_cast<WebStorageQuotaType>(m_type);
92 if (storageType != WebStorageQuotaTypeTemporary && storageType != WebStorage QuotaTypePersistent) { 92 if (storageType != WebStorageQuotaTypeTemporary && storageType != WebStorage QuotaTypePersistent) {
93 // Unknown storage type is requested. 93 // Unknown storage type is requested.
94 scriptExecutionContext->postTask(StorageErrorCallback::CallbackTask::cre ate(errorCallback, NOT_SUPPORTED_ERR)); 94 scriptExecutionContext->postTask(StorageErrorCallback::CallbackTask::cre ate(errorCallback, NOT_SUPPORTED_ERR));
95 return; 95 return;
96 } 96 }
97 if (scriptExecutionContext->isDocument()) { 97 if (scriptExecutionContext->isDocument()) {
98 Document* document = static_cast<Document*>(scriptExecutionContext); 98 Document* document = toDocument(scriptExecutionContext);
99 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); 99 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame());
100 webFrame->client()->requestStorageQuota(webFrame, storageType, newQuotaI nBytes, new WebStorageQuotaCallbacksImpl(successCallback, errorCallback)); 100 webFrame->client()->requestStorageQuota(webFrame, storageType, newQuotaI nBytes, new WebStorageQuotaCallbacksImpl(successCallback, errorCallback));
101 } else { 101 } else {
102 // Requesting quota in Worker is not supported. 102 // Requesting quota in Worker is not supported.
103 scriptExecutionContext->postTask(StorageErrorCallback::CallbackTask::cre ate(errorCallback, NOT_SUPPORTED_ERR)); 103 scriptExecutionContext->postTask(StorageErrorCallback::CallbackTask::cre ate(errorCallback, NOT_SUPPORTED_ERR));
104 } 104 }
105 } 105 }
106 106
107 } // namespace WebCore 107 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/SharedWorkerRepository.cpp ('k') | Source/WebKit/chromium/src/WebDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698