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 "remoting/protocol/content_description.h" | 5 #include "remoting/protocol/content_description.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "remoting/base/constants.h" | 9 #include "remoting/base/constants.h" |
10 #include "remoting/protocol/authenticator.h" | 10 #include "remoting/protocol/authenticator.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 ContentDescription::ContentDescription( | 153 ContentDescription::ContentDescription( |
154 scoped_ptr<CandidateSessionConfig> config, | 154 scoped_ptr<CandidateSessionConfig> config, |
155 scoped_ptr<buzz::XmlElement> authenticator_message) | 155 scoped_ptr<buzz::XmlElement> authenticator_message) |
156 : candidate_config_(config.Pass()), | 156 : candidate_config_(config.Pass()), |
157 authenticator_message_(authenticator_message.Pass()) { | 157 authenticator_message_(authenticator_message.Pass()) { |
158 } | 158 } |
159 | 159 |
160 ContentDescription::~ContentDescription() { } | 160 ContentDescription::~ContentDescription() { } |
161 | 161 |
| 162 ContentDescription* ContentDescription::Copy() const { |
| 163 if (!candidate_config_.get() || !authenticator_message_.get()) { |
| 164 return NULL; |
| 165 } |
| 166 scoped_ptr<XmlElement> message(new XmlElement(*authenticator_message_)); |
| 167 return new ContentDescription(candidate_config_->Clone(), message.Pass()); |
| 168 } |
| 169 |
162 // ToXml() creates content description for chromoting session. The | 170 // ToXml() creates content description for chromoting session. The |
163 // description looks as follows: | 171 // description looks as follows: |
164 // <description xmlns="google:remoting"> | 172 // <description xmlns="google:remoting"> |
165 // <control transport="stream" version="1" /> | 173 // <control transport="stream" version="1" /> |
166 // <event transport="datagram" version="1" /> | 174 // <event transport="datagram" version="1" /> |
167 // <video transport="srtp" codec="vp8" version="1" /> | 175 // <video transport="srtp" codec="vp8" version="1" /> |
168 // <authentication> | 176 // <authentication> |
169 // Message created by Authenticator implementation. | 177 // Message created by Authenticator implementation. |
170 // </authentication> | 178 // </authentication> |
171 // </description> | 179 // </description> |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 authenticator_message.reset(new XmlElement(*child)); | 261 authenticator_message.reset(new XmlElement(*child)); |
254 | 262 |
255 return new ContentDescription(config.Pass(), authenticator_message.Pass()); | 263 return new ContentDescription(config.Pass(), authenticator_message.Pass()); |
256 } | 264 } |
257 LOG(ERROR) << "Invalid description: " << element->Str(); | 265 LOG(ERROR) << "Invalid description: " << element->Str(); |
258 return NULL; | 266 return NULL; |
259 } | 267 } |
260 | 268 |
261 } // namespace protocol | 269 } // namespace protocol |
262 } // namespace remoting | 270 } // namespace remoting |
OLD | NEW |