Chromium Code Reviews| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 connect_info->auth = auth_required ? | 297 connect_info->auth = auth_required ? |
| 298 cast_channel::CHANNEL_AUTH_TYPE_SSL_VERIFIED : | 298 cast_channel::CHANNEL_AUTH_TYPE_SSL_VERIFIED : |
| 299 cast_channel::CHANNEL_AUTH_TYPE_SSL; | 299 cast_channel::CHANNEL_AUTH_TYPE_SSL; |
| 300 return true; | 300 return true; |
| 301 } | 301 } |
| 302 | 302 |
| 303 net::IPEndPoint* CastChannelOpenFunction::ParseConnectInfo( | 303 net::IPEndPoint* CastChannelOpenFunction::ParseConnectInfo( |
| 304 const ConnectInfo& connect_info) { | 304 const ConnectInfo& connect_info) { |
| 305 net::IPAddressNumber ip_address; | 305 net::IPAddressNumber ip_address; |
| 306 CHECK(net::ParseIPLiteralToNumber(connect_info.ip_address, &ip_address)); | 306 CHECK(net::ParseIPLiteralToNumber(connect_info.ip_address, &ip_address)); |
| 307 return new net::IPEndPoint(ip_address, connect_info.port); | 307 return new net::IPEndPoint(ip_address, |
| 308 static_cast<uint16>(connect_info.port)); | |
|
Peter Kasting
2014/11/12 23:54:26
This is guaranteed to be safe due to having previo
| |
| 308 } | 309 } |
| 309 | 310 |
| 310 bool CastChannelOpenFunction::PrePrepare() { | 311 bool CastChannelOpenFunction::PrePrepare() { |
| 311 api_ = CastChannelAPI::Get(browser_context()); | 312 api_ = CastChannelAPI::Get(browser_context()); |
| 312 return CastChannelAsyncApiFunction::PrePrepare(); | 313 return CastChannelAsyncApiFunction::PrePrepare(); |
| 313 } | 314 } |
| 314 | 315 |
| 315 bool CastChannelOpenFunction::Prepare() { | 316 bool CastChannelOpenFunction::Prepare() { |
| 316 params_ = Open::Params::Create(*args_); | 317 params_ = Open::Params::Create(*args_); |
| 317 EXTENSION_FUNCTION_VALIDATE(params_.get()); | 318 EXTENSION_FUNCTION_VALIDATE(params_.get()); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 531 std::string& signature = params_->signature; | 532 std::string& signature = params_->signature; |
| 532 if (signature.empty() || keys.empty() || | 533 if (signature.empty() || keys.empty() || |
| 533 !cast_channel::SetTrustedCertificateAuthorities(keys, signature)) { | 534 !cast_channel::SetTrustedCertificateAuthorities(keys, signature)) { |
| 534 SetError("Unable to set authority keys."); | 535 SetError("Unable to set authority keys."); |
| 535 } | 536 } |
| 536 | 537 |
| 537 AsyncWorkCompleted(); | 538 AsyncWorkCompleted(); |
| 538 } | 539 } |
| 539 | 540 |
| 540 } // namespace extensions | 541 } // namespace extensions |
| OLD | NEW |