| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 } | 231 } |
| 232 | 232 |
| 233 CastSocket* CastChannelAsyncApiFunction::GetSocket(int channel_id) const { | 233 CastSocket* CastChannelAsyncApiFunction::GetSocket(int channel_id) const { |
| 234 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 234 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 235 return sockets_->Get(extension_->id(), channel_id); | 235 return sockets_->Get(extension_->id(), channel_id); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void CastChannelAsyncApiFunction::SetResultFromChannelInfo( | 238 void CastChannelAsyncApiFunction::SetResultFromChannelInfo( |
| 239 const ChannelInfo& channel_info) { | 239 const ChannelInfo& channel_info) { |
| 240 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 240 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 241 SetResult(channel_info.ToValue().release()); | 241 SetResult(channel_info.ToValue()); |
| 242 } | 242 } |
| 243 | 243 |
| 244 CastChannelOpenFunction::CastChannelOpenFunction() | 244 CastChannelOpenFunction::CastChannelOpenFunction() |
| 245 : new_channel_id_(0) { | 245 : new_channel_id_(0) { |
| 246 } | 246 } |
| 247 | 247 |
| 248 CastChannelOpenFunction::~CastChannelOpenFunction() { } | 248 CastChannelOpenFunction::~CastChannelOpenFunction() { } |
| 249 | 249 |
| 250 net::IPEndPoint* CastChannelOpenFunction::ParseConnectInfo( | 250 net::IPEndPoint* CastChannelOpenFunction::ParseConnectInfo( |
| 251 const ConnectInfo& connect_info) { | 251 const ConnectInfo& connect_info) { |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 bool CastChannelGetLogsFunction::Prepare() { | 473 bool CastChannelGetLogsFunction::Prepare() { |
| 474 return true; | 474 return true; |
| 475 } | 475 } |
| 476 | 476 |
| 477 void CastChannelGetLogsFunction::AsyncWorkStart() { | 477 void CastChannelGetLogsFunction::AsyncWorkStart() { |
| 478 DCHECK(api_); | 478 DCHECK(api_); |
| 479 | 479 |
| 480 size_t length = 0; | 480 size_t length = 0; |
| 481 std::unique_ptr<char[]> out = api_->GetLogger()->GetLogs(&length); | 481 std::unique_ptr<char[]> out = api_->GetLogger()->GetLogs(&length); |
| 482 if (out.get()) { | 482 if (out.get()) { |
| 483 SetResult(new base::BinaryValue(std::move(out), length)); | 483 SetResult(base::MakeUnique<base::BinaryValue>(std::move(out), length)); |
| 484 } else { | 484 } else { |
| 485 SetError("Unable to get logs."); | 485 SetError("Unable to get logs."); |
| 486 } | 486 } |
| 487 | 487 |
| 488 api_->GetLogger()->Reset(); | 488 api_->GetLogger()->Reset(); |
| 489 | 489 |
| 490 AsyncWorkCompleted(); | 490 AsyncWorkCompleted(); |
| 491 } | 491 } |
| 492 | 492 |
| 493 CastChannelOpenFunction::CastMessageHandler::CastMessageHandler( | 493 CastChannelOpenFunction::CastMessageHandler::CastMessageHandler( |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 return true; | 558 return true; |
| 559 } | 559 } |
| 560 | 560 |
| 561 void CastChannelSetAuthorityKeysFunction::AsyncWorkStart() { | 561 void CastChannelSetAuthorityKeysFunction::AsyncWorkStart() { |
| 562 // TODO(eroman): crbug.com/601171: Delete this once the API is | 562 // TODO(eroman): crbug.com/601171: Delete this once the API is |
| 563 // removed. It is currently a no-op. | 563 // removed. It is currently a no-op. |
| 564 AsyncWorkCompleted(); | 564 AsyncWorkCompleted(); |
| 565 } | 565 } |
| 566 | 566 |
| 567 } // namespace extensions | 567 } // namespace extensions |
| OLD | NEW |