| Index: remoting/host/setup/daemon_controller.h
|
| diff --git a/remoting/host/setup/daemon_controller.h b/remoting/host/setup/daemon_controller.h
|
| index 9bc3b3323c59336553728c69cf351e0fa97fca83..88d34c1dd3a2726c9f0337102cff3d2be9add4d1 100644
|
| --- a/remoting/host/setup/daemon_controller.h
|
| +++ b/remoting/host/setup/daemon_controller.h
|
| @@ -17,6 +17,10 @@ class DictionaryValue;
|
| class SingleThreadTaskRunner;
|
| } // namespace base
|
|
|
| +namespace tracked_objects {
|
| +class Location;
|
| +} // namespace tracked_objects
|
| +
|
| namespace remoting {
|
|
|
| class AutoThread;
|
| @@ -46,24 +50,6 @@ class DaemonController : public base::RefCountedThreadSafe<DaemonController> {
|
| STATE_UNKNOWN = 6
|
| };
|
|
|
| - // Enum used for completion callback.
|
| - enum AsyncResult {
|
| - RESULT_OK = 0,
|
| -
|
| - // The operation has FAILED.
|
| - RESULT_FAILED = 1,
|
| -
|
| - // User has cancelled the action (e.g. rejected UAC prompt).
|
| - // TODO(sergeyu): Current implementations don't return this value.
|
| - RESULT_CANCELLED = 2,
|
| -
|
| - // Failed to access host directory.
|
| - RESULT_FAILED_DIRECTORY = 3
|
| -
|
| - // TODO(sergeyu): Add more error codes when we know how to handle
|
| - // them in the webapp.
|
| - };
|
| -
|
| // Callback type for GetConfig(). If the host is configured then a dictionary
|
| // is returned containing host_id and xmpp_login, with security-sensitive
|
| // fields filtered out. An empty dictionary is returned if the host is not
|
| @@ -71,9 +57,10 @@ class DaemonController : public base::RefCountedThreadSafe<DaemonController> {
|
| typedef base::Callback<void (scoped_ptr<base::DictionaryValue> config)>
|
| GetConfigCallback;
|
|
|
| - // Callback used for asynchronous operations, e.g. when
|
| - // starting/stopping the service.
|
| - typedef base::Callback<void (AsyncResult result)> CompletionCallback;
|
| + // Callback used to indicate failure of an asynchronous operation.
|
| + typedef base::Callback<void (
|
| + const std::string& error_message,
|
| + const tracked_objects::Location& location)> ErrorCallback;
|
|
|
| struct UsageStatsConsent {
|
| // Indicates whether crash dump reporting is supported by the host.
|
| @@ -112,25 +99,30 @@ class DaemonController : public base::RefCountedThreadSafe<DaemonController> {
|
| virtual scoped_ptr<base::DictionaryValue> GetConfig() = 0;
|
|
|
| // Starts the daemon process. This may require that the daemon be
|
| - // downloaded and installed. |done| is invoked on the calling thread when
|
| - // the operation is completed.
|
| + // downloaded and installed. |on_done| or |on_error| is invoked on
|
| + // the calling thread when the operation is completed.
|
| virtual void SetConfigAndStart(
|
| scoped_ptr<base::DictionaryValue> config,
|
| bool consent,
|
| - const CompletionCallback& done) = 0;
|
| + const base::Closure& on_done,
|
| + const ErrorCallback& on_error) = 0;
|
|
|
| // Updates current host configuration with the values specified in
|
| // |config|. Any value in the existing configuration that isn't specified in
|
| // |config| is preserved. |config| must not contain host_id or xmpp_login
|
| - // values, because implementations of this method cannot change them. |done|
|
| - // is invoked on the calling thread when the operation is completed.
|
| + // values, because implementations of this method cannot change them.
|
| + // |on_done| or |on_error| is invoked on the calling thread when the
|
| + // operation is completed.
|
| virtual void UpdateConfig(
|
| scoped_ptr<base::DictionaryValue> config,
|
| - const CompletionCallback& done) = 0;
|
| + const base::Closure& on_done,
|
| + const ErrorCallback& on_error) = 0;
|
|
|
| - // Stops the daemon process. |done| is invoked on the calling thread when
|
| - // the operation is completed.
|
| - virtual void Stop(const CompletionCallback& done) = 0;
|
| + // Stops the daemon process. |on_done| or |on_error| is invoked on the
|
| + // calling thread when the operation is completed.
|
| + virtual void Stop(
|
| + const base::Closure& on_done,
|
| + const ErrorCallback& on_error) = 0;
|
|
|
| // Get the user's consent to crash reporting.
|
| virtual UsageStatsConsent GetUsageStatsConsent() = 0;
|
| @@ -163,7 +155,8 @@ class DaemonController : public base::RefCountedThreadSafe<DaemonController> {
|
| // working.
|
| void SetConfigAndStart(scoped_ptr<base::DictionaryValue> config,
|
| bool consent,
|
| - const CompletionCallback& done);
|
| + const base::Closure& on_done,
|
| + const ErrorCallback& on_error);
|
|
|
| // Updates current host configuration with the values specified in
|
| // |config|. Changes must take effect before the call completes.
|
| @@ -171,7 +164,8 @@ class DaemonController : public base::RefCountedThreadSafe<DaemonController> {
|
| // is preserved. |config| must not contain host_id or xmpp_login values,
|
| // because implementations of this method cannot change them.
|
| void UpdateConfig(scoped_ptr<base::DictionaryValue> config,
|
| - const CompletionCallback& done);
|
| + const base::Closure& on_done,
|
| + const ErrorCallback& on_error);
|
|
|
| // Stop the daemon process. It is permitted to call Stop while the daemon
|
| // process is being installed, in which case the installation should be
|
| @@ -179,7 +173,8 @@ class DaemonController : public base::RefCountedThreadSafe<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.
|
| - void Stop(const CompletionCallback& done);
|
| + void Stop(const base::Closure& on_done,
|
| + const ErrorCallback& on_error);
|
|
|
| // Get the user's consent to crash reporting.
|
| void GetUsageStatsConsent(const GetUsageStatsConsentCallback& done);
|
| @@ -192,22 +187,28 @@ class DaemonController : public base::RefCountedThreadSafe<DaemonController> {
|
| void DoGetConfig(const GetConfigCallback& done);
|
| void DoSetConfigAndStart(scoped_ptr<base::DictionaryValue> config,
|
| bool consent,
|
| - const CompletionCallback& done);
|
| + const base::Closure& on_done,
|
| + const ErrorCallback& on_error);
|
| void DoUpdateConfig(scoped_ptr<base::DictionaryValue> config,
|
| - const CompletionCallback& done);
|
| - void DoStop(const CompletionCallback& done);
|
| + const base::Closure& on_done,
|
| + const ErrorCallback& on_error);
|
| + void DoStop(const base::Closure& on_done,
|
| + const ErrorCallback& on_error);
|
| void DoGetUsageStatsConsent(const GetUsageStatsConsentCallback& done);
|
|
|
| // "Trampoline" callbacks that schedule the next pending request and then
|
| // invoke the original caller-supplied callback.
|
| - void InvokeCompletionCallbackAndScheduleNext(
|
| - const CompletionCallback& done,
|
| - AsyncResult result);
|
| + void InvokeSuccessCallbackAndScheduleNext(
|
| + const base::Closure& callback);
|
| + void InvokeErrorCallbackAndScheduleNext(
|
| + const ErrorCallback& callback,
|
| + const std::string& error_message,
|
| + const tracked_objects::Location& location);
|
| void InvokeConfigCallbackAndScheduleNext(
|
| - const GetConfigCallback& done,
|
| + const GetConfigCallback& callback,
|
| scoped_ptr<base::DictionaryValue> config);
|
| void InvokeConsentCallbackAndScheduleNext(
|
| - const GetUsageStatsConsentCallback& done,
|
| + const GetUsageStatsConsentCallback& callback,
|
| const UsageStatsConsent& consent);
|
|
|
| // Queue management methods.
|
|
|