diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-17 23:43:00 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-17 23:43:00 +0000 |
commit | 7620735be42ebc236d2da42d64f22dc5dedd01f9 (patch) | |
tree | baf0e6311b84830cd76df764e73e9aacfeb65e3e /remoting/host/host_config.h | |
parent | f90ab58c11abf783c850c632f9b0467f968e4045 (diff) | |
download | chromium_src-7620735be42ebc236d2da42d64f22dc5dedd01f9.zip chromium_src-7620735be42ebc236d2da42d64f22dc5dedd01f9.tar.gz chromium_src-7620735be42ebc236d2da42d64f22dc5dedd01f9.tar.bz2 |
JSON based host config storage implemented. Python script for host registration.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/2804007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50166 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/host_config.h')
-rw-r--r-- | remoting/host/host_config.h | 97 |
1 files changed, 43 insertions, 54 deletions
diff --git a/remoting/host/host_config.h b/remoting/host/host_config.h index b0eb382..7897538 100644 --- a/remoting/host/host_config.h +++ b/remoting/host/host_config.h @@ -9,69 +9,58 @@ #include "base/ref_counted.h" +class Task; + namespace remoting { -// HostConfig class implements container for all host settings. +// Following constants define names for configuration parameters. + +// Login used to authenticate in XMPP network. +extern const std::wstring kXmppLoginConfigPath; +// Auth token used to authenticate in XMPP network. +extern const std::wstring kXmppAuthTokenConfigPath; +// Unique identifier of the host used to register the host in directory. +// Normally a random UUID. +extern const std::wstring kHostIdConfigPath; +// Readable host name. +extern const std::wstring kHostNameConfigPath; +// Public key used by the host for authentication. +extern const std::wstring kPublicKeyConfigPath; + +// TODO(sergeyu): Add a property for private key. + +// HostConfig interace provides read-only access to host configuration. class HostConfig : public base::RefCountedThreadSafe<HostConfig> { public: - HostConfig() { } - - // Login used to authenticate in XMPP network. - const std::string& xmpp_login() const { - return xmpp_login_; - } - void set_xmpp_login(const std::string& xmpp_login) { - xmpp_login_ = xmpp_login; - } - - // Auth token used to authenticate in XMPP network. - const std::string& xmpp_auth_token() const { - return xmpp_auth_token_; - } - void set_xmpp_auth_token(const std::string& xmpp_auth_token) { - xmpp_auth_token_ = xmpp_auth_token; - } - - // Unique identifier of the host used to register the host in directory. - // Normally a random UUID. - const std::string& host_id() const { - return host_id_; - } - void set_host_id(const std::string& host_id) { - host_id_ = host_id; - } - - // Public key used by the host for authentication. - // TODO(sergeyu): Do we need to use other type to store public key? E.g. - // DataBuffer? Revisit this when public key generation is implemented. - const std::string& public_key() const { - return public_key_; - } - void set_public_key(const std::string& public_key) { - public_key_ = public_key; - } - - // TODO(sergeyu): Add a property for private key. - - private: - std::string xmpp_login_; - std::string xmpp_auth_token_; - std::string host_id_; - std::string public_key_; + HostConfig() { }; + virtual ~HostConfig() { } + + virtual bool GetString(const std::wstring& path, + std::wstring* out_value) = 0; + virtual bool GetString(const std::wstring& path, + std::string* out_value) = 0; DISALLOW_COPY_AND_ASSIGN(HostConfig); }; -// Interface for host configuration storage provider. -class HostConfigStorage { - // Load() and Save() are used to load/save settings to/from permanent - // storage. For example FileHostConfig stores all settings in a file. - // Simularly RegistryHostConfig stores settings in windows registry. - // Both methods return false if operation has failed, true otherwise. - virtual bool Load(HostConfig* config) = 0; - virtual bool Save(const HostConfig& config) = 0; +// MutableHostConfig extends HostConfig for mutability. +class MutableHostConfig : public HostConfig { + public: + MutableHostConfig() { }; + + // Update() must be used to update config values. + // It acquires lock, calls the specified task, releases the lock and + // then schedules the config to be written to storage. + virtual void Update(Task* task) = 0; + + // SetString() updates specified config value. This methods must only + // be called from task specified in Update(). + virtual void SetString(const std::wstring& path, + const std::wstring& in_value) = 0; + virtual void SetString(const std::wstring& path, + const std::string& in_value) = 0; - DISALLOW_COPY_AND_ASSIGN(HostConfigStorage); + DISALLOW_COPY_AND_ASSIGN(MutableHostConfig); }; } // namespace remoting |