18e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/* 2643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * Copyright (C) 2009 Google Inc. All Rights Reserved. 38e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 48e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Redistribution and use in source and binary forms, with or without 58e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * modification, are permitted provided that the following conditions 68e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * are met: 78e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 1. Redistributions of source code must retain the above copyright 88e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * notice, this list of conditions and the following disclaimer. 98e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 2. Redistributions in binary form must reproduce the above copyright 108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * notice, this list of conditions and the following disclaimer in the 118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * documentation and/or other materials provided with the distribution. 128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 13643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY 148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. OR 178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 26643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#ifndef StorageAreaProxy_h 27643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#define StorageAreaProxy_h 288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 29643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#if ENABLE(DOM_STORAGE) 308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 31643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#include "StorageArea.h" 32231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 33643ca7872b450ea4efacab6188849e5aac2ba161Steve Blocknamespace WebKit { class WebStorageArea; } 34231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 35231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blocknamespace WebCore { 36231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 37d0825bca7fe65beaee391d30da42e937db621564Steve Blockclass Frame; 38d0825bca7fe65beaee391d30da42e937db621564Steve Blockclass SecurityOrigin; 39d0825bca7fe65beaee391d30da42e937db621564Steve Block 40643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass StorageAreaProxy : public StorageArea { 41643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockpublic: 42d0825bca7fe65beaee391d30da42e937db621564Steve Block StorageAreaProxy(WebKit::WebStorageArea*, StorageType); 43643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual ~StorageAreaProxy(); 44643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 45643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // The HTML5 DOM Storage API 46643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual unsigned length() const; 47643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual String key(unsigned index) const; 48643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual String getItem(const String& key) const; 49d0825bca7fe65beaee391d30da42e937db621564Steve Block virtual String setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame); 50d0825bca7fe65beaee391d30da42e937db621564Steve Block virtual String removeItem(const String& key, Frame* sourceFrame); 51d0825bca7fe65beaee391d30da42e937db621564Steve Block virtual bool clear(Frame* sourceFrame); 52643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual bool contains(const String& key) const; 53231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 54643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockprivate: 55d0825bca7fe65beaee391d30da42e937db621564Steve Block void storageEvent(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Frame* sourceFrame); 56d0825bca7fe65beaee391d30da42e937db621564Steve Block 57643ca7872b450ea4efacab6188849e5aac2ba161Steve Block OwnPtr<WebKit::WebStorageArea> m_storageArea; 58d0825bca7fe65beaee391d30da42e937db621564Steve Block StorageType m_storageType; 59643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}; 60231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 61231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} // namespace WebCore 62231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 63643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#endif // ENABLE(DOM_STORAGE) 64643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 65643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#endif // StorageAreaProxy_h 66