| 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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 505 |
| 506 ChannelInfo channel_info; | 506 ChannelInfo channel_info; |
| 507 FillChannelInfo(*socket_, &channel_info); | 507 FillChannelInfo(*socket_, &channel_info); |
| 508 channel_info.error_state = error_state; | 508 channel_info.error_state = error_state; |
| 509 ErrorInfo error_info; | 509 ErrorInfo error_info; |
| 510 FillErrorInfo(error_state, logger_->GetLastErrors(socket_->id()), | 510 FillErrorInfo(error_state, logger_->GetLastErrors(socket_->id()), |
| 511 &error_info); | 511 &error_info); |
| 512 | 512 |
| 513 scoped_ptr<base::ListValue> results = | 513 scoped_ptr<base::ListValue> results = |
| 514 OnError::Create(channel_info, error_info); | 514 OnError::Create(channel_info, error_info); |
| 515 scoped_ptr<Event> event(new Event(OnError::kEventName, results.Pass())); | 515 scoped_ptr<Event> event( |
| 516 new Event(events::UNKNOWN, OnError::kEventName, results.Pass())); |
| 516 BrowserThread::PostTask( | 517 BrowserThread::PostTask( |
| 517 BrowserThread::UI, FROM_HERE, | 518 BrowserThread::UI, FROM_HERE, |
| 518 base::Bind(ui_dispatch_cb_, socket_->owner_extension_id(), | 519 base::Bind(ui_dispatch_cb_, socket_->owner_extension_id(), |
| 519 base::Passed(event.Pass()))); | 520 base::Passed(event.Pass()))); |
| 520 } | 521 } |
| 521 | 522 |
| 522 void CastChannelOpenFunction::CastMessageHandler::OnMessage( | 523 void CastChannelOpenFunction::CastMessageHandler::OnMessage( |
| 523 const CastMessage& message) { | 524 const CastMessage& message) { |
| 524 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 525 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 525 | 526 |
| 526 MessageInfo message_info; | 527 MessageInfo message_info; |
| 527 cast_channel::CastMessageToMessageInfo(message, &message_info); | 528 cast_channel::CastMessageToMessageInfo(message, &message_info); |
| 528 ChannelInfo channel_info; | 529 ChannelInfo channel_info; |
| 529 FillChannelInfo(*socket_, &channel_info); | 530 FillChannelInfo(*socket_, &channel_info); |
| 530 VLOG(1) << "Received message " << ParamToString(message_info) | 531 VLOG(1) << "Received message " << ParamToString(message_info) |
| 531 << " on channel " << ParamToString(channel_info); | 532 << " on channel " << ParamToString(channel_info); |
| 532 | 533 |
| 533 scoped_ptr<base::ListValue> results = | 534 scoped_ptr<base::ListValue> results = |
| 534 OnMessage::Create(channel_info, message_info); | 535 OnMessage::Create(channel_info, message_info); |
| 535 scoped_ptr<Event> event(new Event(OnMessage::kEventName, results.Pass())); | 536 scoped_ptr<Event> event( |
| 537 new Event(events::UNKNOWN, OnMessage::kEventName, results.Pass())); |
| 536 BrowserThread::PostTask( | 538 BrowserThread::PostTask( |
| 537 BrowserThread::UI, FROM_HERE, | 539 BrowserThread::UI, FROM_HERE, |
| 538 base::Bind(ui_dispatch_cb_, socket_->owner_extension_id(), | 540 base::Bind(ui_dispatch_cb_, socket_->owner_extension_id(), |
| 539 base::Passed(event.Pass()))); | 541 base::Passed(event.Pass()))); |
| 540 } | 542 } |
| 541 | 543 |
| 542 void CastChannelOpenFunction::CastMessageHandler::Start() { | 544 void CastChannelOpenFunction::CastMessageHandler::Start() { |
| 543 } | 545 } |
| 544 | 546 |
| 545 CastChannelSetAuthorityKeysFunction::CastChannelSetAuthorityKeysFunction() { | 547 CastChannelSetAuthorityKeysFunction::CastChannelSetAuthorityKeysFunction() { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 559 std::string& signature = params_->signature; | 561 std::string& signature = params_->signature; |
| 560 if (signature.empty() || keys.empty() || | 562 if (signature.empty() || keys.empty() || |
| 561 !cast_channel::SetTrustedCertificateAuthorities(keys, signature)) { | 563 !cast_channel::SetTrustedCertificateAuthorities(keys, signature)) { |
| 562 SetError("Unable to set authority keys."); | 564 SetError("Unable to set authority keys."); |
| 563 } | 565 } |
| 564 | 566 |
| 565 AsyncWorkCompleted(); | 567 AsyncWorkCompleted(); |
| 566 } | 568 } |
| 567 | 569 |
| 568 } // namespace extensions | 570 } // namespace extensions |
| OLD | NEW |