diff options
Diffstat (limited to 'WebKit/mac/WebCoreSupport')
-rw-r--r-- | WebKit/mac/WebCoreSupport/WebApplicationCache.h | 10 | ||||
-rw-r--r-- | WebKit/mac/WebCoreSupport/WebApplicationCache.mm | 17 | ||||
-rw-r--r-- | WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.h | 29 | ||||
-rw-r--r-- | WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.mm | 65 | ||||
-rw-r--r-- | WebKit/mac/WebCoreSupport/WebChromeClient.h | 7 | ||||
-rw-r--r-- | WebKit/mac/WebCoreSupport/WebChromeClient.mm | 36 | ||||
-rw-r--r-- | WebKit/mac/WebCoreSupport/WebPlatformStrategies.h | 8 | ||||
-rw-r--r-- | WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm | 17 | ||||
-rw-r--r-- | WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm | 149 | ||||
-rw-r--r-- | WebKit/mac/WebCoreSupport/WebSecurityOriginInternal.h | 42 | ||||
-rw-r--r-- | WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h | 55 |
11 files changed, 427 insertions, 8 deletions
diff --git a/WebKit/mac/WebCoreSupport/WebApplicationCache.h b/WebKit/mac/WebCoreSupport/WebApplicationCache.h index 282157f..78b06b7 100644 --- a/WebKit/mac/WebCoreSupport/WebApplicationCache.h +++ b/WebKit/mac/WebCoreSupport/WebApplicationCache.h @@ -25,8 +25,12 @@ #import <Foundation/Foundation.h> -@interface WebApplicationCache: NSObject { -} +@interface WebApplicationCache: NSObject + ++ (long long)maximumSize; ++ (void)setMaximumSize:(long long)size; + ++ (long long)defaultOriginQuota; ++ (void)setDefaultOriginQuota:(long long)size; -+ (void)setMaximumSize:(unsigned long long)size; @end diff --git a/WebKit/mac/WebCoreSupport/WebApplicationCache.mm b/WebKit/mac/WebCoreSupport/WebApplicationCache.mm index 4ca749c..5c2a208 100644 --- a/WebKit/mac/WebCoreSupport/WebApplicationCache.mm +++ b/WebKit/mac/WebCoreSupport/WebApplicationCache.mm @@ -32,13 +32,28 @@ using namespace WebCore; @implementation WebApplicationCache -+ (void)setMaximumSize:(unsigned long long)size ++ (long long)maximumSize +{ + return cacheStorage().maximumSize(); +} + ++ (void)setMaximumSize:(long long)size { cacheStorage().empty(); cacheStorage().vacuumDatabaseFile(); cacheStorage().setMaximumSize(size); } ++ (long long)defaultOriginQuota +{ + return cacheStorage().defaultOriginQuota(); +} + ++ (void)setDefaultOriginQuota:(long long)size +{ + cacheStorage().setDefaultOriginQuota(size); +} + @end #endif diff --git a/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.h b/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.h new file mode 100644 index 0000000..09c0610 --- /dev/null +++ b/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2010 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 INC. 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" + +@interface WebApplicationCacheSecurityOrigin : WebSecurityOrigin +@end diff --git a/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.mm b/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.mm new file mode 100644 index 0000000..dac41ae --- /dev/null +++ b/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.mm @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 INC. 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 "WebApplicationCacheSecurityOrigin.h" + +#import <WebCore/ApplicationCacheStorage.h> + +using namespace WebCore; + +@implementation WebApplicationCacheSecurityOrigin + +- (unsigned long long)usage +{ +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + long long usage; + if (cacheStorage().usageForOrigin(reinterpret_cast<SecurityOrigin*>(_private), usage)) + return usage; + return 0; +#else + return 0; +#endif +} + +- (unsigned long long)quota +{ +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + long long quota; + if (cacheStorage().quotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private), quota)) + return quota; + return 0; +#else + return 0; +#endif +} + +- (void)setQuota:(unsigned long long)quota +{ +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + cacheStorage().storeUpdatedQuotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private), quota); +#endif +} + +@end diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.h b/WebKit/mac/WebCoreSupport/WebChromeClient.h index 707d080..50c159c 100644 --- a/WebKit/mac/WebCoreSupport/WebChromeClient.h +++ b/WebKit/mac/WebCoreSupport/WebChromeClient.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -117,6 +117,7 @@ public: #endif #if ENABLE(OFFLINE_WEB_APPLICATIONS) virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); + virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*); #endif virtual void populateVisitedLinks(); @@ -167,6 +168,10 @@ public: virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*); virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*) { } + virtual bool selectItemWritingDirectionIsNatural(); + virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const; + virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const; + private: WebView *m_webView; }; diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm index eb56240..1a3736e 100644 --- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm +++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm @@ -1,6 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,6 +30,8 @@ #import "WebChromeClient.h" #import "DOMNodeInternal.h" +#import "WebApplicationCacheSecurityOrigin.h" +#import "WebDatabaseSecurityOrigin.h" #import "WebDefaultUIDelegate.h" #import "WebDelegateImplementationCaching.h" #import "WebElementDictionary.h" @@ -62,12 +64,16 @@ #import <WebCore/Page.h> #import <WebCore/PlatformScreen.h> #import <WebCore/PlatformString.h> +#import <WebCore/PopupMenuMac.h> #import <WebCore/ResourceRequest.h> +#import <WebCore/SearchPopupMenuMac.h> #import <WebCore/Widget.h> #import <WebCore/WindowFeatures.h> #import <wtf/PassRefPtr.h> #import <wtf/Vector.h> + + #if USE(ACCELERATED_COMPOSITING) #import <WebCore/GraphicsLayer.h> #endif @@ -553,7 +559,7 @@ void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& database { BEGIN_BLOCK_OBJC_EXCEPTIONS; - WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()]; + WebDatabaseSecurityOrigin *webOrigin = [[WebDatabaseSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()]; // FIXME: remove this workaround once shipping Safari has the necessary delegate implemented. if (WKAppVersionCheckLessThan(@"com.apple.Safari", -1, 3.1)) { const unsigned long long defaultQuota = 5 * 1024 * 1024; // 5 megabytes should hopefully be enough to test storage support. @@ -571,6 +577,17 @@ void WebChromeClient::reachedMaxAppCacheSize(int64_t spaceNeeded) { // FIXME: Free some space. } + +void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin* origin) +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + + WebApplicationCacheSecurityOrigin *webOrigin = [[WebApplicationCacheSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]; + CallUIDelegate(m_webView, @selector(webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:), webOrigin); + [webOrigin release]; + + END_BLOCK_OBJC_EXCEPTIONS; +} #endif void WebChromeClient::populateVisitedLinks() @@ -724,6 +741,21 @@ void WebChromeClient::formDidBlur(const WebCore::Node* node) CallUIDelegate(m_webView, @selector(webView:formDidBlurNode:), kit(const_cast<WebCore::Node*>(node))); } +bool WebChromeClient::selectItemWritingDirectionIsNatural() +{ + return true; +} + +PassRefPtr<WebCore::PopupMenu> WebChromeClient::createPopupMenu(WebCore::PopupMenuClient* client) const +{ + return adoptRef(new PopupMenuMac(client)); +} + +PassRefPtr<WebCore::SearchPopupMenu> WebChromeClient::createSearchPopupMenu(WebCore::PopupMenuClient* client) const +{ + return adoptRef(new SearchPopupMenuMac(client)); +} + #if USE(ACCELERATED_COMPOSITING) void WebChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer) diff --git a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h index 0ac4f16..3d34dbe 100644 --- a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h +++ b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h @@ -29,8 +29,9 @@ #include <WebCore/PlatformStrategies.h> #include <WebCore/PluginStrategy.h> #include <WebCore/LocalizationStrategy.h> +#include <WebCore/VisitedLinkStrategy.h> -class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::PluginStrategy, private WebCore::LocalizationStrategy { +class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::PluginStrategy, private WebCore::LocalizationStrategy, private WebCore::VisitedLinkStrategy { public: static void initialize(); @@ -40,6 +41,7 @@ private: // WebCore::PlatformStrategies virtual WebCore::PluginStrategy* createPluginStrategy(); virtual WebCore::LocalizationStrategy* createLocalizationStrategy(); + virtual WebCore::VisitedLinkStrategy* createVisitedLinkStrategy(); // WebCore::PluginStrategy virtual void refreshPlugins(); @@ -148,6 +150,10 @@ private: virtual WebCore::String validationMessageRangeUnderflowText(); virtual WebCore::String validationMessageRangeOverflowText(); virtual WebCore::String validationMessageStepMismatchText(); + + // WebCore::VisitedLinkStrategy + virtual bool isLinkVisited(WebCore::Page*, WebCore::LinkHash); + virtual void addVisitedLink(WebCore::Page*, WebCore::LinkHash); }; #endif // WebPlatformStrategies_h diff --git a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm index 6805f5e..2900ccf 100644 --- a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm +++ b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm @@ -30,6 +30,8 @@ #import "WebPluginPackage.h" #import <WebCore/BlockExceptions.h> #import <WebCore/IntSize.h> +#import <WebCore/Page.h> +#import <WebCore/PageGroup.h> #import <wtf/StdLibExtras.h> #ifdef BUILDING_ON_TIGER @@ -60,6 +62,11 @@ LocalizationStrategy* WebPlatformStrategies::createLocalizationStrategy() return this; } +VisitedLinkStrategy* WebPlatformStrategies::createVisitedLinkStrategy() +{ + return this; +} + void WebPlatformStrategies::refreshPlugins() { [[WebPluginDatabase sharedDatabase] refresh]; @@ -762,3 +769,13 @@ String WebPlatformStrategies::validationMessageStepMismatchText() return UI_STRING("step mismatch", "Validation message for input form controls with value not respecting the step attribute"); } +// VisitedLinkStrategy +bool WebPlatformStrategies::isLinkVisited(Page* page, LinkHash hash) +{ + return page->group().isLinkVisited(hash); +} + +void WebPlatformStrategies::addVisitedLink(Page* page, LinkHash hash) +{ + return page->group().addVisitedLinkHash(hash); +} diff --git a/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm b/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm new file mode 100644 index 0000000..0d49445 --- /dev/null +++ b/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2007, 2010 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/KURL.h> +#import <WebCore/SecurityOrigin.h> +#import <WebCore/DatabaseTracker.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(); +} + +// FIXME: https://bugs.webkit.org/show_bug.cgi?id=40627 +// Proper steps should be taken to have subclass implementations of SecurityOrigin's +// origin, quota, and setQuota methods. + +- (unsigned long long)usage +{ +#if ENABLE(DATABASE) + return DatabaseTracker::tracker().usageForOrigin(reinterpret_cast<SecurityOrigin*>(_private)); +#else + return 0; +#endif +} + +- (unsigned long long)quota +{ +#if ENABLE(DATABASE) + return DatabaseTracker::tracker().quotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private)); +#else + return 0; +#endif +} + +// 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 +{ +#if ENABLE(DATABASE) + DatabaseTracker::tracker().setQuota(reinterpret_cast<SecurityOrigin*>(_private), quota); +#endif +} + +- (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/WebCoreSupport/WebSecurityOriginInternal.h b/WebKit/mac/WebCoreSupport/WebSecurityOriginInternal.h new file mode 100644 index 0000000..7bd6817 --- /dev/null +++ b/WebKit/mac/WebCoreSupport/WebSecurityOriginInternal.h @@ -0,0 +1,42 @@ +/* + * 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/WebCoreSupport/WebSecurityOriginPrivate.h b/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h new file mode 100644 index 0000000..6518a16 --- /dev/null +++ b/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h @@ -0,0 +1,55 @@ +/* + * 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; + +// Meant to be implemented in a subclass. +// Returns the current total usage of all relevant items in this security origin in bytes. +- (unsigned long long)usage; + +// Meant to be implemented in a subclass. +// Returns the quota of this security origin in bytes. +- (unsigned long long)quota; + +// Meant to be implemented in a subclass. +// Sets the storage quota in bytes. +- (void)setQuota:(unsigned long long)quota; + +@end |