blob: 158a4005f16e3ba9c40c9868098d963f1c3bdde4 [file] [log] [blame]
zijiehe21d8d3912016-11-18 20:14:211// 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
zijiehef38c9722017-02-08 02:05:295#ifndef REMOTING_HOST_HOST_SESSION_OPTIONS_H_
6#define REMOTING_HOST_HOST_SESSION_OPTIONS_H_
zijiehe21d8d3912016-11-18 20:14:217
8#include <map>
9#include <string>
10
11#include "base/macros.h"
12#include "base/optional.h"
13
14namespace remoting {
zijiehe21d8d3912016-11-18 20:14:2115
16// Session based host options sending from client. This class parses and stores
17// session configuration from client side to control the behavior of other host
18// components.
19class HostSessionOptions final {
20 public:
21 HostSessionOptions();
22 ~HostSessionOptions();
23
zijiehef38c9722017-02-08 02:05:2924 HostSessionOptions(const std::string& parameter);
25
zijiehe21d8d3912016-11-18 20:14:2126 // Appends one key-value pair into current instance.
27 void Append(const std::string& key, const std::string& value);
28
29 // Retrieves the value of |key|. Returns a true Optional if |key| has been
30 // found, value of the Optional wil be set to corresponding value.
31 base::Optional<std::string> Get(const std::string& key) const;
32
33 // Returns a string to represent current instance. Consumers can rebuild an
34 // exactly same instance with Import() function.
35 std::string Export() const;
36
37 // Overwrite current instance with |parameter|, which is a string returned by
38 // Export() function. So a parent process can send HostSessionOptions to a
39 // child process.
40 void Import(const std::string& parameter);
41
42 private:
43 std::map<std::string, std::string> options_;
44
45 HostSessionOptions(HostSessionOptions&&) = delete;
46 HostSessionOptions& operator=(HostSessionOptions&&) = delete;
47 DISALLOW_COPY_AND_ASSIGN(HostSessionOptions);
48};
49
zijiehe21d8d3912016-11-18 20:14:2150} // namespace remoting
51
zijiehef38c9722017-02-08 02:05:2952#endif // REMOTING_HOST_HOST_SESSION_OPTIONS_H_