| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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/host/host_experiment_session_plugin.h" | 5 #include "remoting/host/host_experiment_servant.h" |
| 6 | 6 |
| 7 #include "remoting/base/constants.h" | 7 #include "remoting/base/constants.h" |
| 8 #include "remoting/host/host_attributes.h" | 8 #include "remoting/host/host_attributes.h" |
| 9 | 9 |
| 10 namespace remoting { | 10 namespace remoting { |
| 11 | 11 |
| 12 using buzz::QName; | 12 using buzz::QName; |
| 13 using buzz::XmlElement; | 13 using buzz::XmlElement; |
| 14 | 14 |
| 15 std::unique_ptr<XmlElement> HostExperimentSessionPlugin::GetNextMessage() { | 15 std::unique_ptr<XmlElement> HostExperimentServant::GetNextMessage() { |
| 16 if (attributes_sent_) { | 16 if (attributes_sent_) { |
| 17 return nullptr; | 17 return nullptr; |
| 18 } | 18 } |
| 19 attributes_sent_ = true; | 19 attributes_sent_ = true; |
| 20 std::unique_ptr<XmlElement> attributes( | 20 std::unique_ptr<XmlElement> attributes( |
| 21 new XmlElement(QName(kChromotingXmlNamespace, "host-attributes"))); | 21 new XmlElement(QName(kChromotingXmlNamespace, "host-attributes"))); |
| 22 attributes->SetBodyText(GetHostAttributes()); | 22 attributes->SetBodyText(GetHostAttributes()); |
| 23 return attributes; | 23 return attributes; |
| 24 } | 24 } |
| 25 | 25 |
| 26 void HostExperimentSessionPlugin::OnIncomingMessage( | 26 void HostExperimentServant::OnIncomingMessage(const XmlElement& attachments) { |
| 27 const XmlElement& attachments) { | |
| 28 if (configuration_received_) { | 27 if (configuration_received_) { |
| 29 return; | 28 return; |
| 30 } | 29 } |
| 31 | 30 |
| 32 const XmlElement* configuration = attachments.FirstNamed( | 31 const XmlElement* configuration = attachments.FirstNamed( |
| 33 QName(kChromotingXmlNamespace, "host-configuration")); | 32 QName(kChromotingXmlNamespace, "host-configuration")); |
| 34 if (!configuration) { | 33 if (!configuration) { |
| 35 return; | 34 return; |
| 36 } | 35 } |
| 37 | 36 |
| 38 configuration_received_ = true; | 37 configuration_received_ = true; |
| 39 configuration_ = configuration->BodyText(); | 38 configuration_ = configuration->BodyText(); |
| 40 } | 39 } |
| 41 | 40 |
| 42 bool HostExperimentSessionPlugin::configuration_received() const { | 41 bool HostExperimentServant::configuration_received() const { |
| 43 return configuration_received_; | 42 return configuration_received_; |
| 44 } | 43 } |
| 45 | 44 |
| 46 const std::string& HostExperimentSessionPlugin::configuration() const { | 45 const std::string& HostExperimentServant::configuration() const { |
| 47 return configuration_; | 46 return configuration_; |
| 48 } | 47 } |
| 49 | 48 |
| 50 } // namespace remoting | 49 } // namespace remoting |
| OLD | NEW |