| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/service_worker/service_worker_provider_host.h" | 5 #include "content/browser/service_worker/service_worker_provider_host.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "content/browser/frame_host/frame_tree.h" | 8 #include "content/browser/frame_host/frame_tree.h" |
| 9 #include "content/browser/frame_host/frame_tree_node.h" | 9 #include "content/browser/frame_host/frame_tree_node.h" |
| 10 #include "content/browser/frame_host/render_frame_host_impl.h" | 10 #include "content/browser/frame_host/render_frame_host_impl.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 return false; | 269 return false; |
| 270 if (running_hosted_version_.get()) | 270 if (running_hosted_version_.get()) |
| 271 return false; | 271 return false; |
| 272 if (!registration || associated_registration_.get() || !allow_association_) | 272 if (!registration || associated_registration_.get() || !allow_association_) |
| 273 return false; | 273 return false; |
| 274 return true; | 274 return true; |
| 275 } | 275 } |
| 276 | 276 |
| 277 void ServiceWorkerProviderHost::PostMessage( | 277 void ServiceWorkerProviderHost::PostMessage( |
| 278 const base::string16& message, | 278 const base::string16& message, |
| 279 const std::vector<int>& sent_message_port_ids) { | 279 const std::vector<TransferredMessagePort>& sent_message_ports) { |
| 280 if (!dispatcher_host_) | 280 if (!dispatcher_host_) |
| 281 return; // Could be NULL in some tests. | 281 return; // Could be NULL in some tests. |
| 282 | 282 |
| 283 std::vector<int> new_routing_ids; | 283 std::vector<int> new_routing_ids; |
| 284 dispatcher_host_->message_port_message_filter()-> | 284 dispatcher_host_->message_port_message_filter()-> |
| 285 UpdateMessagePortsWithNewRoutes(sent_message_port_ids, | 285 UpdateMessagePortsWithNewRoutes(sent_message_ports, |
| 286 &new_routing_ids); | 286 &new_routing_ids); |
| 287 | 287 |
| 288 Send(new ServiceWorkerMsg_MessageToDocument( | 288 Send(new ServiceWorkerMsg_MessageToDocument( |
| 289 kDocumentMainThreadId, provider_id(), | 289 kDocumentMainThreadId, provider_id(), |
| 290 message, | 290 message, |
| 291 sent_message_port_ids, | 291 sent_message_ports, |
| 292 new_routing_ids)); | 292 new_routing_ids)); |
| 293 } | 293 } |
| 294 | 294 |
| 295 void ServiceWorkerProviderHost::Focus(const GetClientInfoCallback& callback) { | 295 void ServiceWorkerProviderHost::Focus(const GetClientInfoCallback& callback) { |
| 296 BrowserThread::PostTaskAndReplyWithResult( | 296 BrowserThread::PostTaskAndReplyWithResult( |
| 297 BrowserThread::UI, FROM_HERE, | 297 BrowserThread::UI, FROM_HERE, |
| 298 base::Bind(&FocusOnUIThread, | 298 base::Bind(&FocusOnUIThread, |
| 299 render_process_id_, | 299 render_process_id_, |
| 300 render_frame_id_), | 300 render_frame_id_), |
| 301 callback); | 301 callback); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 return context_ != NULL; | 510 return context_ != NULL; |
| 511 } | 511 } |
| 512 | 512 |
| 513 void ServiceWorkerProviderHost::Send(IPC::Message* message) const { | 513 void ServiceWorkerProviderHost::Send(IPC::Message* message) const { |
| 514 DCHECK(dispatcher_host_); | 514 DCHECK(dispatcher_host_); |
| 515 DCHECK(IsReadyToSendMessages()); | 515 DCHECK(IsReadyToSendMessages()); |
| 516 dispatcher_host_->Send(message); | 516 dispatcher_host_->Send(message); |
| 517 } | 517 } |
| 518 | 518 |
| 519 } // namespace content | 519 } // namespace content |
| OLD | NEW |