| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_HOST_HOST_CONFIG_H_ | 5 #ifndef REMOTING_HOST_HOST_CONFIG_H_ |
| 6 #define REMOTING_HOST_HOST_CONFIG_H_ | 6 #define REMOTING_HOST_HOST_CONFIG_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 | 11 |
| 12 class Task; | |
| 13 | |
| 14 namespace remoting { | 12 namespace remoting { |
| 15 | 13 |
| 16 // Following constants define names for configuration parameters. | 14 // Following constants define names for configuration parameters. |
| 17 | 15 |
| 18 // Status of the host, whether it is enabled or disabled. | 16 // Status of the host, whether it is enabled or disabled. |
| 19 extern const char kHostEnabledConfigPath[]; | 17 extern const char kHostEnabledConfigPath[]; |
| 20 // Login used to authenticate in XMPP network. | 18 // Login used to authenticate in XMPP network. |
| 21 extern const char kXmppLoginConfigPath[]; | 19 extern const char kXmppLoginConfigPath[]; |
| 22 // Auth token used to authenticate to XMPP network. | 20 // Auth token used to authenticate to XMPP network. |
| 23 extern const char kXmppAuthTokenConfigPath[]; | 21 extern const char kXmppAuthTokenConfigPath[]; |
| 24 // Auth service used to authenticate to XMPP network. | 22 // Auth service used to authenticate to XMPP network. |
| 25 extern const char kXmppAuthServiceConfigPath[]; | 23 extern const char kXmppAuthServiceConfigPath[]; |
| 26 // Unique identifier of the host used to register the host in directory. | 24 // Unique identifier of the host used to register the host in directory. |
| 27 // Normally a random UUID. | 25 // Normally a random UUID. |
| 28 extern const char kHostIdConfigPath[]; | 26 extern const char kHostIdConfigPath[]; |
| 29 // Readable host name. | 27 // Readable host name. |
| 30 extern const char kHostNameConfigPath[]; | 28 extern const char kHostNameConfigPath[]; |
| 31 // Private keys used for host authentication. | 29 // Private keys used for host authentication. |
| 32 extern const char kPrivateKeyConfigPath[]; | 30 extern const char kPrivateKeyConfigPath[]; |
| 33 | 31 |
| 34 // HostConfig interace provides read-only access to host configuration. | 32 // HostConfig interace provides read-only access to host configuration. |
| 35 class HostConfig : public base::RefCountedThreadSafe<HostConfig> { | 33 class HostConfig : public base::RefCountedThreadSafe<HostConfig> { |
| 36 public: | 34 public: |
| 37 HostConfig() { }; | 35 HostConfig() {} |
| 38 virtual ~HostConfig() { } | 36 virtual ~HostConfig() {} |
| 39 | 37 |
| 40 virtual bool GetString(const std::string& path, std::string* out_value) = 0; | 38 virtual bool GetString(const std::string& path, std::string* out_value) = 0; |
| 41 virtual bool GetBoolean(const std::string& path, bool* out_value) = 0; | 39 virtual bool GetBoolean(const std::string& path, bool* out_value) = 0; |
| 42 | 40 |
| 43 DISALLOW_COPY_AND_ASSIGN(HostConfig); | 41 DISALLOW_COPY_AND_ASSIGN(HostConfig); |
| 44 }; | 42 }; |
| 45 | 43 |
| 46 // MutableHostConfig extends HostConfig for mutability. | 44 // MutableHostConfig extends HostConfig for mutability. |
| 47 class MutableHostConfig : public HostConfig { | 45 class MutableHostConfig : public HostConfig { |
| 48 public: | 46 public: |
| 49 MutableHostConfig() { }; | 47 MutableHostConfig() {} |
| 50 | 48 |
| 51 // SetString() updates specified config value. Save() must be called to save | 49 // SetString() updates specified config value. Save() must be called to save |
| 52 // the changes on the disk. | 50 // the changes on the disk. |
| 53 virtual void SetString(const std::string& path, | 51 virtual void SetString(const std::string& path, |
| 54 const std::string& in_value) = 0; | 52 const std::string& in_value) = 0; |
| 55 virtual void SetBoolean(const std::string& path, bool in_value) = 0; | 53 virtual void SetBoolean(const std::string& path, bool in_value) = 0; |
| 56 | 54 |
| 57 // Save's changes. | 55 // Save's changes. |
| 58 virtual void Save() = 0; | 56 virtual void Save() = 0; |
| 59 | 57 |
| 60 DISALLOW_COPY_AND_ASSIGN(MutableHostConfig); | 58 DISALLOW_COPY_AND_ASSIGN(MutableHostConfig); |
| 61 }; | 59 }; |
| 62 | 60 |
| 63 } // namespace remoting | 61 } // namespace remoting |
| 64 | 62 |
| 65 #endif // REMOTING_HOST_HOST_CONFIG_H_ | 63 #endif // REMOTING_HOST_HOST_CONFIG_H_ |
| OLD | NEW |