Chromium Code Reviews| 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_.empty()) { | |
|
Sergey Ulanov
2017/01/05 20:45:06
I suggest adding a separate flag to indicate that
Hzj_jie
2017/01/05 23:37:27
Done.
| |
| 29 return; | |
| 30 } | |
| 31 | |
| 32 const XmlElement* configuration = attachments.FirstNamed( | |
| 33 QName(kChromotingXmlNamespace, "host-configuration")); | |
| 34 if (!configuration) { | |
| 35 return; | |
| 36 } | |
| 37 | |
| 38 configuration_ = configuration->BodyText(); | |
| 39 } | |
| 40 | |
| 41 const std::string& HostExperimentSessionPlugin::configuration() const { | |
| 42 return configuration_; | |
| 43 } | |
| 44 | |
| 45 } // namespace remoting | |
| OLD | NEW |