| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 connect_info->auth = auth_required ? | 274 connect_info->auth = auth_required ? |
| 275 cast_channel::CHANNEL_AUTH_TYPE_SSL_VERIFIED : | 275 cast_channel::CHANNEL_AUTH_TYPE_SSL_VERIFIED : |
| 276 cast_channel::CHANNEL_AUTH_TYPE_SSL; | 276 cast_channel::CHANNEL_AUTH_TYPE_SSL; |
| 277 return true; | 277 return true; |
| 278 } | 278 } |
| 279 | 279 |
| 280 net::IPEndPoint* CastChannelOpenFunction::ParseConnectInfo( | 280 net::IPEndPoint* CastChannelOpenFunction::ParseConnectInfo( |
| 281 const ConnectInfo& connect_info) { | 281 const ConnectInfo& connect_info) { |
| 282 net::IPAddressNumber ip_address; | 282 net::IPAddressNumber ip_address; |
| 283 CHECK(net::ParseIPLiteralToNumber(connect_info.ip_address, &ip_address)); | 283 CHECK(net::ParseIPLiteralToNumber(connect_info.ip_address, &ip_address)); |
| 284 return new net::IPEndPoint(ip_address, connect_info.port); | 284 return new net::IPEndPoint(ip_address, |
| 285 static_cast<uint16>(connect_info.port)); |
| 285 } | 286 } |
| 286 | 287 |
| 287 bool CastChannelOpenFunction::PrePrepare() { | 288 bool CastChannelOpenFunction::PrePrepare() { |
| 288 api_ = CastChannelAPI::Get(browser_context()); | 289 api_ = CastChannelAPI::Get(browser_context()); |
| 289 return CastChannelAsyncApiFunction::PrePrepare(); | 290 return CastChannelAsyncApiFunction::PrePrepare(); |
| 290 } | 291 } |
| 291 | 292 |
| 292 bool CastChannelOpenFunction::Prepare() { | 293 bool CastChannelOpenFunction::Prepare() { |
| 293 params_ = Open::Params::Create(*args_); | 294 params_ = Open::Params::Create(*args_); |
| 294 EXTENSION_FUNCTION_VALIDATE(params_.get()); | 295 EXTENSION_FUNCTION_VALIDATE(params_.get()); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 std::string& signature = params_->signature; | 562 std::string& signature = params_->signature; |
| 562 if (signature.empty() || keys.empty() || | 563 if (signature.empty() || keys.empty() || |
| 563 !cast_channel::SetTrustedCertificateAuthorities(keys, signature)) { | 564 !cast_channel::SetTrustedCertificateAuthorities(keys, signature)) { |
| 564 SetError("Unable to set authority keys."); | 565 SetError("Unable to set authority keys."); |
| 565 } | 566 } |
| 566 | 567 |
| 567 AsyncWorkCompleted(); | 568 AsyncWorkCompleted(); |
| 568 } | 569 } |
| 569 | 570 |
| 570 } // namespace extensions | 571 } // namespace extensions |
| OLD | NEW |