| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "remoting/host/host_experiment_session_plugin.h" | |
| 6 | |
| 7 #include "remoting/base/constants.h" | |
| 8 #include "remoting/host/host_attributes.h" | |
| 9 | |
| 10 namespace remoting { | |
| 11 | |
| 12 using buzz::QName; | |
| 13 using buzz::XmlElement; | |
| 14 | |
| 15 std::unique_ptr<XmlElement> HostExperimentSessionPlugin::GetNextMessage() { | |
| 16 if (attributes_sent_) { | |
| 17 return nullptr; | |
| 18 } | |
| 19 attributes_sent_ = true; | |
| 20 std::unique_ptr<XmlElement> attributes( | |
| 21 new XmlElement(QName(kChromotingXmlNamespace, "host-attributes"))); | |
| 22 attributes->SetBodyText(GetHostAttributes()); | |
| 23 return attributes; | |
| 24 } | |
| 25 | |
| 26 void HostExperimentSessionPlugin::OnIncomingMessage( | |
| 27 const XmlElement& attachments) { | |
| 28 if (configuration_received_) { | |
| 29 return; | |
| 30 } | |
| 31 | |
| 32 const XmlElement* configuration = attachments.FirstNamed( | |
| 33 QName(kChromotingXmlNamespace, "host-configuration")); | |
| 34 if (!configuration) { | |
| 35 return; | |
| 36 } | |
| 37 | |
| 38 configuration_received_ = true; | |
| 39 configuration_ = configuration->BodyText(); | |
| 40 } | |
| 41 | |
| 42 bool HostExperimentSessionPlugin::configuration_received() const { | |
| 43 return configuration_received_; | |
| 44 } | |
| 45 | |
| 46 const std::string& HostExperimentSessionPlugin::configuration() const { | |
| 47 return configuration_; | |
| 48 } | |
| 49 | |
| 50 } // namespace remoting | |
| OLD | NEW |