summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/in_process_webkit/browser_webkitclient_impl.cc4
-rw-r--r--chrome/browser/in_process_webkit/browser_webkitclient_impl.h3
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc33
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h15
-rw-r--r--chrome/browser/in_process_webkit/storage_area.cc8
-rw-r--r--chrome/common/render_messages.h7
-rw-r--r--chrome/common/render_messages_internal.h13
-rw-r--r--chrome/renderer/render_thread.cc2
-rw-r--r--chrome/renderer/renderer_webkitclient_impl.cc4
-rw-r--r--chrome/renderer/renderer_webkitclient_impl.h2
-rw-r--r--chrome/renderer/renderer_webstoragearea_impl.cc19
-rw-r--r--chrome/renderer/renderer_webstoragearea_impl.h11
-rw-r--r--chrome/worker/worker_webkitclient_impl.cc2
-rw-r--r--chrome/worker/worker_webkitclient_impl.h2
14 files changed, 78 insertions, 47 deletions
diff --git a/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc b/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc
index e4105f6..6469cea 100644
--- a/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc
+++ b/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc
@@ -115,13 +115,13 @@ BrowserWebKitClientImpl::createSessionStorageNamespace() {
void BrowserWebKitClientImpl::dispatchStorageEvent(
const WebKit::WebString& key, const WebKit::WebString& old_value,
const WebKit::WebString& new_value, const WebKit::WebString& origin,
- bool is_local_storage) {
+ const WebKit::WebURL& url, bool is_local_storage) {
// TODO(jorlow): Implement
if (!is_local_storage)
return;
DOMStorageDispatcherHost::DispatchStorageEvent(key, old_value, new_value,
- origin, is_local_storage);
+ origin, url, is_local_storage);
}
WebKit::WebSharedWorkerRepository*
diff --git a/chrome/browser/in_process_webkit/browser_webkitclient_impl.h b/chrome/browser/in_process_webkit/browser_webkitclient_impl.h
index b562fd8..1065269 100644
--- a/chrome/browser/in_process_webkit/browser_webkitclient_impl.h
+++ b/chrome/browser/in_process_webkit/browser_webkitclient_impl.h
@@ -35,7 +35,8 @@ class BrowserWebKitClientImpl : public webkit_glue::WebKitClientImpl {
virtual WebKit::WebStorageNamespace* createSessionStorageNamespace();
virtual void dispatchStorageEvent(const WebKit::WebString& key,
const WebKit::WebString& oldValue, const WebKit::WebString& newValue,
- const WebKit::WebString& origin, bool isLocalStorage);
+ const WebKit::WebString& origin, const WebKit::WebURL& url,
+ bool isLocalStorage);
virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository();
};
diff --git a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc
index 63ff96e..75b9bfc 100644
--- a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc
+++ b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc
@@ -12,23 +12,30 @@
#include "chrome/browser/in_process_webkit/webkit_thread.h"
#include "chrome/browser/renderer_host/browser_render_process_host.h"
#include "chrome/common/render_messages.h"
+#include "googleurl/src/gurl.h"
DOMStorageDispatcherHost* DOMStorageDispatcherHost::storage_event_host_ = NULL;
+const GURL* DOMStorageDispatcherHost::storage_event_url_ = NULL;
DOMStorageDispatcherHost::
ScopedStorageEventContext::ScopedStorageEventContext(
- DOMStorageDispatcherHost* dispatcher_host) {
+ DOMStorageDispatcherHost* dispatcher_host, const GURL* url) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
DCHECK(!storage_event_host_);
+ DCHECK(!storage_event_url_);
storage_event_host_ = dispatcher_host;
+ storage_event_url_ = url;
DCHECK(storage_event_host_);
+ DCHECK(storage_event_url_);
}
DOMStorageDispatcherHost::
ScopedStorageEventContext::~ScopedStorageEventContext() {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
DCHECK(storage_event_host_);
+ DCHECK(storage_event_url_);
storage_event_host_ = NULL;
+ storage_event_url_ = NULL;
}
DOMStorageDispatcherHost::DOMStorageDispatcherHost(
@@ -79,7 +86,7 @@ void DOMStorageDispatcherHost::Shutdown() {
/* static */
void DOMStorageDispatcherHost::DispatchStorageEvent(const NullableString16& key,
const NullableString16& old_value, const NullableString16& new_value,
- const string16& origin, bool is_local_storage) {
+ const string16& origin, const GURL& url, bool is_local_storage) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
DCHECK(is_local_storage); // Only LocalStorage is implemented right now.
DCHECK(storage_event_host_);
@@ -88,6 +95,7 @@ void DOMStorageDispatcherHost::DispatchStorageEvent(const NullableString16& key,
params.old_value_ = old_value;
params.new_value_ = new_value;
params.origin_ = origin;
+ params.url_ = *storage_event_url_; // The url passed in is junk.
params.storage_type_ = is_local_storage ? DOM_STORAGE_LOCAL
: DOM_STORAGE_SESSION;
// The storage_event_host_ is the DOMStorageDispatcherHost that is up in the
@@ -273,12 +281,13 @@ void DOMStorageDispatcherHost::OnGetItem(int64 storage_area_id,
Send(reply_msg);
}
-void DOMStorageDispatcherHost::OnSetItem(int64 storage_area_id,
- const string16& key, const string16& value, IPC::Message* reply_msg) {
+void DOMStorageDispatcherHost::OnSetItem(
+ int64 storage_area_id, const string16& key, const string16& value,
+ const GURL& url, IPC::Message* reply_msg) {
if (ChromeThread::CurrentlyOn(ChromeThread::IO)) {
PostTaskToWebKitThread(FROM_HERE, NewRunnableMethod(this,
&DOMStorageDispatcherHost::OnSetItem, storage_area_id, key, value,
- reply_msg));
+ url, reply_msg));
return;
}
@@ -291,17 +300,17 @@ void DOMStorageDispatcherHost::OnSetItem(int64 storage_area_id,
return;
}
- ScopedStorageEventContext scope(this);
+ ScopedStorageEventContext scope(this, &url);
storage_area->SetItem(key, value, &quota_exception);
ViewHostMsg_DOMStorageSetItem::WriteReplyParams(reply_msg, quota_exception);
Send(reply_msg);
}
void DOMStorageDispatcherHost::OnRemoveItem(
- int64 storage_area_id, const string16& key) {
+ int64 storage_area_id, const string16& key, const GURL& url) {
if (ChromeThread::CurrentlyOn(ChromeThread::IO)) {
PostTaskToWebKitThread(FROM_HERE, NewRunnableMethod(this,
- &DOMStorageDispatcherHost::OnRemoveItem, storage_area_id, key));
+ &DOMStorageDispatcherHost::OnRemoveItem, storage_area_id, key, url));
return;
}
@@ -313,14 +322,14 @@ void DOMStorageDispatcherHost::OnRemoveItem(
return;
}
- ScopedStorageEventContext scope(this);
+ ScopedStorageEventContext scope(this, &url);
storage_area->RemoveItem(key);
}
-void DOMStorageDispatcherHost::OnClear(int64 storage_area_id) {
+void DOMStorageDispatcherHost::OnClear(int64 storage_area_id, const GURL& url) {
if (ChromeThread::CurrentlyOn(ChromeThread::IO)) {
PostTaskToWebKitThread(FROM_HERE, NewRunnableMethod(this,
- &DOMStorageDispatcherHost::OnClear, storage_area_id));
+ &DOMStorageDispatcherHost::OnClear, storage_area_id, url));
return;
}
@@ -332,7 +341,7 @@ void DOMStorageDispatcherHost::OnClear(int64 storage_area_id) {
return;
}
- ScopedStorageEventContext scope(this);
+ ScopedStorageEventContext scope(this, &url);
storage_area->Clear();
}
diff --git a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h
index 28e3fc8..45b0eba 100644
--- a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h
+++ b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h
@@ -14,6 +14,7 @@
#include "ipc/ipc_message.h"
class DOMStorageContext;
+class GURL;
class Task;
class WebKitThread;
struct ViewMsg_DOMStorageEvent_Params;
@@ -45,7 +46,7 @@ class DOMStorageDispatcherHost :
// Only call on the WebKit thread.
static void DispatchStorageEvent(const NullableString16& key,
const NullableString16& old_value, const NullableString16& new_value,
- const string16& origin, bool is_local_storage);
+ const string16& origin, const GURL& url, bool is_local_storage);
private:
friend class base::RefCountedThreadSafe<DOMStorageDispatcherHost>;
@@ -61,9 +62,11 @@ class DOMStorageDispatcherHost :
void OnGetItem(int64 storage_area_id, const string16& key,
IPC::Message* reply_msg);
void OnSetItem(int64 storage_area_id, const string16& key,
- const string16& value, IPC::Message* reply_msg);
- void OnRemoveItem(int64 storage_area_id, const string16& key);
- void OnClear(int64 storage_area_id);
+ const string16& value, const GURL& url,
+ IPC::Message* reply_msg);
+ void OnRemoveItem(int64 storage_area_id, const string16& key,
+ const GURL& url);
+ void OnClear(int64 storage_area_id, const GURL& url);
// Only call on the IO thread.
void OnStorageEvent(const ViewMsg_DOMStorageEvent_Params& params);
@@ -80,12 +83,14 @@ class DOMStorageDispatcherHost :
// Use whenever there's a chance OnStorageEvent will be called.
class ScopedStorageEventContext {
public:
- ScopedStorageEventContext(DOMStorageDispatcherHost* dispatcher_host);
+ ScopedStorageEventContext(DOMStorageDispatcherHost* dispatcher_host,
+ const GURL* url);
~ScopedStorageEventContext();
};
// Only access on the WebKit thread! Used for storage events.
static DOMStorageDispatcherHost* storage_event_host_;
+ static const GURL* storage_event_url_;
// Data shared between renderer processes with the same profile.
scoped_refptr<WebKitContext> webkit_context_;
diff --git a/chrome/browser/in_process_webkit/storage_area.cc b/chrome/browser/in_process_webkit/storage_area.cc
index 603ead3..61b9f26 100644
--- a/chrome/browser/in_process_webkit/storage_area.cc
+++ b/chrome/browser/in_process_webkit/storage_area.cc
@@ -8,8 +8,10 @@
#include "chrome/browser/in_process_webkit/storage_namespace.h"
#include "webkit/api/public/WebStorageArea.h"
#include "webkit/api/public/WebString.h"
+#include "webkit/api/public/WebURL.h"
using WebKit::WebStorageArea;
+using WebKit::WebURL;
StorageArea::StorageArea(const string16& origin,
int64 id,
@@ -41,17 +43,17 @@ NullableString16 StorageArea::GetItem(const string16& key) {
void StorageArea::SetItem(const string16& key, const string16& value,
bool* quota_exception) {
CreateWebStorageAreaIfNecessary();
- storage_area_->setItem(key, value, *quota_exception);
+ storage_area_->setItem(key, value, WebURL(), *quota_exception);
}
void StorageArea::RemoveItem(const string16& key) {
CreateWebStorageAreaIfNecessary();
- storage_area_->removeItem(key);
+ storage_area_->removeItem(key, WebURL());
}
void StorageArea::Clear() {
CreateWebStorageAreaIfNecessary();
- storage_area_->clear();
+ storage_area_->clear(WebURL());
}
void StorageArea::PurgeMemory() {
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 37f7e23..e226cb3 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -509,6 +509,9 @@ struct ViewMsg_DOMStorageEvent_Params {
// The origin this is associated with.
string16 origin_;
+ // The URL of the page that caused the storage event.
+ GURL url_;
+
// The storage type of this event.
DOMStorageType storage_type_;
};
@@ -2235,6 +2238,7 @@ struct ParamTraits<ViewMsg_DOMStorageEvent_Params> {
WriteParam(m, p.old_value_);
WriteParam(m, p.new_value_);
WriteParam(m, p.origin_);
+ WriteParam(m, p.url_);
WriteParam(m, p.storage_type_);
}
static bool Read(const Message* m, void** iter, param_type* p) {
@@ -2243,6 +2247,7 @@ struct ParamTraits<ViewMsg_DOMStorageEvent_Params> {
ReadParam(m, iter, &p->old_value_) &&
ReadParam(m, iter, &p->new_value_) &&
ReadParam(m, iter, &p->origin_) &&
+ ReadParam(m, iter, &p->url_) &&
ReadParam(m, iter, &p->storage_type_);
}
static void Log(const param_type& p, std::wstring* l) {
@@ -2255,6 +2260,8 @@ struct ParamTraits<ViewMsg_DOMStorageEvent_Params> {
l->append(L", ");
LogParam(p.origin_, l);
l->append(L", ");
+ LogParam(p.url_, l);
+ l->append(L", ");
LogParam(p.storage_type_, l);
l->append(L")");
}
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 38694f3..fa8a9a6 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -1842,20 +1842,23 @@ IPC_BEGIN_MESSAGES(ViewHost)
NullableString16 /* value */)
// Set a value that's associated with a key in a storage area.
- IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_DOMStorageSetItem,
+ IPC_SYNC_MESSAGE_CONTROL4_1(ViewHostMsg_DOMStorageSetItem,
int64 /* storage_area_id */,
string16 /* key */,
string16 /* value */,
+ GURL /* url */,
bool /* quota_exception */)
// Remove the value associated with a key in a storage area.
- IPC_MESSAGE_CONTROL2(ViewHostMsg_DOMStorageRemoveItem,
+ IPC_MESSAGE_CONTROL3(ViewHostMsg_DOMStorageRemoveItem,
int64 /* storage_area_id */,
- string16 /* key */)
+ string16 /* key */,
+ GURL /* url */)
// Clear the storage area.
- IPC_MESSAGE_CONTROL1(ViewHostMsg_DOMStorageClear,
- int64 /* storage_area_id */)
+ IPC_MESSAGE_CONTROL2(ViewHostMsg_DOMStorageClear,
+ int64 /* storage_area_id */,
+ GURL /* url */)
// Get file size in bytes. Set result to -1 if failed to get the file size.
IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_GetFileSize,
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc
index 9e033e6..0805000 100644
--- a/chrome/renderer/render_thread.cc
+++ b/chrome/renderer/render_thread.cc
@@ -271,7 +271,7 @@ void RenderThread::OnDOMStorageEvent(
if (!dom_storage_event_dispatcher_.get())
dom_storage_event_dispatcher_.reset(WebStorageEventDispatcher::create());
dom_storage_event_dispatcher_->dispatchStorageEvent(params.key_,
- params.old_value_, params.new_value_, params.origin_,
+ params.old_value_, params.new_value_, params.origin_, params.url_,
params.storage_type_ == DOM_STORAGE_LOCAL);
}
diff --git a/chrome/renderer/renderer_webkitclient_impl.cc b/chrome/renderer/renderer_webkitclient_impl.cc
index cffa805..612277b 100644
--- a/chrome/renderer/renderer_webkitclient_impl.cc
+++ b/chrome/renderer/renderer_webkitclient_impl.cc
@@ -206,13 +206,13 @@ WebStorageNamespace* RendererWebKitClientImpl::createSessionStorageNamespace() {
void RendererWebKitClientImpl::dispatchStorageEvent(
const WebString& key, const WebString& old_value,
const WebString& new_value, const WebString& origin,
- bool is_local_storage) {
+ const WebKit::WebURL& url, bool is_local_storage) {
DCHECK(CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess));
// Inefficient, but only used in single process mode.
scoped_ptr<WebStorageEventDispatcher> event_dispatcher(
WebStorageEventDispatcher::create());
event_dispatcher->dispatchStorageEvent(key, old_value, new_value, origin,
- is_local_storage);
+ url, is_local_storage);
}
WebApplicationCacheHost* RendererWebKitClientImpl::createApplicationCacheHost(
diff --git a/chrome/renderer/renderer_webkitclient_impl.h b/chrome/renderer/renderer_webkitclient_impl.h
index 4a3852b..326d3a6 100644
--- a/chrome/renderer/renderer_webkitclient_impl.h
+++ b/chrome/renderer/renderer_webkitclient_impl.h
@@ -53,7 +53,7 @@ class RendererWebKitClientImpl : public webkit_glue::WebKitClientImpl {
virtual void dispatchStorageEvent(
const WebKit::WebString& key, const WebKit::WebString& old_value,
const WebKit::WebString& new_value, const WebKit::WebString& origin,
- bool is_local_storage);
+ const WebKit::WebURL& url, bool is_local_storage);
virtual WebKit::WebKitClient::FileHandle databaseOpenFile(
const WebKit::WebString& file_name, int desired_flags,
diff --git a/chrome/renderer/renderer_webstoragearea_impl.cc b/chrome/renderer/renderer_webstoragearea_impl.cc
index 417e949..3ddc29c 100644
--- a/chrome/renderer/renderer_webstoragearea_impl.cc
+++ b/chrome/renderer/renderer_webstoragearea_impl.cc
@@ -6,8 +6,10 @@
#include "chrome/common/render_messages.h"
#include "chrome/renderer/render_thread.h"
+#include "webkit/api/public/WebURL.h"
using WebKit::WebString;
+using WebKit::WebURL;
RendererWebStorageAreaImpl::RendererWebStorageAreaImpl(
int64 namespace_id, const WebString& origin) {
@@ -40,20 +42,21 @@ WebString RendererWebStorageAreaImpl::getItem(const WebString& key) {
return value;
}
-void RendererWebStorageAreaImpl::setItem(const WebString& key,
- const WebString& value,
- bool& quota_exception) {
+void RendererWebStorageAreaImpl::setItem(
+ const WebString& key, const WebString& value, const WebURL& url,
+ bool& quota_exception) {
RenderThread::current()->Send(
- new ViewHostMsg_DOMStorageSetItem(storage_area_id_, key, value,
+ new ViewHostMsg_DOMStorageSetItem(storage_area_id_, key, value, url,
&quota_exception));
}
-void RendererWebStorageAreaImpl::removeItem(const WebString& key) {
+void RendererWebStorageAreaImpl::removeItem(const WebString& key,
+ const WebURL& url) {
RenderThread::current()->Send(
- new ViewHostMsg_DOMStorageRemoveItem(storage_area_id_, key));
+ new ViewHostMsg_DOMStorageRemoveItem(storage_area_id_, key, url));
}
-void RendererWebStorageAreaImpl::clear() {
+void RendererWebStorageAreaImpl::clear(const WebURL& url) {
RenderThread::current()->Send(
- new ViewHostMsg_DOMStorageClear(storage_area_id_));
+ new ViewHostMsg_DOMStorageClear(storage_area_id_, url));
}
diff --git a/chrome/renderer/renderer_webstoragearea_impl.h b/chrome/renderer/renderer_webstoragearea_impl.h
index 57e13fc..c61a0f1 100644
--- a/chrome/renderer/renderer_webstoragearea_impl.h
+++ b/chrome/renderer/renderer_webstoragearea_impl.h
@@ -20,11 +20,12 @@ class RendererWebStorageAreaImpl : public WebKit::WebStorageArea {
virtual unsigned length();
virtual WebKit::WebString key(unsigned index);
virtual WebKit::WebString getItem(const WebKit::WebString& key);
- virtual void setItem(const WebKit::WebString& key,
- const WebKit::WebString& value,
- bool& quota_exception);
- virtual void removeItem(const WebKit::WebString& key);
- virtual void clear();
+ virtual void setItem(
+ const WebKit::WebString& key, const WebKit::WebString& value,
+ const WebKit::WebURL& url, bool& quota_exception);
+ virtual void removeItem(const WebKit::WebString& key,
+ const WebKit::WebURL& url);
+ virtual void clear(const WebKit::WebURL& url);
private:
// The ID we use for all IPC.
diff --git a/chrome/worker/worker_webkitclient_impl.cc b/chrome/worker/worker_webkitclient_impl.cc
index 2ba4419..c8df883 100644
--- a/chrome/worker/worker_webkitclient_impl.cc
+++ b/chrome/worker/worker_webkitclient_impl.cc
@@ -97,7 +97,7 @@ WebStorageNamespace* WorkerWebKitClientImpl::createSessionStorageNamespace() {
void WorkerWebKitClientImpl::dispatchStorageEvent(
const WebString& key, const WebString& old_value,
const WebString& new_value, const WebString& origin,
- bool is_local_storage) {
+ const WebKit::WebURL& url, bool is_local_storage) {
NOTREACHED();
}
diff --git a/chrome/worker/worker_webkitclient_impl.h b/chrome/worker/worker_webkitclient_impl.h
index 6fbe716..b0dcb68 100644
--- a/chrome/worker/worker_webkitclient_impl.h
+++ b/chrome/worker/worker_webkitclient_impl.h
@@ -34,7 +34,7 @@ class WorkerWebKitClientImpl : public webkit_glue::WebKitClientImpl,
virtual void dispatchStorageEvent(
const WebKit::WebString& key, const WebKit::WebString& old_value,
const WebKit::WebString& new_value, const WebKit::WebString& origin,
- bool is_local_storage);
+ const WebKit::WebURL& url, bool is_local_storage);
virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository();
// WebMimeRegistry methods: