diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-28 01:07:30 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-28 01:07:30 +0000 |
commit | 0c5d116c708e90fecbb54d8da6d81cbf5383d5e9 (patch) | |
tree | e3d6567a2e7f74ec900f93969ae90317f67a2f24 /remoting/host/plugin/daemon_controller.h | |
parent | 98d1a133f99c1e632c63a2601b67fdbbd4fb246c (diff) | |
download | chromium_src-0c5d116c708e90fecbb54d8da6d81cbf5383d5e9.zip chromium_src-0c5d116c708e90fecbb54d8da6d81cbf5383d5e9.tar.gz chromium_src-0c5d116c708e90fecbb54d8da6d81cbf5383d5e9.tar.bz2 |
Update DaemonController interface to support changing host configuration.
Also cleaned up Start()/Stop() methods so that they don't return any
value - it will not be possible to return result synchronously anyway.
Review URL: https://chromiumcodereview.appspot.com/9836067
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129328 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/plugin/daemon_controller.h')
-rw-r--r-- | remoting/host/plugin/daemon_controller.h | 54 |
1 files changed, 38 insertions, 16 deletions
diff --git a/remoting/host/plugin/daemon_controller.h b/remoting/host/plugin/daemon_controller.h index b1d46e7..9144204 100644 --- a/remoting/host/plugin/daemon_controller.h +++ b/remoting/host/plugin/daemon_controller.h @@ -7,6 +7,13 @@ #include <string> +#include "base/callback_forward.h" +#include "base/memory/scoped_ptr.h" + +namespace base { +class DictionaryValue; +} // namespace base + namespace remoting { class DaemonController { @@ -38,29 +45,47 @@ class DaemonController { STATE_UNKNOWN = 4 }; + // The callback for GetConfig(). |config| is set to NULL in case of + // an error. Otherwise it is a dictionary that contains the + // following values: host_id and xmpp_login, which may be empty if + // the host is not initialized yet. The config must not contain any + // security sensitive information, such as authentication tokens and + // private keys. + typedef base::Callback<void (scoped_ptr<base::DictionaryValue> config)> + GetConfigCallback; + virtual ~DaemonController() {} // Return the "installed/running" state of the daemon process. + // + // TODO(sergeyu): This method is called synchronously from the + // webapp. In most cases it requires IO operations, so it may block + // the user interface. Replace it with asynchronous notifications, + // e.g. with StartStateNotifications()/StopStateNotifications() methods. virtual State GetState() = 0; - // Set the PIN for accessing this host, which should be expressed as a - // UTF8-encoded string. It is permitted to call SetPin when the daemon - // is already running. Returns true if successful, or false if the PIN - // does not satisfy complexity requirements. - // - // TODO(jamiewalch): More state-setting methods needed here. Sufficient - // state must be set prior to calling any other DaemonController method; - // this should be documented for each method. - virtual bool SetPin(const std::string& pin) = 0; + // Queries current host configuration. The |callback| is called + // after configuration is read. + virtual void GetConfig(const GetConfigCallback& callback) = 0; // Start the daemon process. Since this may require that the daemon be // downloaded and installed, Start may return before the daemon process // is actually running--poll GetState until the state is STATE_STARTED // or STATE_START_FAILED. // - // Start fails synchronously and returns false if sufficient state has - // not been set, including a valid PIN. - virtual bool Start() = 0; + // TODO(sergeyu): This method writes config and starts the host - + // these two steps are merged for simplicity. Consider splitting it + // into SetConfig() and Start() once we have basic host setup flow + // working. + virtual void SetConfigAndStart(scoped_ptr<base::DictionaryValue> config) = 0; + + // Set the PIN for accessing this host, which should be expressed as a + // UTF8-encoded string. It is permitted to call SetPin when the daemon + // is already running. Returns true if successful, or false if the PIN + // does not satisfy complexity requirements. + // + // TODO(sergeyu): Add callback to be called after PIN is updated. + virtual void SetPin(const std::string& pin) = 0; // Stop the daemon process. It is permitted to call Stop while the daemon // process is being installed, in which case the installation should be @@ -68,10 +93,7 @@ class DaemonController { // daemon process is not started automatically upon successful installation. // As with Start, Stop may return before the operation is complete--poll // GetState until the state is STATE_STOPPED. - // - // Stop fails synchronously and returns false if sufficient state has not - // been set. - virtual bool Stop() = 0; + virtual void Stop() = 0; static DaemonController* Create(); }; |