| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ref_counted.h" | 10 #include "base/ref_counted.h" |
| 11 | 11 |
| 12 class Task; | 12 class Task; |
| 13 | 13 |
| 14 namespace remoting { | 14 namespace remoting { |
| 15 | 15 |
| 16 // Following constants define names for configuration parameters. | 16 // Following constants define names for configuration parameters. |
| 17 | 17 |
| 18 // Login used to authenticate in XMPP network. | 18 // Login used to authenticate in XMPP network. |
| 19 extern const wchar_t* kXmppLoginConfigPath; | 19 extern const char* kXmppLoginConfigPath; |
| 20 // Auth token used to authenticate in XMPP network. | 20 // Auth token used to authenticate in XMPP network. |
| 21 extern const wchar_t* kXmppAuthTokenConfigPath; | 21 extern const char* kXmppAuthTokenConfigPath; |
| 22 // Unique identifier of the host used to register the host in directory. | 22 // Unique identifier of the host used to register the host in directory. |
| 23 // Normally a random UUID. | 23 // Normally a random UUID. |
| 24 extern const wchar_t* kHostIdConfigPath; | 24 extern const char* kHostIdConfigPath; |
| 25 // Readable host name. | 25 // Readable host name. |
| 26 extern const wchar_t* kHostNameConfigPath; | 26 extern const char* kHostNameConfigPath; |
| 27 // Private keys used for host authentication. | 27 // Private keys used for host authentication. |
| 28 extern const wchar_t* kPrivateKeyConfigPath; | 28 extern const char* kPrivateKeyConfigPath; |
| 29 | 29 |
| 30 // HostConfig interace provides read-only access to host configuration. | 30 // HostConfig interace provides read-only access to host configuration. |
| 31 class HostConfig : public base::RefCountedThreadSafe<HostConfig> { | 31 class HostConfig : public base::RefCountedThreadSafe<HostConfig> { |
| 32 public: | 32 public: |
| 33 HostConfig() { }; | 33 HostConfig() { }; |
| 34 virtual ~HostConfig() { } | 34 virtual ~HostConfig() { } |
| 35 | 35 |
| 36 virtual bool GetString(const std::wstring& path, | 36 virtual bool GetString(const std::string& path, std::string* out_value) = 0; |
| 37 std::wstring* out_value) = 0; | |
| 38 virtual bool GetString(const std::wstring& path, | |
| 39 std::string* out_value) = 0; | |
| 40 | 37 |
| 41 DISALLOW_COPY_AND_ASSIGN(HostConfig); | 38 DISALLOW_COPY_AND_ASSIGN(HostConfig); |
| 42 }; | 39 }; |
| 43 | 40 |
| 44 // MutableHostConfig extends HostConfig for mutability. | 41 // MutableHostConfig extends HostConfig for mutability. |
| 45 class MutableHostConfig : public HostConfig { | 42 class MutableHostConfig : public HostConfig { |
| 46 public: | 43 public: |
| 47 MutableHostConfig() { }; | 44 MutableHostConfig() { }; |
| 48 | 45 |
| 49 // Update() must be used to update config values. | 46 // Update() must be used to update config values. |
| 50 // It acquires lock, calls the specified task, releases the lock and | 47 // It acquires lock, calls the specified task, releases the lock and |
| 51 // then schedules the config to be written to storage. | 48 // then schedules the config to be written to storage. |
| 52 virtual void Update(Task* task) = 0; | 49 virtual void Update(Task* task) = 0; |
| 53 | 50 |
| 54 // SetString() updates specified config value. This methods must only | 51 // SetString() updates specified config value. This methods must only |
| 55 // be called from task specified in Update(). | 52 // be called from task specified in Update(). |
| 56 virtual void SetString(const std::wstring& path, | 53 virtual void SetString(const std::string& path, |
| 57 const std::wstring& in_value) = 0; | |
| 58 virtual void SetString(const std::wstring& path, | |
| 59 const std::string& in_value) = 0; | 54 const std::string& in_value) = 0; |
| 60 | 55 |
| 61 DISALLOW_COPY_AND_ASSIGN(MutableHostConfig); | 56 DISALLOW_COPY_AND_ASSIGN(MutableHostConfig); |
| 62 }; | 57 }; |
| 63 | 58 |
| 64 } // namespace remoting | 59 } // namespace remoting |
| 65 | 60 |
| 66 #endif // REMOTING_HOST_HOST_CONFIG_H_ | 61 #endif // REMOTING_HOST_HOST_CONFIG_H_ |
| OLD | NEW |