| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/shared_worker/shared_worker_host.h" | 5 #include "content/browser/shared_worker/shared_worker_host.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "content/browser/devtools/shared_worker_devtools_manager.h" | 8 #include "content/browser/devtools/shared_worker_devtools_manager.h" |
| 9 #include "content/browser/message_port_message_filter.h" | 9 #include "content/browser/message_port_message_filter.h" |
| 10 #include "content/browser/message_port_service.h" | 10 #include "content/browser/message_port_service.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 return; | 175 return; |
| 176 for (FilterList::const_iterator i = filters_.begin(); i != filters_.end(); | 176 for (FilterList::const_iterator i = filters_.begin(); i != filters_.end(); |
| 177 ++i) { | 177 ++i) { |
| 178 if (i->message_port_id() != message_port_id) | 178 if (i->message_port_id() != message_port_id) |
| 179 continue; | 179 continue; |
| 180 i->filter()->Send(new ViewMsg_WorkerConnected(i->route_id())); | 180 i->filter()->Send(new ViewMsg_WorkerConnected(i->route_id())); |
| 181 return; | 181 return; |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 void SharedWorkerHost::AllowFileSystem(const GURL& url, | 185 void SharedWorkerHost::AllowFileSystem( |
| 186 scoped_ptr<IPC::Message> reply_msg) { | 186 const GURL& url, |
| 187 std::unique_ptr<IPC::Message> reply_msg) { |
| 187 if (!instance_) | 188 if (!instance_) |
| 188 return; | 189 return; |
| 189 GetContentClient()->browser()->AllowWorkerFileSystem( | 190 GetContentClient()->browser()->AllowWorkerFileSystem( |
| 190 url, | 191 url, |
| 191 instance_->resource_context(), | 192 instance_->resource_context(), |
| 192 GetRenderFrameIDsForWorker(), | 193 GetRenderFrameIDsForWorker(), |
| 193 base::Bind(&SharedWorkerHost::AllowFileSystemResponse, | 194 base::Bind(&SharedWorkerHost::AllowFileSystemResponse, |
| 194 weak_factory_.GetWeakPtr(), | 195 weak_factory_.GetWeakPtr(), |
| 195 base::Passed(&reply_msg))); | 196 base::Passed(&reply_msg))); |
| 196 } | 197 } |
| 197 | 198 |
| 198 void SharedWorkerHost::AllowFileSystemResponse( | 199 void SharedWorkerHost::AllowFileSystemResponse( |
| 199 scoped_ptr<IPC::Message> reply_msg, | 200 std::unique_ptr<IPC::Message> reply_msg, |
| 200 bool allowed) { | 201 bool allowed) { |
| 201 WorkerProcessHostMsg_RequestFileSystemAccessSync::WriteReplyParams( | 202 WorkerProcessHostMsg_RequestFileSystemAccessSync::WriteReplyParams( |
| 202 reply_msg.get(), | 203 reply_msg.get(), |
| 203 allowed); | 204 allowed); |
| 204 Send(reply_msg.release()); | 205 Send(reply_msg.release()); |
| 205 } | 206 } |
| 206 | 207 |
| 207 void SharedWorkerHost::AllowIndexedDB(const GURL& url, | 208 void SharedWorkerHost::AllowIndexedDB(const GURL& url, |
| 208 const base::string16& name, | 209 const base::string16& name, |
| 209 bool* result) { | 210 bool* result) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 int message_port_id) { | 311 int message_port_id) { |
| 311 for (FilterList::iterator i = filters_.begin(); i != filters_.end(); ++i) { | 312 for (FilterList::iterator i = filters_.begin(); i != filters_.end(); ++i) { |
| 312 if (i->filter() == filter && i->route_id() == route_id) { | 313 if (i->filter() == filter && i->route_id() == route_id) { |
| 313 i->set_message_port_id(message_port_id); | 314 i->set_message_port_id(message_port_id); |
| 314 return; | 315 return; |
| 315 } | 316 } |
| 316 } | 317 } |
| 317 } | 318 } |
| 318 | 319 |
| 319 } // namespace content | 320 } // namespace content |
| OLD | NEW |