OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/dom_storage/dom_storage_message_filter.h" | 5 #include "content/browser/dom_storage/dom_storage_message_filter.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/nullable_string16.h" | 9 #include "base/nullable_string16.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 Send(new DOMStorageMsg_AsyncOperationComplete(true)); | 118 Send(new DOMStorageMsg_AsyncOperationComplete(true)); |
119 } | 119 } |
120 | 120 |
121 void DOMStorageMessageFilter::OnSetItem( | 121 void DOMStorageMessageFilter::OnSetItem( |
122 int connection_id, const string16& key, | 122 int connection_id, const string16& key, |
123 const string16& value, const GURL& page_url) { | 123 const string16& value, const GURL& page_url) { |
124 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); | 124 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); |
125 DCHECK_EQ(0, connection_dispatching_message_for_); | 125 DCHECK_EQ(0, connection_dispatching_message_for_); |
126 base::AutoReset<int> auto_reset(&connection_dispatching_message_for_, | 126 base::AutoReset<int> auto_reset(&connection_dispatching_message_for_, |
127 connection_id); | 127 connection_id); |
128 if (!context_->CanSetItem(host_.get(), connection_id, key, value)) { | |
129 Send(new DOMStorageMsg_AsyncOperationComplete(false)); | |
130 return; | |
131 } | |
Mike West
2013/03/06 13:41:11
This would likely be fairly easy to move to DomSto
| |
128 NullableString16 not_used; | 132 NullableString16 not_used; |
129 bool success = host_->SetAreaItem(connection_id, key, value, | 133 bool success = host_->SetAreaItem(connection_id, key, value, |
130 page_url, ¬_used); | 134 page_url, ¬_used); |
131 Send(new DOMStorageMsg_AsyncOperationComplete(success)); | 135 Send(new DOMStorageMsg_AsyncOperationComplete(success)); |
132 } | 136 } |
133 | 137 |
134 void DOMStorageMessageFilter::OnRemoveItem( | 138 void DOMStorageMessageFilter::OnRemoveItem( |
135 int connection_id, const string16& key, | 139 int connection_id, const string16& key, |
136 const GURL& page_url) { | 140 const GURL& page_url) { |
137 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); | 141 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 params.connection_id = connection_dispatching_message_for_; | 210 params.connection_id = connection_dispatching_message_for_; |
207 params.key = key; | 211 params.key = key; |
208 params.new_value = new_value; | 212 params.new_value = new_value; |
209 params.old_value = old_value; | 213 params.old_value = old_value; |
210 params.namespace_id = area->namespace_id(); | 214 params.namespace_id = area->namespace_id(); |
211 Send(new DOMStorageMsg_Event(params)); | 215 Send(new DOMStorageMsg_Event(params)); |
212 } | 216 } |
213 } | 217 } |
214 | 218 |
215 } // namespace content | 219 } // namespace content |
OLD | NEW |