OLD | NEW |
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 DeprecatedStorageQuota::DeprecatedStorageQuota(Type type) | 49 DeprecatedStorageQuota::DeprecatedStorageQuota(Type type) |
50 : m_type(type) | 50 : m_type(type) |
51 { | 51 { |
52 ScriptWrappable::init(this); | 52 ScriptWrappable::init(this); |
53 } | 53 } |
54 | 54 |
55 void DeprecatedStorageQuota::queryUsageAndQuota(ExecutionContext* executionConte
xt, PassOwnPtr<StorageUsageCallback> successCallback, PassOwnPtr<StorageErrorCal
lback> errorCallback) | 55 void DeprecatedStorageQuota::queryUsageAndQuota(ExecutionContext* executionConte
xt, PassOwnPtr<StorageUsageCallback> successCallback, PassOwnPtr<StorageErrorCal
lback> errorCallback) |
56 { | 56 { |
57 ASSERT(executionContext); | 57 ASSERT(executionContext); |
58 | 58 |
59 blink::WebStorageQuotaType storageType = static_cast<blink::WebStorageQuotaT
ype>(m_type); | 59 WebStorageQuotaType storageType = static_cast<WebStorageQuotaType>(m_type); |
60 if (storageType != blink::WebStorageQuotaTypeTemporary && storageType != bli
nk::WebStorageQuotaTypePersistent) { | 60 if (storageType != WebStorageQuotaTypeTemporary && storageType != WebStorage
QuotaTypePersistent) { |
61 // Unknown storage type is requested. | 61 // Unknown storage type is requested. |
62 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); | 62 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); |
63 return; | 63 return; |
64 } | 64 } |
65 | 65 |
66 SecurityOrigin* securityOrigin = executionContext->securityOrigin(); | 66 SecurityOrigin* securityOrigin = executionContext->securityOrigin(); |
67 if (securityOrigin->isUnique()) { | 67 if (securityOrigin->isUnique()) { |
68 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); | 68 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); |
69 return; | 69 return; |
70 } | 70 } |
71 | 71 |
72 KURL storagePartition = KURL(KURL(), securityOrigin->toString()); | 72 KURL storagePartition = KURL(KURL(), securityOrigin->toString()); |
73 OwnPtr<StorageQuotaCallbacks> callbacks = DeprecatedStorageQuotaCallbacksImp
l::create(successCallback, errorCallback); | 73 OwnPtr<StorageQuotaCallbacks> callbacks = DeprecatedStorageQuotaCallbacksImp
l::create(successCallback, errorCallback); |
74 blink::Platform::current()->queryStorageUsageAndQuota(storagePartition, stor
ageType, callbacks.release()); | 74 Platform::current()->queryStorageUsageAndQuota(storagePartition, storageType
, callbacks.release()); |
75 } | 75 } |
76 | 76 |
77 void DeprecatedStorageQuota::requestQuota(ExecutionContext* executionContext, un
signed long long newQuotaInBytes, PassOwnPtr<StorageQuotaCallback> successCallba
ck, PassOwnPtr<StorageErrorCallback> errorCallback) | 77 void DeprecatedStorageQuota::requestQuota(ExecutionContext* executionContext, un
signed long long newQuotaInBytes, PassOwnPtr<StorageQuotaCallback> successCallba
ck, PassOwnPtr<StorageErrorCallback> errorCallback) |
78 { | 78 { |
79 ASSERT(executionContext); | 79 ASSERT(executionContext); |
80 | 80 |
81 blink::WebStorageQuotaType storageType = static_cast<blink::WebStorageQuotaT
ype>(m_type); | 81 WebStorageQuotaType storageType = static_cast<WebStorageQuotaType>(m_type); |
82 if (storageType != blink::WebStorageQuotaTypeTemporary && storageType != bli
nk::WebStorageQuotaTypePersistent) { | 82 if (storageType != WebStorageQuotaTypeTemporary && storageType != WebStorage
QuotaTypePersistent) { |
83 // Unknown storage type is requested. | 83 // Unknown storage type is requested. |
84 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); | 84 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); |
85 return; | 85 return; |
86 } | 86 } |
87 | 87 |
88 StorageQuotaClient* client = StorageQuotaClient::from(executionContext); | 88 StorageQuotaClient* client = StorageQuotaClient::from(executionContext); |
89 if (!client) { | 89 if (!client) { |
90 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); | 90 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); |
91 return; | 91 return; |
92 } | 92 } |
93 | 93 |
94 client->requestQuota(executionContext, storageType, newQuotaInBytes, success
Callback, errorCallback); | 94 client->requestQuota(executionContext, storageType, newQuotaInBytes, success
Callback, errorCallback); |
95 } | 95 } |
96 | 96 |
97 } // namespace blink | 97 } // namespace blink |
OLD | NEW |