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

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

Issue 7054073: Merge 87772 - 2011-05-31 Kinuko Yasuda <kinuko@chromium.org> (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/782/
Patch Set: Created 9 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
« no previous file with comments | « Source/WebKit/chromium/ChangeLog ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "WebStorageQuotaCallbacksImpl.h" 45 #include "WebStorageQuotaCallbacksImpl.h"
46 #include "WebStorageQuotaType.h" 46 #include "WebStorageQuotaType.h"
47 47
48 using namespace WebKit; 48 using namespace WebKit;
49 49
50 namespace WebCore { 50 namespace WebCore {
51 51
52 namespace { 52 namespace {
53 void fireStorageInfoErrorCallback(PassRefPtr<StorageInfoErrorCallback> errorCall back, ExceptionCode ec) 53 void fireStorageInfoErrorCallback(PassRefPtr<StorageInfoErrorCallback> errorCall back, ExceptionCode ec)
54 { 54 {
55 ASSERT(errorCallback); 55 if (!errorCallback)
56 return;
56 ExceptionCodeDescription description; 57 ExceptionCodeDescription description;
57 getExceptionCodeDescription(ec, description); 58 getExceptionCodeDescription(ec, description);
58 errorCallback->handleEvent(DOMCoreException::create(description).get()); 59 errorCallback->handleEvent(DOMCoreException::create(description).get());
59 } 60 }
60 } 61 }
61 62
62 void StorageInfo::queryUsageAndQuota(ScriptExecutionContext* context, int storag eType, PassRefPtr<StorageInfoUsageCallback> successCallback, PassRefPtr<StorageI nfoErrorCallback> errorCallback) 63 void StorageInfo::queryUsageAndQuota(ScriptExecutionContext* context, int storag eType, PassRefPtr<StorageInfoUsageCallback> successCallback, PassRefPtr<StorageI nfoErrorCallback> errorCallback)
63 { 64 {
64 ASSERT(context); 65 ASSERT(context);
65 if (storageType != WebStorageQuotaTypeTemporary && storageType != WebStorage QuotaTypePersistent) { 66 if (storageType != WebStorageQuotaTypeTemporary && storageType != WebStorage QuotaTypePersistent) {
66 // Unknown storage type is requested. 67 // Unknown storage type is requested.
67 fireStorageInfoErrorCallback(errorCallback, NOT_SUPPORTED_ERR); 68 fireStorageInfoErrorCallback(errorCallback, NOT_SUPPORTED_ERR);
68 return; 69 return;
69 } 70 }
70 if (context->isDocument()) { 71 if (context->isDocument()) {
71 Document* document = static_cast<Document*>(context); 72 Document* document = static_cast<Document*>(context);
72 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); 73 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame());
73 webFrame->client()->queryStorageUsageAndQuota(webFrame, static_cast<WebS torageQuotaType>(storageType), new WebStorageQuotaCallbacksImpl(successCallback, errorCallback)); 74 webFrame->client()->queryStorageUsageAndQuota(webFrame, static_cast<WebS torageQuotaType>(storageType), new WebStorageQuotaCallbacksImpl(successCallback, errorCallback));
74 } else if (errorCallback) { 75 } else {
75 // FIXME: calling this on worker is not yet supported. 76 // FIXME: calling this on worker is not yet supported.
76 fireStorageInfoErrorCallback(errorCallback, NOT_SUPPORTED_ERR); 77 fireStorageInfoErrorCallback(errorCallback, NOT_SUPPORTED_ERR);
77 } 78 }
78 } 79 }
79 80
80 void StorageInfo::requestQuota(ScriptExecutionContext* context, int storageType, unsigned long long newQuotaInBytes, PassRefPtr<StorageInfoQuotaCallback> succes sCallback, PassRefPtr<StorageInfoErrorCallback> errorCallback) 81 void StorageInfo::requestQuota(ScriptExecutionContext* context, int storageType, unsigned long long newQuotaInBytes, PassRefPtr<StorageInfoQuotaCallback> succes sCallback, PassRefPtr<StorageInfoErrorCallback> errorCallback)
81 { 82 {
82 ASSERT(context); 83 ASSERT(context);
83 if (storageType != WebStorageQuotaTypeTemporary && storageType != WebStorage QuotaTypePersistent) { 84 if (storageType != WebStorageQuotaTypeTemporary && storageType != WebStorage QuotaTypePersistent) {
84 // Unknown storage type is requested. 85 // Unknown storage type is requested.
85 fireStorageInfoErrorCallback(errorCallback, NOT_SUPPORTED_ERR); 86 fireStorageInfoErrorCallback(errorCallback, NOT_SUPPORTED_ERR);
86 return; 87 return;
87 } 88 }
88 if (context->isDocument()) { 89 if (context->isDocument()) {
89 Document* document = static_cast<Document*>(context); 90 Document* document = static_cast<Document*>(context);
90 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); 91 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame());
91 webFrame->client()->requestStorageQuota(webFrame, static_cast<WebStorage QuotaType>(storageType), newQuotaInBytes, new WebStorageQuotaCallbacksImpl(succe ssCallback, errorCallback)); 92 webFrame->client()->requestStorageQuota(webFrame, static_cast<WebStorage QuotaType>(storageType), newQuotaInBytes, new WebStorageQuotaCallbacksImpl(succe ssCallback, errorCallback));
92 } else if (errorCallback) { 93 } else {
93 // FIXME: calling this on worker is not yet supported. 94 // FIXME: calling this on worker is not yet supported.
94 fireStorageInfoErrorCallback(errorCallback, NOT_SUPPORTED_ERR); 95 fireStorageInfoErrorCallback(errorCallback, NOT_SUPPORTED_ERR);
95 } 96 }
96 } 97 }
97 98
98 } // namespace WebCore 99 } // namespace WebCore
99 100
100 #endif // ENABLE(QUOTA) 101 #endif // ENABLE(QUOTA)
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698