Reviewed by Brady.
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Nov 2007 01:34:54 +0000 (01:34 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Nov 2007 01:34:54 +0000 (01:34 +0000)
        * Storage/WebDatabaseManager.mm:
        * Storage/WebDatabaseManagerPrivate.h:
        * Storage/WebDatabaseTrackerClient.mm:
        (WebDatabaseTrackerClient::dispatchDidModifyOrigin):
        (WebDatabaseTrackerClient::dispatchDidModifyDatabase):
        * Storage/WebSecurityOrigin.mm:
        (-[WebSecurityOrigin _initWithWebCoreSecurityOriginData:]):
        * Storage/WebSecurityOriginInternal.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28095 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/mac/ChangeLog
WebKit/mac/Storage/WebDatabaseManager.mm
WebKit/mac/Storage/WebDatabaseManagerPrivate.h
WebKit/mac/Storage/WebDatabaseTrackerClient.mm
WebKit/mac/Storage/WebSecurityOrigin.mm
WebKit/mac/Storage/WebSecurityOriginInternal.h

index affa3d785ff431e5b3e36600fb7074b046affc39..f7fea8387002864e18bbebeb0b3264023b3a47bc 100644 (file)
@@ -1,3 +1,16 @@
+2007-11-27  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Brady.
+
+        * Storage/WebDatabaseManager.mm:
+        * Storage/WebDatabaseManagerPrivate.h:
+        * Storage/WebDatabaseTrackerClient.mm:
+        (WebDatabaseTrackerClient::dispatchDidModifyOrigin):
+        (WebDatabaseTrackerClient::dispatchDidModifyDatabase):
+        * Storage/WebSecurityOrigin.mm:
+        (-[WebSecurityOrigin _initWithWebCoreSecurityOriginData:]):
+        * Storage/WebSecurityOriginInternal.h:
+
 2007-11-27  Kevin Decker  <kdecker@apple.com>
 
         Reviewed by Darin, landed by Anders.
index 869d2c930f2fcf05db33acb82c06ee7ffc6f3923..b561a22397106192cba5c130ab8bec0fa3a80d9c 100644 (file)
@@ -45,6 +45,7 @@ const NSString *WebDatabaseUsageKey = @"WebDatabaseUsageKey";
 
 const NSString *WebDatabaseDidModifyOriginNotification = @"WebDatabaseDidModifyOriginNotification";
 const NSString *WebDatabaseDidModifyDatabaseNotification = @"WebDatabaseDidModifyDatabaseNotification";
+const NSString *WebDatabaseNameKey = @"WebDatabaseNameKey";
 
 @implementation WebDatabaseManager
 
index a1efd9adaa1f91724ff57ada85d48279e8c5def8..5bef5bbadf1271e0e51a19eefb4ce0b3fbedca77 100644 (file)
@@ -31,10 +31,14 @@ extern const NSString *WebDatabaseExpectedSizeKey;
 extern const 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 const 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 const NSString *WebDatabaseDidModifyDatabaseNotification;
+extern const NSString *WebDatabaseNameKey;
 
 @class WebSecurityOrigin;
 
index b6e8f6f1759b58165fc8820231028e6f47f68f63..072274035237e6a72c890b147d1588056323ed4e 100644 (file)
  */
  
 #import "WebDatabaseTrackerClient.h"
+
+#import "WebDatabaseManagerPrivate.h"
+#import "WebSecurityOriginPrivate.h"
+#import "WebSecurityOriginInternal.h"
+#import <wtf/RetainPtr.h>
+
+using namespace WebCore;
+
 WebDatabaseTrackerClient* WebDatabaseTrackerClient::sharedWebDatabaseTrackerClient()
 {
     static WebDatabaseTrackerClient* sharedClient = new WebDatabaseTrackerClient();
@@ -42,12 +49,21 @@ WebDatabaseTrackerClient::~WebDatabaseTrackerClient()
 {
 }
     
-void WebDatabaseTrackerClient::dispatchDidModifyOrigin(const WebCore::SecurityOriginData& origin)
+void WebDatabaseTrackerClient::dispatchDidModifyOrigin(const SecurityOriginData& origin)
 {
+     RetainPtr<WebSecurityOrigin> webSecurityOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOriginData:&origin]);
 
+    [[NSNotificationCenter defaultCenter] postNotificationName:WebDatabaseDidModifyOriginNotification 
+                                                        object:webSecurityOrigin.get()];
 }
 
-void WebDatabaseTrackerClient::dispatchDidModifyDatabase(const WebCore::SecurityOriginData& origin, const WebCore::String& databaseName)
+void WebDatabaseTrackerClient::dispatchDidModifyDatabase(const SecurityOriginData& origin, const String& databaseName)
 {
-
+    RetainPtr<WebSecurityOrigin> webSecurityOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOriginData:&origin]);
+    RetainPtr<NSDictionary> userInfo(AdoptNS, [[NSDictionary alloc] 
+                                               initWithObjectsAndKeys:(NSString *)databaseName, WebDatabaseNameKey, nil]);
+    
+    [[NSNotificationCenter defaultCenter] postNotificationName:WebDatabaseDidModifyDatabaseNotification
+                                                        object:webSecurityOrigin.get()
+                                                      userInfo:userInfo.get()];
 }
index 4d5ae6f07c51164535354c03f324ab799da23c9d..a9cfb19dda1a5022d054fb2b394c1f0c4b06344b 100644 (file)
@@ -102,7 +102,7 @@ using namespace WebCore;
 
 @implementation WebSecurityOrigin (WebInternal)
 
-- (id)_initWithWebCoreSecurityOriginData:(WebCoreSecurityOriginData *)securityOriginData
+- (id)_initWithWebCoreSecurityOriginData:(const WebCoreSecurityOriginData *)securityOriginData
 {
     ASSERT(securityOriginData);
     self = [super init];
index b6e6fbc3119aaa5448903379f04c4e1a5b6d38c5..c721d12b09b8f4a1dc87d30157df77bbec60220d 100644 (file)
@@ -34,7 +34,7 @@ typedef WebCore::SecurityOriginData WebCoreSecurityOriginData;
 
 @interface WebSecurityOrigin (WebInternal)
 
-- (id)_initWithWebCoreSecurityOriginData:(WebCoreSecurityOriginData *)securityOriginData;
+- (id)_initWithWebCoreSecurityOriginData:(const WebCoreSecurityOriginData *)securityOriginData;
 - (WebCoreSecurityOriginData *)_core;
 
 @end