OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h" | 5 #include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h" |
6 | 6 |
7 #include "base/nullable_string16.h" | 7 #include "base/nullable_string16.h" |
8 #include "chrome/browser/chrome_thread.h" | 8 #include "chrome/browser/chrome_thread.h" |
9 #include "chrome/browser/in_process_webkit/dom_storage_area.h" | 9 #include "chrome/browser/in_process_webkit/dom_storage_area.h" |
10 #include "chrome/browser/in_process_webkit/dom_storage_context.h" | 10 #include "chrome/browser/in_process_webkit/dom_storage_context.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 else | 144 else |
145 resource_message_filter_->Send(message); | 145 resource_message_filter_->Send(message); |
146 } | 146 } |
147 | 147 |
148 void DOMStorageDispatcherHost::OnStorageAreaId(int64 namespace_id, | 148 void DOMStorageDispatcherHost::OnStorageAreaId(int64 namespace_id, |
149 const string16& origin, | 149 const string16& origin, |
150 IPC::Message* reply_msg) { | 150 IPC::Message* reply_msg) { |
151 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 151 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); |
152 ChromeURLRequestContext* url_request_context = | 152 ChromeURLRequestContext* url_request_context = |
153 resource_message_filter_->GetRequestContextForURL(GURL(origin)); | 153 resource_message_filter_->GetRequestContextForURL(GURL(origin)); |
154 ChromeThread::PostTask( | 154 ChromeThread::PostTask(ChromeThread::WEBKIT, FROM_HERE, NewRunnableMethod( |
155 ChromeThread::WEBKIT, | 155 this, &DOMStorageDispatcherHost::OnStorageAreaIdWebKit, namespace_id, |
156 FROM_HERE, | 156 origin, reply_msg, url_request_context->host_content_settings_map())); |
157 NewRunnableMethod( | |
158 this, | |
159 &DOMStorageDispatcherHost::OnStorageAreaIdWebKit, | |
160 namespace_id, | |
161 origin, | |
162 reply_msg, | |
163 make_scoped_refptr( | |
164 url_request_context->host_content_settings_map()))); | |
165 } | 157 } |
166 | 158 |
167 void DOMStorageDispatcherHost::OnStorageAreaIdWebKit( | 159 void DOMStorageDispatcherHost::OnStorageAreaIdWebKit( |
168 int64 namespace_id, const string16& origin, IPC::Message* reply_msg, | 160 int64 namespace_id, const string16& origin, IPC::Message* reply_msg, |
169 HostContentSettingsMap* host_content_settings_map) { | 161 HostContentSettingsMap* host_content_settings_map) { |
170 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); | 162 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); |
171 DOMStorageNamespace* storage_namespace = | 163 DOMStorageNamespace* storage_namespace = |
172 Context()->GetStorageNamespace(namespace_id, true); | 164 Context()->GetStorageNamespace(namespace_id, true); |
173 if (!storage_namespace) { | 165 if (!storage_namespace) { |
174 BrowserRenderProcessHost::BadMessageTerminateProcess( | 166 BrowserRenderProcessHost::BadMessageTerminateProcess( |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 const DOMStorageContext::DispatcherHostSet* set = | 331 const DOMStorageContext::DispatcherHostSet* set = |
340 Context()->GetDispatcherHostSet(); | 332 Context()->GetDispatcherHostSet(); |
341 DOMStorageContext::DispatcherHostSet::const_iterator cur = set->begin(); | 333 DOMStorageContext::DispatcherHostSet::const_iterator cur = set->begin(); |
342 while (cur != set->end()) { | 334 while (cur != set->end()) { |
343 // The renderer that generates the event handles it itself. | 335 // The renderer that generates the event handles it itself. |
344 if (*cur != this) | 336 if (*cur != this) |
345 (*cur)->Send(new ViewMsg_DOMStorageEvent(params)); | 337 (*cur)->Send(new ViewMsg_DOMStorageEvent(params)); |
346 ++cur; | 338 ++cur; |
347 } | 339 } |
348 } | 340 } |
OLD | NEW |