| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 std::string result; | 66 std::string result; |
| 67 base::JSONWriter::Write(value, &result); | 67 base::JSONWriter::Write(value, &result); |
| 68 return result; | 68 return result; |
| 69 } | 69 } |
| 70 | 70 |
| 71 bool DeserializeP2PCandidate(const std::string& candidate_str, | 71 bool DeserializeP2PCandidate(const std::string& candidate_str, |
| 72 cricket::Candidate* candidate) { | 72 cricket::Candidate* candidate) { |
| 73 std::unique_ptr<base::Value> value( | 73 std::unique_ptr<base::Value> value( |
| 74 base::JSONReader::Read(candidate_str, base::JSON_ALLOW_TRAILING_COMMAS)); | 74 base::JSONReader::Read(candidate_str, base::JSON_ALLOW_TRAILING_COMMAS)); |
| 75 if (!value.get() || !value->IsType(base::Value::TYPE_DICTIONARY)) { | 75 if (!value.get() || !value->IsType(base::Value::Type::DICTIONARY)) { |
| 76 return false; | 76 return false; |
| 77 } | 77 } |
| 78 | 78 |
| 79 base::DictionaryValue* dic_value = | 79 base::DictionaryValue* dic_value = |
| 80 static_cast<base::DictionaryValue*>(value.get()); | 80 static_cast<base::DictionaryValue*>(value.get()); |
| 81 | 81 |
| 82 std::string ip; | 82 std::string ip; |
| 83 int port = 0; | 83 int port = 0; |
| 84 std::string type; | 84 std::string type; |
| 85 std::string protocol; | 85 std::string protocol; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 104 candidate->set_protocol(protocol); | 104 candidate->set_protocol(protocol); |
| 105 candidate->set_username(username); | 105 candidate->set_username(username); |
| 106 candidate->set_password(password); | 106 candidate->set_password(password); |
| 107 candidate->set_preference(static_cast<float>(preference)); | 107 candidate->set_preference(static_cast<float>(preference)); |
| 108 candidate->set_generation(generation); | 108 candidate->set_generation(generation); |
| 109 | 109 |
| 110 return true; | 110 return true; |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace jingle_glue | 113 } // namespace jingle_glue |
| OLD | NEW |