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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 VLOG(1) << "Sending message " << ParamToString(message_info) | 178 VLOG(1) << "Sending message " << ParamToString(message_info) |
179 << " to channel " << ParamToString(channel_info); | 179 << " to channel " << ParamToString(channel_info); |
180 scoped_ptr<Event> event(new Event(OnMessage::kEventName, results.Pass())); | 180 scoped_ptr<Event> event(new Event(OnMessage::kEventName, results.Pass())); |
181 extensions::EventRouter::Get(browser_context_) | 181 extensions::EventRouter::Get(browser_context_) |
182 ->DispatchEventToExtension(socket->owner_extension_id(), event.Pass()); | 182 ->DispatchEventToExtension(socket->owner_extension_id(), event.Pass()); |
183 } | 183 } |
184 | 184 |
185 CastChannelAPI::~CastChannelAPI() {} | 185 CastChannelAPI::~CastChannelAPI() {} |
186 | 186 |
187 CastChannelAsyncApiFunction::CastChannelAsyncApiFunction() | 187 CastChannelAsyncApiFunction::CastChannelAsyncApiFunction() |
188 : manager_(NULL), error_(cast_channel::CHANNEL_ERROR_NONE) { } | 188 : manager_(nullptr), error_(cast_channel::CHANNEL_ERROR_NONE) { |
| 189 } |
189 | 190 |
190 CastChannelAsyncApiFunction::~CastChannelAsyncApiFunction() { } | 191 CastChannelAsyncApiFunction::~CastChannelAsyncApiFunction() { } |
191 | 192 |
192 bool CastChannelAsyncApiFunction::PrePrepare() { | 193 bool CastChannelAsyncApiFunction::PrePrepare() { |
193 manager_ = ApiResourceManager<CastSocket>::Get(browser_context()); | 194 manager_ = ApiResourceManager<CastSocket>::Get(browser_context()); |
194 return true; | 195 return true; |
195 } | 196 } |
196 | 197 |
197 bool CastChannelAsyncApiFunction::Respond() { | 198 bool CastChannelAsyncApiFunction::Respond() { |
198 return error_ == cast_channel::CHANNEL_ERROR_NONE; | 199 return error_ == cast_channel::CHANNEL_ERROR_NONE; |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 VLOG(1) << "CastChannelCloseFunction::OnClose result = " << result; | 467 VLOG(1) << "CastChannelCloseFunction::OnClose result = " << result; |
467 int channel_id = params_->channel.channel_id; | 468 int channel_id = params_->channel.channel_id; |
468 CastSocket* socket = GetSocket(channel_id); | 469 CastSocket* socket = GetSocket(channel_id); |
469 if (result < 0 || !socket) { | 470 if (result < 0 || !socket) { |
470 SetResultFromError(channel_id, | 471 SetResultFromError(channel_id, |
471 cast_channel::CHANNEL_ERROR_SOCKET_ERROR); | 472 cast_channel::CHANNEL_ERROR_SOCKET_ERROR); |
472 } else { | 473 } else { |
473 SetResultFromSocket(*socket); | 474 SetResultFromSocket(*socket); |
474 // This will delete |socket|. | 475 // This will delete |socket|. |
475 RemoveSocket(channel_id); | 476 RemoveSocket(channel_id); |
476 socket = NULL; | 477 socket = nullptr; |
477 } | 478 } |
478 AsyncWorkCompleted(); | 479 AsyncWorkCompleted(); |
479 } | 480 } |
480 | 481 |
481 CastChannelGetLogsFunction::CastChannelGetLogsFunction() { | 482 CastChannelGetLogsFunction::CastChannelGetLogsFunction() { |
482 } | 483 } |
483 | 484 |
484 CastChannelGetLogsFunction::~CastChannelGetLogsFunction() { | 485 CastChannelGetLogsFunction::~CastChannelGetLogsFunction() { |
485 } | 486 } |
486 | 487 |
(...skipping 16 matching lines...) Expand all Loading... |
503 } else { | 504 } else { |
504 SetError("Unable to get logs."); | 505 SetError("Unable to get logs."); |
505 } | 506 } |
506 | 507 |
507 api_->GetLogger()->Reset(); | 508 api_->GetLogger()->Reset(); |
508 | 509 |
509 AsyncWorkCompleted(); | 510 AsyncWorkCompleted(); |
510 } | 511 } |
511 | 512 |
512 } // namespace extensions | 513 } // namespace extensions |
OLD | NEW |