Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "jingle/glue/utils.h" | 5 #include "jingle/glue/utils.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 net::IPAddressNumber address; | 35 net::IPAddressNumber address; |
| 36 address.resize(net::kIPv4AddressSize); | 36 address.resize(net::kIPv4AddressSize); |
| 37 memcpy(&address[0], &ip, net::kIPv4AddressSize); | 37 memcpy(&address[0], &ip, net::kIPv4AddressSize); |
| 38 *address_chrome = net::IPEndPoint(address, address_lj.port()); | 38 *address_chrome = net::IPEndPoint(address, address_lj.port()); |
| 39 return true; | 39 return true; |
| 40 } | 40 } |
| 41 | 41 |
| 42 std::string SerializeP2PCandidate(const cricket::Candidate& candidate) { | 42 std::string SerializeP2PCandidate(const cricket::Candidate& candidate) { |
| 43 // TODO(sergeyu): Use SDP to format candidates? | 43 // TODO(sergeyu): Use SDP to format candidates? |
| 44 DictionaryValue value; | 44 DictionaryValue value; |
| 45 value.SetString("ip", candidate.address().IPAsString()); | 45 value.SetString("ip", candidate.address().HostAsURIString()); |
|
Sergey Ulanov
2012/05/09 18:58:00
Please change this to "ipaddr().ToString()" .
Mallinath (Gone from Chromium)
2012/05/09 22:04:22
Done.
| |
| 46 value.SetInteger("port", candidate.address().port()); | 46 value.SetInteger("port", candidate.address().port()); |
| 47 value.SetString("type", candidate.type()); | 47 value.SetString("type", candidate.type()); |
| 48 value.SetString("protocol", candidate.protocol()); | 48 value.SetString("protocol", candidate.protocol()); |
| 49 value.SetString("username", candidate.username()); | 49 value.SetString("username", candidate.username()); |
| 50 value.SetString("password", candidate.password()); | 50 value.SetString("password", candidate.password()); |
| 51 value.SetDouble("preference", candidate.preference()); | 51 value.SetDouble("preference", candidate.preference()); |
| 52 value.SetInteger("generation", candidate.generation()); | 52 value.SetInteger("generation", candidate.generation()); |
| 53 | 53 |
| 54 std::string result; | 54 std::string result; |
| 55 base::JSONWriter::Write(&value, &result); | 55 base::JSONWriter::Write(&value, &result); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 candidate->set_protocol(protocol); | 91 candidate->set_protocol(protocol); |
| 92 candidate->set_username(username); | 92 candidate->set_username(username); |
| 93 candidate->set_password(password); | 93 candidate->set_password(password); |
| 94 candidate->set_preference(static_cast<float>(preference)); | 94 candidate->set_preference(static_cast<float>(preference)); |
| 95 candidate->set_generation(generation); | 95 candidate->set_generation(generation); |
| 96 | 96 |
| 97 return true; | 97 return true; |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace jingle_glue | 100 } // namespace jingle_glue |
| OLD | NEW |