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> |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <utility> | 13 #include <utility> |
| 14 #include <vector> |
14 | 15 |
15 #include "base/json/json_writer.h" | 16 #include "base/json/json_writer.h" |
16 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
17 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
19 #include "base/time/default_clock.h" | 20 #include "base/time/default_clock.h" |
20 #include "base/values.h" | 21 #include "base/values.h" |
21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
22 #include "extensions/browser/api/cast_channel/cast_message_util.h" | 23 #include "extensions/browser/api/cast_channel/cast_message_util.h" |
23 #include "extensions/browser/api/cast_channel/cast_socket.h" | 24 #include "extensions/browser/api/cast_channel/cast_socket.h" |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 bool CastChannelGetLogsFunction::Prepare() { | 473 bool CastChannelGetLogsFunction::Prepare() { |
473 return true; | 474 return true; |
474 } | 475 } |
475 | 476 |
476 void CastChannelGetLogsFunction::AsyncWorkStart() { | 477 void CastChannelGetLogsFunction::AsyncWorkStart() { |
477 DCHECK(api_); | 478 DCHECK(api_); |
478 | 479 |
479 size_t length = 0; | 480 size_t length = 0; |
480 std::unique_ptr<char[]> out = api_->GetLogger()->GetLogs(&length); | 481 std::unique_ptr<char[]> out = api_->GetLogger()->GetLogs(&length); |
481 if (out.get()) { | 482 if (out.get()) { |
482 SetResult(base::MakeUnique<base::BinaryValue>(std::move(out), length)); | 483 SetResult(base::MakeUnique<base::BinaryValue>( |
| 484 std::vector<char>(out.get(), out.get() + length))); |
483 } else { | 485 } else { |
484 SetError("Unable to get logs."); | 486 SetError("Unable to get logs."); |
485 } | 487 } |
486 | 488 |
487 api_->GetLogger()->Reset(); | 489 api_->GetLogger()->Reset(); |
488 | 490 |
489 AsyncWorkCompleted(); | 491 AsyncWorkCompleted(); |
490 } | 492 } |
491 | 493 |
492 CastChannelOpenFunction::CastMessageHandler::CastMessageHandler( | 494 CastChannelOpenFunction::CastMessageHandler::CastMessageHandler( |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 return true; | 559 return true; |
558 } | 560 } |
559 | 561 |
560 void CastChannelSetAuthorityKeysFunction::AsyncWorkStart() { | 562 void CastChannelSetAuthorityKeysFunction::AsyncWorkStart() { |
561 // TODO(eroman): crbug.com/601171: Delete this once the API is | 563 // TODO(eroman): crbug.com/601171: Delete this once the API is |
562 // removed. It is currently a no-op. | 564 // removed. It is currently a no-op. |
563 AsyncWorkCompleted(); | 565 AsyncWorkCompleted(); |
564 } | 566 } |
565 | 567 |
566 } // namespace extensions | 568 } // namespace extensions |
OLD | NEW |