| 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 "chrome/renderer/media/cast_transport_sender_ipc.h" | 5 #include "chrome/renderer/media/cast_transport_sender_ipc.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
| 9 #include "chrome/common/cast_messages.h" | 9 #include "chrome/common/cast_messages.h" |
| 10 #include "chrome/renderer/media/cast_ipc_dispatcher.h" | 10 #include "chrome/renderer/media/cast_ipc_dispatcher.h" |
| 11 #include "ipc/ipc_channel_proxy.h" | 11 #include "ipc/ipc_channel_proxy.h" |
| 12 #include "media/cast/cast_sender.h" | 12 #include "media/cast/cast_sender.h" |
| 13 | 13 |
| 14 CastTransportSenderIPC::ClientCallbacks::ClientCallbacks() {} | 14 CastTransportSenderIPC::ClientCallbacks::ClientCallbacks() {} |
| 15 CastTransportSenderIPC::ClientCallbacks::~ClientCallbacks() {} | 15 CastTransportSenderIPC::ClientCallbacks::~ClientCallbacks() {} |
| 16 | 16 |
| 17 CastTransportSenderIPC::CastTransportSenderIPC( | 17 CastTransportSenderIPC::CastTransportSenderIPC( |
| 18 const net::IPEndPoint& remote_end_point, | 18 const net::IPEndPoint& remote_end_point, |
| 19 scoped_ptr<base::DictionaryValue> options, |
| 19 const media::cast::CastTransportStatusCallback& status_cb, | 20 const media::cast::CastTransportStatusCallback& status_cb, |
| 20 const media::cast::BulkRawEventsCallback& raw_events_cb) | 21 const media::cast::BulkRawEventsCallback& raw_events_cb) |
| 21 : status_callback_(status_cb), raw_events_callback_(raw_events_cb) { | 22 : status_callback_(status_cb), raw_events_callback_(raw_events_cb) { |
| 22 if (CastIPCDispatcher::Get()) { | 23 if (CastIPCDispatcher::Get()) { |
| 23 channel_id_ = CastIPCDispatcher::Get()->AddSender(this); | 24 channel_id_ = CastIPCDispatcher::Get()->AddSender(this); |
| 24 } | 25 } |
| 25 Send(new CastHostMsg_New(channel_id_, remote_end_point)); | 26 Send(new CastHostMsg_New(channel_id_, remote_end_point, *options)); |
| 26 } | 27 } |
| 27 | 28 |
| 28 CastTransportSenderIPC::~CastTransportSenderIPC() { | 29 CastTransportSenderIPC::~CastTransportSenderIPC() { |
| 29 Send(new CastHostMsg_Delete(channel_id_)); | 30 Send(new CastHostMsg_Delete(channel_id_)); |
| 30 if (CastIPCDispatcher::Get()) { | 31 if (CastIPCDispatcher::Get()) { |
| 31 CastIPCDispatcher::Get()->RemoveSender(channel_id_); | 32 CastIPCDispatcher::Get()->RemoveSender(channel_id_); |
| 32 } | 33 } |
| 33 } | 34 } |
| 34 | 35 |
| 35 void CastTransportSenderIPC::InitializeAudio( | 36 void CastTransportSenderIPC::InitializeAudio( |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 it->second.cast_message_cb.Run(cast_message); | 114 it->second.cast_message_cb.Run(cast_message); |
| 114 } | 115 } |
| 115 | 116 |
| 116 void CastTransportSenderIPC::Send(IPC::Message* message) { | 117 void CastTransportSenderIPC::Send(IPC::Message* message) { |
| 117 if (CastIPCDispatcher::Get()) { | 118 if (CastIPCDispatcher::Get()) { |
| 118 CastIPCDispatcher::Get()->Send(message); | 119 CastIPCDispatcher::Get()->Send(message); |
| 119 } else { | 120 } else { |
| 120 delete message; | 121 delete message; |
| 121 } | 122 } |
| 122 } | 123 } |
| OLD | NEW |