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 "extensions/browser/api/cast_channel/cast_channel_api.h" | 5 #include "extensions/browser/api/cast_channel/cast_channel_api.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 ? *connect_info.timeout.get() | 313 ? *connect_info.timeout.get() |
314 : kDefaultConnectTimeoutMillis), | 314 : kDefaultConnectTimeoutMillis), |
315 liveness_timeout_ > base::TimeDelta(), api_->GetLogger(), | 315 liveness_timeout_ > base::TimeDelta(), api_->GetLogger(), |
316 connect_info.capabilities.get() ? *connect_info.capabilities.get() | 316 connect_info.capabilities.get() ? *connect_info.capabilities.get() |
317 : CastDeviceCapability::NONE); | 317 : CastDeviceCapability::NONE); |
318 } | 318 } |
319 new_channel_id_ = AddSocket(socket); | 319 new_channel_id_ = AddSocket(socket); |
320 api_->GetLogger()->LogNewSocketEvent(*socket); | 320 api_->GetLogger()->LogNewSocketEvent(*socket); |
321 | 321 |
322 // Construct read delegates. | 322 // Construct read delegates. |
323 scoped_ptr<core_api::cast_channel::CastTransport::Delegate> delegate( | 323 scoped_ptr<api::cast_channel::CastTransport::Delegate> delegate( |
324 make_scoped_ptr(new CastMessageHandler( | 324 make_scoped_ptr(new CastMessageHandler( |
325 base::Bind(&CastChannelAPI::SendEvent, api_->AsWeakPtr()), socket, | 325 base::Bind(&CastChannelAPI::SendEvent, api_->AsWeakPtr()), socket, |
326 api_->GetLogger()))); | 326 api_->GetLogger()))); |
327 if (socket->keep_alive()) { | 327 if (socket->keep_alive()) { |
328 // Wrap read delegate in a KeepAliveDelegate for timeout handling. | 328 // Wrap read delegate in a KeepAliveDelegate for timeout handling. |
329 core_api::cast_channel::KeepAliveDelegate* keep_alive = | 329 api::cast_channel::KeepAliveDelegate* keep_alive = |
330 new core_api::cast_channel::KeepAliveDelegate( | 330 new api::cast_channel::KeepAliveDelegate( |
331 socket, api_->GetLogger(), delegate.Pass(), ping_interval_, | 331 socket, api_->GetLogger(), delegate.Pass(), ping_interval_, |
332 liveness_timeout_); | 332 liveness_timeout_); |
333 scoped_ptr<base::Timer> injected_timer = | 333 scoped_ptr<base::Timer> injected_timer = |
334 api_->GetInjectedTimeoutTimerForTest(); | 334 api_->GetInjectedTimeoutTimerForTest(); |
335 if (injected_timer) { | 335 if (injected_timer) { |
336 keep_alive->SetTimersForTest( | 336 keep_alive->SetTimersForTest( |
337 make_scoped_ptr(new base::Timer(false, false)), | 337 make_scoped_ptr(new base::Timer(false, false)), |
338 injected_timer.Pass()); | 338 injected_timer.Pass()); |
339 } | 339 } |
340 delegate.reset(keep_alive); | 340 delegate.reset(keep_alive); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 std::string& signature = params_->signature; | 561 std::string& signature = params_->signature; |
562 if (signature.empty() || keys.empty() || | 562 if (signature.empty() || keys.empty() || |
563 !cast_channel::SetTrustedCertificateAuthorities(keys, signature)) { | 563 !cast_channel::SetTrustedCertificateAuthorities(keys, signature)) { |
564 SetError("Unable to set authority keys."); | 564 SetError("Unable to set authority keys."); |
565 } | 565 } |
566 | 566 |
567 AsyncWorkCompleted(); | 567 AsyncWorkCompleted(); |
568 } | 568 } |
569 | 569 |
570 } // namespace extensions | 570 } // namespace extensions |
OLD | NEW |