Chromium Code Reviews| 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 #ifndef REMOTING_PROTOCOL_HOST_SESSION_OPTIONS_H_ | 5 #ifndef REMOTING_PROTOCOL_HOST_SESSION_OPTIONS_H_ |
|
Sergey Ulanov
2017/01/07 01:23:09
s/PROTOCOL/HOST/
Hzj_jie
2017/01/08 23:48:48
Done.
| |
| 6 #define REMOTING_PROTOCOL_HOST_SESSION_OPTIONS_H_ | 6 #define REMOTING_PROTOCOL_HOST_SESSION_OPTIONS_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/optional.h" | 12 #include "base/optional.h" |
| 13 | 13 |
| 14 namespace remoting { | 14 namespace remoting { |
| 15 namespace protocol { | |
| 16 | 15 |
| 17 // Session based host options sending from client. This class parses and stores | 16 // Session based host options sending from client. This class parses and stores |
| 18 // session configuration from client side to control the behavior of other host | 17 // session configuration from client side to control the behavior of other host |
| 19 // components. | 18 // components. |
| 20 class HostSessionOptions final { | 19 class HostSessionOptions final { |
|
Sergey Ulanov
2017/01/07 01:23:09
Can this class be used on the client side as well?
Hzj_jie
2017/01/08 23:48:49
No, clients won't create or parse the host experim
| |
| 21 public: | 20 public: |
| 22 HostSessionOptions(); | 21 HostSessionOptions(); |
| 23 ~HostSessionOptions(); | 22 ~HostSessionOptions(); |
| 24 | 23 |
| 24 HostSessionOptions(const std::string& parameter); | |
| 25 | |
| 25 // Appends one key-value pair into current instance. | 26 // Appends one key-value pair into current instance. |
| 26 void Append(const std::string& key, const std::string& value); | 27 void Append(const std::string& key, const std::string& value); |
| 27 | 28 |
| 28 // Retrieves the value of |key|. Returns a true Optional if |key| has been | 29 // Retrieves the value of |key|. Returns a true Optional if |key| has been |
| 29 // found, value of the Optional wil be set to corresponding value. | 30 // found, value of the Optional wil be set to corresponding value. |
| 30 base::Optional<std::string> Get(const std::string& key) const; | 31 base::Optional<std::string> Get(const std::string& key) const; |
| 31 | 32 |
| 32 // Returns a string to represent current instance. Consumers can rebuild an | 33 // Returns a string to represent current instance. Consumers can rebuild an |
| 33 // exactly same instance with Import() function. | 34 // exactly same instance with Import() function. |
| 34 std::string Export() const; | 35 std::string Export() const; |
| 35 | 36 |
| 36 // Overwrite current instance with |parameter|, which is a string returned by | 37 // Overwrite current instance with |parameter|, which is a string returned by |
| 37 // Export() function. So a parent process can send HostSessionOptions to a | 38 // Export() function. So a parent process can send HostSessionOptions to a |
| 38 // child process. | 39 // child process. |
| 39 void Import(const std::string& parameter); | 40 void Import(const std::string& parameter); |
| 40 | 41 |
| 41 private: | 42 private: |
| 42 std::map<std::string, std::string> options_; | 43 std::map<std::string, std::string> options_; |
| 43 | 44 |
| 44 HostSessionOptions(HostSessionOptions&&) = delete; | 45 HostSessionOptions(HostSessionOptions&&) = delete; |
| 45 HostSessionOptions& operator=(HostSessionOptions&&) = delete; | 46 HostSessionOptions& operator=(HostSessionOptions&&) = delete; |
| 46 DISALLOW_COPY_AND_ASSIGN(HostSessionOptions); | 47 DISALLOW_COPY_AND_ASSIGN(HostSessionOptions); |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 } // namespace protocol | |
| 50 } // namespace remoting | 50 } // namespace remoting |
| 51 | 51 |
| 52 #endif // REMOTING_PROTOCOL_HOST_SESSION_OPTIONS_H_ | 52 #endif // REMOTING_PROTOCOL_HOST_SESSION_OPTIONS_H_ |
| OLD | NEW |