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" |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/time/default_tick_clock.h" | 14 #include "base/time/default_tick_clock.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 17 #include "extensions/browser/api/cast_channel/cast_auth_util.h" |
17 #include "extensions/browser/api/cast_channel/cast_socket.h" | 18 #include "extensions/browser/api/cast_channel/cast_socket.h" |
18 #include "extensions/browser/api/cast_channel/logger.h" | 19 #include "extensions/browser/api/cast_channel/logger.h" |
19 #include "extensions/browser/event_router.h" | 20 #include "extensions/browser/event_router.h" |
20 #include "extensions/common/api/cast_channel/logging.pb.h" | 21 #include "extensions/common/api/cast_channel/logging.pb.h" |
21 #include "net/base/ip_endpoint.h" | 22 #include "net/base/ip_endpoint.h" |
22 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
23 #include "net/base/net_util.h" | 24 #include "net/base/net_util.h" |
24 #include "url/gurl.h" | 25 #include "url/gurl.h" |
25 | 26 |
26 // Default timeout interval for connection setup. | 27 // Default timeout interval for connection setup. |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 SetResult(new base::BinaryValue(out.Pass(), length)); | 504 SetResult(new base::BinaryValue(out.Pass(), length)); |
504 } else { | 505 } else { |
505 SetError("Unable to get logs."); | 506 SetError("Unable to get logs."); |
506 } | 507 } |
507 | 508 |
508 api_->GetLogger()->Reset(); | 509 api_->GetLogger()->Reset(); |
509 | 510 |
510 AsyncWorkCompleted(); | 511 AsyncWorkCompleted(); |
511 } | 512 } |
512 | 513 |
| 514 CastChannelSetAuthorityKeysFunction::CastChannelSetAuthorityKeysFunction() { |
| 515 } |
| 516 |
| 517 CastChannelSetAuthorityKeysFunction::~CastChannelSetAuthorityKeysFunction() { |
| 518 } |
| 519 |
| 520 bool CastChannelSetAuthorityKeysFunction::Prepare() { |
| 521 params_ = cast_channel::SetAuthorityKeys::Params::Create(*args_); |
| 522 EXTENSION_FUNCTION_VALIDATE(params_.get()); |
| 523 return true; |
| 524 } |
| 525 |
| 526 void CastChannelSetAuthorityKeysFunction::AsyncWorkStart() { |
| 527 std::string& keys = params_->keys; |
| 528 std::string& signature = params_->signature; |
| 529 if (signature.empty() || keys.empty() || |
| 530 !cast_channel::SetTrustedCertificateAuthorities(keys, signature)) { |
| 531 SetError("Unable to set authority keys."); |
| 532 } |
| 533 |
| 534 AsyncWorkCompleted(); |
| 535 } |
| 536 |
513 } // namespace extensions | 537 } // namespace extensions |
OLD | NEW |