Index: content/browser/in_process_webkit/dom_storage_message_filter.cc |
diff --git a/content/browser/in_process_webkit/dom_storage_message_filter.cc b/content/browser/in_process_webkit/dom_storage_message_filter.cc |
index 6318c324ede361c47f43473013323f95197c9ede..38af60437de1d58c6c00f13f6ff1a5c45af8af0c 100644 |
--- a/content/browser/in_process_webkit/dom_storage_message_filter.cc |
+++ b/content/browser/in_process_webkit/dom_storage_message_filter.cc |
@@ -10,6 +10,8 @@ |
#include "content/browser/in_process_webkit/dom_storage_context.h" |
#include "content/browser/in_process_webkit/dom_storage_namespace.h" |
#include "content/common/dom_storage_messages.h" |
+#include "content/public/browser/notification_service.h" |
+#include "content/public/browser/notification_types.h" |
#include "content/public/browser/browser_thread.h" |
#include "googleurl/src/gurl.h" |
@@ -110,16 +112,43 @@ void DOMStorageMessageFilter::OverrideThreadForMessage( |
*thread = BrowserThread::WEBKIT_DEPRECATED; |
} |
+void DOMStorageMessageFilter::NotifyOnUIThread( |
+ int64 namespace_id, |
+ const FilePath& session_storage_directory) { |
+ SessionStorageCreatedDetails details; |
+ details.id = namespace_id; |
+ details.session_storage_directory = session_storage_directory; |
+ content::NotificationService::current()->Notify( |
+ content::NOTIFICATION_SESSION_STORAGE_NAMESPACE_CREATED, |
+ content::Source<DOMStorageMessageFilter>(this), |
+ content::Details<SessionStorageCreatedDetails>(&details)); |
+} |
+ |
void DOMStorageMessageFilter::OnStorageAreaId(int64 namespace_id, |
const string16& origin, |
int64* storage_area_id) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
+ // Don't allow creation of the namespace. |
DOMStorageNamespace* storage_namespace = |
- Context()->GetStorageNamespace(namespace_id, true); |
+ Context()->GetStorageNamespace(namespace_id, false); |
if (!storage_namespace) { |
- *storage_area_id = DOMStorageContext::kInvalidStorageId; |
- return; |
+ // The namespace doesn't exist; create it and send a notification if it was |
+ // a session storage. |
+ storage_namespace = |
+ Context()->GetStorageNamespace(namespace_id, true); |
+ if (!storage_namespace) { |
+ *storage_area_id = DOMStorageContext::kInvalidStorageId; |
+ return; |
+ } |
+ |
+ if (storage_namespace->dom_storage_type() == DOM_STORAGE_SESSION) { |
+ BrowserThread::PostTask( |
+ BrowserThread::UI, FROM_HERE, |
+ base::Bind(&DOMStorageMessageFilter::NotifyOnUIThread, this, |
+ namespace_id, |
+ storage_namespace->session_storage_directory())); |
+ } |
} |
DOMStorageArea* storage_area = storage_namespace->GetStorageArea(origin); |
*storage_area_id = storage_area->id(); |