| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 using cast_channel::ReadyState; | 52 using cast_channel::ReadyState; |
| 53 using content::BrowserThread; | 53 using content::BrowserThread; |
| 54 | 54 |
| 55 namespace { | 55 namespace { |
| 56 | 56 |
| 57 // T is an extension dictionary (MessageInfo or ChannelInfo) | 57 // T is an extension dictionary (MessageInfo or ChannelInfo) |
| 58 template <class T> | 58 template <class T> |
| 59 std::string ParamToString(const T& info) { | 59 std::string ParamToString(const T& info) { |
| 60 scoped_ptr<base::DictionaryValue> dict = info.ToValue(); | 60 scoped_ptr<base::DictionaryValue> dict = info.ToValue(); |
| 61 std::string out; | 61 std::string out; |
| 62 base::JSONWriter::Write(dict.get(), &out); | 62 base::JSONWriter::Write(*dict, &out); |
| 63 return out; | 63 return out; |
| 64 } | 64 } |
| 65 | 65 |
| 66 // Fills |channel_info| from the destination and state of |socket|. | 66 // Fills |channel_info| from the destination and state of |socket|. |
| 67 void FillChannelInfo(const CastSocket& socket, ChannelInfo* channel_info) { | 67 void FillChannelInfo(const CastSocket& socket, ChannelInfo* channel_info) { |
| 68 DCHECK(channel_info); | 68 DCHECK(channel_info); |
| 69 channel_info->channel_id = socket.id(); | 69 channel_info->channel_id = socket.id(); |
| 70 channel_info->url = socket.cast_url(); | 70 channel_info->url = socket.cast_url(); |
| 71 const net::IPEndPoint& ip_endpoint = socket.ip_endpoint(); | 71 const net::IPEndPoint& ip_endpoint = socket.ip_endpoint(); |
| 72 channel_info->connect_info.ip_address = ip_endpoint.ToStringWithoutPort(); | 72 channel_info->connect_info.ip_address = ip_endpoint.ToStringWithoutPort(); |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 std::string& signature = params_->signature; | 637 std::string& signature = params_->signature; |
| 638 if (signature.empty() || keys.empty() || | 638 if (signature.empty() || keys.empty() || |
| 639 !cast_channel::SetTrustedCertificateAuthorities(keys, signature)) { | 639 !cast_channel::SetTrustedCertificateAuthorities(keys, signature)) { |
| 640 SetError("Unable to set authority keys."); | 640 SetError("Unable to set authority keys."); |
| 641 } | 641 } |
| 642 | 642 |
| 643 AsyncWorkCompleted(); | 643 AsyncWorkCompleted(); |
| 644 } | 644 } |
| 645 | 645 |
| 646 } // namespace extensions | 646 } // namespace extensions |
| OLD | NEW |