| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "public/platform/WebStorageQuotaType.h" | 43 #include "public/platform/WebStorageQuotaType.h" |
| 44 | 44 |
| 45 namespace WebCore { | 45 namespace WebCore { |
| 46 | 46 |
| 47 StorageQuota::StorageQuota(Type type) | 47 StorageQuota::StorageQuota(Type type) |
| 48 : m_type(type) | 48 : m_type(type) |
| 49 { | 49 { |
| 50 ScriptWrappable::init(this); | 50 ScriptWrappable::init(this); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void StorageQuota::queryUsageAndQuota(ExecutionContext* executionContext, PassRe
fPtr<StorageUsageCallback> successCallback, PassRefPtr<StorageErrorCallback> err
orCallback) | 53 void StorageQuota::queryUsageAndQuota(ExecutionContext* executionContext, PassOw
nPtr<StorageUsageCallback> successCallback, PassOwnPtr<StorageErrorCallback> err
orCallback) |
| 54 { | 54 { |
| 55 ASSERT(executionContext); | 55 ASSERT(executionContext); |
| 56 | 56 |
| 57 blink::WebStorageQuotaType storageType = static_cast<blink::WebStorageQuotaT
ype>(m_type); | 57 blink::WebStorageQuotaType storageType = static_cast<blink::WebStorageQuotaT
ype>(m_type); |
| 58 if (storageType != blink::WebStorageQuotaTypeTemporary && storageType != bli
nk::WebStorageQuotaTypePersistent) { | 58 if (storageType != blink::WebStorageQuotaTypeTemporary && storageType != bli
nk::WebStorageQuotaTypePersistent) { |
| 59 // Unknown storage type is requested. | 59 // Unknown storage type is requested. |
| 60 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); | 60 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); |
| 61 return; | 61 return; |
| 62 } | 62 } |
| 63 | 63 |
| 64 SecurityOrigin* securityOrigin = executionContext->securityOrigin(); | 64 SecurityOrigin* securityOrigin = executionContext->securityOrigin(); |
| 65 if (securityOrigin->isUnique()) { | 65 if (securityOrigin->isUnique()) { |
| 66 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); | 66 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); |
| 67 return; | 67 return; |
| 68 } | 68 } |
| 69 | 69 |
| 70 KURL storagePartition = KURL(KURL(), securityOrigin->toString()); | 70 KURL storagePartition = KURL(KURL(), securityOrigin->toString()); |
| 71 blink::Platform::current()->queryStorageUsageAndQuota(storagePartition, stor
ageType, WebStorageQuotaCallbacksImpl::createLeakedPtr(successCallback, errorCal
lback)); | 71 blink::Platform::current()->queryStorageUsageAndQuota(storagePartition, stor
ageType, WebStorageQuotaCallbacksImpl::createLeakedPtr(successCallback, errorCal
lback)); |
| 72 } | 72 } |
| 73 | 73 |
| 74 StorageQuota::~StorageQuota() | 74 StorageQuota::~StorageQuota() |
| 75 { | 75 { |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace WebCore | 78 } // namespace WebCore |
| OLD | NEW |