diff options
Diffstat (limited to 'WebKit/mac/Storage')
-rw-r--r-- | WebKit/mac/Storage/WebDatabaseManager.mm | 139 | ||||
-rw-r--r-- | WebKit/mac/Storage/WebDatabaseManagerInternal.h | 29 | ||||
-rw-r--r-- | WebKit/mac/Storage/WebDatabaseManagerPrivate.h | 64 | ||||
-rw-r--r-- | WebKit/mac/Storage/WebDatabaseTrackerClient.h | 40 | ||||
-rw-r--r-- | WebKit/mac/Storage/WebDatabaseTrackerClient.mm | 69 | ||||
-rw-r--r-- | WebKit/mac/Storage/WebSecurityOrigin.mm | 135 | ||||
-rw-r--r-- | WebKit/mac/Storage/WebSecurityOriginInternal.h | 42 | ||||
-rw-r--r-- | WebKit/mac/Storage/WebSecurityOriginPrivate.h | 52 |
8 files changed, 0 insertions, 570 deletions
diff --git a/WebKit/mac/Storage/WebDatabaseManager.mm b/WebKit/mac/Storage/WebDatabaseManager.mm deleted file mode 100644 index fa9eea6..0000000 --- a/WebKit/mac/Storage/WebDatabaseManager.mm +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "WebDatabaseManagerPrivate.h" -#import "WebDatabaseManagerInternal.h" - -#import "WebDatabaseTrackerClient.h" -#import "WebSecurityOriginInternal.h" - -#import <WebCore/DatabaseTracker.h> -#import <WebCore/SecurityOrigin.h> - -using namespace WebCore; - -NSString *WebDatabaseDirectoryDefaultsKey = @"WebDatabaseDirectory"; - -NSString *WebDatabaseDisplayNameKey = @"WebDatabaseDisplayNameKey"; -NSString *WebDatabaseExpectedSizeKey = @"WebDatabaseExpectedSizeKey"; -NSString *WebDatabaseUsageKey = @"WebDatabaseUsageKey"; - -NSString *WebDatabaseDidModifyOriginNotification = @"WebDatabaseDidModifyOriginNotification"; -NSString *WebDatabaseDidModifyDatabaseNotification = @"WebDatabaseDidModifyDatabaseNotification"; -NSString *WebDatabaseIdentifierKey = @"WebDatabaseIdentifierKey"; - -@implementation WebDatabaseManager - -+ (WebDatabaseManager *) sharedWebDatabaseManager -{ - static WebDatabaseManager *sharedManager = [[WebDatabaseManager alloc] init]; - return sharedManager; -} - -- (NSArray *)origins -{ - Vector<RefPtr<SecurityOrigin> > coreOrigins; - DatabaseTracker::tracker().origins(coreOrigins); - NSMutableArray *webOrigins = [[NSMutableArray alloc] initWithCapacity:coreOrigins.size()]; - - for (unsigned i = 0; i < coreOrigins.size(); ++i) { - WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:coreOrigins[i].get()]; - [webOrigins addObject:webOrigin]; - [webOrigin release]; - } - - return [webOrigins autorelease]; -} - -- (NSArray *)databasesWithOrigin:(WebSecurityOrigin *)origin -{ - Vector<String> nameVector; - if (!DatabaseTracker::tracker().databaseNamesForOrigin([origin _core], nameVector)) - return nil; - - NSMutableArray *names = [[NSMutableArray alloc] initWithCapacity:nameVector.size()]; - - for (unsigned i = 0; i < nameVector.size(); ++i) - [names addObject:(NSString *)nameVector[i]]; - - return [names autorelease]; -} - -- (NSDictionary *)detailsForDatabase:(NSString *)databaseIdentifier withOrigin:(WebSecurityOrigin *)origin -{ - static id keys[3] = {WebDatabaseDisplayNameKey, WebDatabaseExpectedSizeKey, WebDatabaseUsageKey}; - - DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(databaseIdentifier, [origin _core]); - if (details.name().isNull()) - return nil; - - id objects[3]; - objects[0] = details.displayName().isEmpty() ? databaseIdentifier : (NSString *)details.displayName(); - objects[1] = [NSNumber numberWithUnsignedLongLong:details.expectedUsage()]; - objects[2] = [NSNumber numberWithUnsignedLongLong:details.currentUsage()]; - - return [[[NSDictionary alloc] initWithObjects:objects forKeys:keys count:3] autorelease]; -} - -- (void)deleteAllDatabases -{ - DatabaseTracker::tracker().deleteAllDatabases(); -} - -- (void)deleteOrigin:(WebSecurityOrigin *)origin -{ - DatabaseTracker::tracker().deleteOrigin([origin _core]); -} - -- (void)deleteDatabase:(NSString *)databaseIdentifier withOrigin:(WebSecurityOrigin *)origin -{ - DatabaseTracker::tracker().deleteDatabase([origin _core], databaseIdentifier); -} - -@end - -void WebKitInitializeDatabasesIfNecessary() -{ - static BOOL initialized = NO; - if (initialized) - return; - - // Set the database root path in WebCore - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - - NSString *databasesDirectory = [defaults objectForKey:WebDatabaseDirectoryDefaultsKey]; - if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]]) - databasesDirectory = @"~/Library/WebKit/Databases"; - - DatabaseTracker::tracker().setDatabaseDirectoryPath([databasesDirectory stringByStandardizingPath]); - - // Set the DatabaseTrackerClient - DatabaseTracker::tracker().setClient(WebDatabaseTrackerClient::sharedWebDatabaseTrackerClient()); - - initialized = YES; -} diff --git a/WebKit/mac/Storage/WebDatabaseManagerInternal.h b/WebKit/mac/Storage/WebDatabaseManagerInternal.h deleted file mode 100644 index 2065a4e..0000000 --- a/WebKit/mac/Storage/WebDatabaseManagerInternal.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -void WebKitInitializeDatabasesIfNecessary(); diff --git a/WebKit/mac/Storage/WebDatabaseManagerPrivate.h b/WebKit/mac/Storage/WebDatabaseManagerPrivate.h deleted file mode 100644 index faa4e5d..0000000 --- a/WebKit/mac/Storage/WebDatabaseManagerPrivate.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -extern NSString *WebDatabaseDirectoryDefaultsKey; - -extern NSString *WebDatabaseDisplayNameKey; -extern NSString *WebDatabaseExpectedSizeKey; -extern NSString *WebDatabaseUsageKey; - -// Posted with an origin is created from scratch, gets a new database, has a database deleted, has a quota change, etc -// The notification object will be a WebSecurityOrigin object corresponding to the origin. -extern NSString *WebDatabaseDidModifyOriginNotification; - -// Posted when a database is created, its size increases, its display name changes, or its estimated size changes, or the database is removed -// The notification object will be a WebSecurityOrigin object corresponding to the origin. -// The notification userInfo will have a WebDatabaseNameKey whose value is the database name. -extern NSString *WebDatabaseDidModifyDatabaseNotification; -extern NSString *WebDatabaseIdentifierKey; - -@class WebSecurityOrigin; - -@interface WebDatabaseManager : NSObject - -+ (WebDatabaseManager *)sharedWebDatabaseManager; - -// Will return an array of WebSecurityOrigin objects. -- (NSArray *)origins; - -// Will return an array of strings, the identifiers of each database in the given origin. -- (NSArray *)databasesWithOrigin:(WebSecurityOrigin *)origin; - -// Will return the dictionary describing everything about the database for the passed identifier and origin. -- (NSDictionary *)detailsForDatabase:(NSString *)databaseIdentifier withOrigin:(WebSecurityOrigin *)origin; - -- (void)deleteAllDatabases; // Deletes all databases and all origins. -- (void)deleteOrigin:(WebSecurityOrigin *)origin; -- (void)deleteDatabase:(NSString *)databaseIdentifier withOrigin:(WebSecurityOrigin *)origin; - -@end diff --git a/WebKit/mac/Storage/WebDatabaseTrackerClient.h b/WebKit/mac/Storage/WebDatabaseTrackerClient.h deleted file mode 100644 index 5db444c..0000000 --- a/WebKit/mac/Storage/WebDatabaseTrackerClient.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import <WebCore/DatabaseTrackerClient.h> - -class WebDatabaseTrackerClient : public WebCore::DatabaseTrackerClient { -public: - static WebDatabaseTrackerClient* sharedWebDatabaseTrackerClient(); - - virtual ~WebDatabaseTrackerClient(); - virtual void dispatchDidModifyOrigin(WebCore::SecurityOrigin*); - virtual void dispatchDidModifyDatabase(WebCore::SecurityOrigin*, const WebCore::String& databaseIdentifier); -private: - WebDatabaseTrackerClient(); -}; diff --git a/WebKit/mac/Storage/WebDatabaseTrackerClient.mm b/WebKit/mac/Storage/WebDatabaseTrackerClient.mm deleted file mode 100644 index 48530d6..0000000 --- a/WebKit/mac/Storage/WebDatabaseTrackerClient.mm +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "WebDatabaseTrackerClient.h" - -#import "WebDatabaseManagerPrivate.h" -#import "WebSecurityOriginInternal.h" -#import <wtf/RetainPtr.h> -#import <WebCore/SecurityOrigin.h> - -using namespace WebCore; - -WebDatabaseTrackerClient* WebDatabaseTrackerClient::sharedWebDatabaseTrackerClient() -{ - static WebDatabaseTrackerClient* sharedClient = new WebDatabaseTrackerClient(); - return sharedClient; -} - -WebDatabaseTrackerClient::WebDatabaseTrackerClient() -{ -} - -WebDatabaseTrackerClient::~WebDatabaseTrackerClient() -{ -} - -void WebDatabaseTrackerClient::dispatchDidModifyOrigin(SecurityOrigin* origin) -{ - RetainPtr<WebSecurityOrigin> webSecurityOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]); - - [[NSNotificationCenter defaultCenter] postNotificationName:WebDatabaseDidModifyOriginNotification - object:webSecurityOrigin.get()]; -} - -void WebDatabaseTrackerClient::dispatchDidModifyDatabase(SecurityOrigin* origin, const String& databaseIdentifier) -{ - RetainPtr<WebSecurityOrigin> webSecurityOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]); - RetainPtr<NSDictionary> userInfo(AdoptNS, [[NSDictionary alloc] - initWithObjectsAndKeys:(NSString *)databaseIdentifier, WebDatabaseIdentifierKey, nil]); - - [[NSNotificationCenter defaultCenter] postNotificationName:WebDatabaseDidModifyDatabaseNotification - object:webSecurityOrigin.get() - userInfo:userInfo.get()]; -} diff --git a/WebKit/mac/Storage/WebSecurityOrigin.mm b/WebKit/mac/Storage/WebSecurityOrigin.mm deleted file mode 100644 index 85313d0..0000000 --- a/WebKit/mac/Storage/WebSecurityOrigin.mm +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "WebSecurityOriginInternal.h" - -#import <WebCore/DatabaseTracker.h> -#import <WebCore/KURL.h> -#import <WebCore/SecurityOrigin.h> - -using namespace WebCore; - -@implementation WebSecurityOrigin -- (id)initWithURL:(NSURL *)url -{ - self = [super init]; - if (!self) - return nil; - - RefPtr<SecurityOrigin> origin = SecurityOrigin::create(KURL([url absoluteURL])); - origin->ref(); - _private = reinterpret_cast<WebSecurityOriginPrivate*>(origin.get()); - - return self; -} - -- (NSString*)protocol -{ - return reinterpret_cast<SecurityOrigin*>(_private)->protocol(); -} - -- (NSString*)host -{ - return reinterpret_cast<SecurityOrigin*>(_private)->host(); -} - -// Deprecated. Use host instead. This needs to stay here until we ship a new Safari. -- (NSString*)domain -{ - return [self host]; -} - -- (unsigned short)port -{ - return reinterpret_cast<SecurityOrigin*>(_private)->port(); -} - -- (unsigned long long)usage -{ - return DatabaseTracker::tracker().usageForOrigin(reinterpret_cast<SecurityOrigin*>(_private)); -} - -- (unsigned long long)quota -{ - return DatabaseTracker::tracker().quotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private)); -} - -// Sets the storage quota (in bytes) -// If the quota is set to a value lower than the current usage, that quota will "stick" but no data will be purged to meet the new quota. -// This will simply prevent new data from being added to databases in that origin -- (void)setQuota:(unsigned long long)quota -{ - DatabaseTracker::tracker().setQuota(reinterpret_cast<SecurityOrigin*>(_private), quota); -} - -- (BOOL)isEqual:(id)anObject -{ - if (![anObject isMemberOfClass:[WebSecurityOrigin class]]) { - return NO; - } - - return [self _core]->equal([anObject _core]); -} - -- (void)dealloc -{ - if (_private) - reinterpret_cast<SecurityOrigin*>(_private)->deref(); - [super dealloc]; -} - -- (void)finalize -{ - if (_private) - reinterpret_cast<SecurityOrigin*>(_private)->deref(); - [super finalize]; -} - -@end - -@implementation WebSecurityOrigin (WebInternal) - -- (id)_initWithWebCoreSecurityOrigin:(SecurityOrigin*)origin -{ - ASSERT(origin); - self = [super init]; - if (!self) - return nil; - - origin->ref(); - _private = reinterpret_cast<WebSecurityOriginPrivate*>(origin); - - return self; -} - -- (SecurityOrigin *)_core -{ - return reinterpret_cast<SecurityOrigin*>(_private); -} - -@end diff --git a/WebKit/mac/Storage/WebSecurityOriginInternal.h b/WebKit/mac/Storage/WebSecurityOriginInternal.h deleted file mode 100644 index 7bd6817..0000000 --- a/WebKit/mac/Storage/WebSecurityOriginInternal.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "WebSecurityOriginPrivate.h" - -namespace WebCore { - class SecurityOrigin; -} - -typedef WebCore::SecurityOrigin WebCoreSecurityOrigin; - -@interface WebSecurityOrigin (WebInternal) - -- (id)_initWithWebCoreSecurityOrigin:(WebCoreSecurityOrigin *)origin; -- (WebCoreSecurityOrigin *)_core; - -@end diff --git a/WebKit/mac/Storage/WebSecurityOriginPrivate.h b/WebKit/mac/Storage/WebSecurityOriginPrivate.h deleted file mode 100644 index 0796c6e..0000000 --- a/WebKit/mac/Storage/WebSecurityOriginPrivate.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -@class WebSecurityOriginPrivate; - -@interface WebSecurityOrigin : NSObject { - WebSecurityOriginPrivate *_private; -} - -- (id)initWithURL:(NSURL *)url; - -- (NSString*)protocol; -- (NSString*)host; - -// Returns zero if the port is the default port for the protocol, non-zero otherwise -- (unsigned short)port; - -// Returns the current total usage of all databases in this security origin in bytes -- (unsigned long long)usage; - -- (unsigned long long)quota; -// Sets the storage quota (in bytes) -// If the quota is set to a value lower than the current usage, that quota will "stick" but no data will be purged to meet the new quota. -// This will simply prevent new data from being added to databases in that origin -- (void)setQuota:(unsigned long long)quota; - -@end |