OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DAEMON_CONTROLLER_H_ | 5 #ifndef REMOTING_HOST_DAEMON_CONTROLLER_H_ |
6 #define REMOTING_HOST_DAEMON_CONTROLLER_H_ | 6 #define REMOTING_HOST_DAEMON_CONTROLLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 typedef base::Callback<void (scoped_ptr<base::DictionaryValue> config)> | 72 typedef base::Callback<void (scoped_ptr<base::DictionaryValue> config)> |
73 GetConfigCallback; | 73 GetConfigCallback; |
74 | 74 |
75 // Callback used for asynchronous operations, e.g. when | 75 // Callback used for asynchronous operations, e.g. when |
76 // starting/stopping the service. | 76 // starting/stopping the service. |
77 typedef base::Callback<void (AsyncResult result)> CompletionCallback; | 77 typedef base::Callback<void (AsyncResult result)> CompletionCallback; |
78 | 78 |
79 // Callback type for GetVersion(). | 79 // Callback type for GetVersion(). |
80 typedef base::Callback<void (const std::string&)> GetVersionCallback; | 80 typedef base::Callback<void (const std::string&)> GetVersionCallback; |
81 | 81 |
82 // Callback type for GetUsageStatsConsent(). | |
83 typedef base::Callback<void (bool, bool, bool)> GetUsageStatsConsentCallback; | |
Jamie
2012/06/21 18:47:52
I think this typedef could do with documentation t
alexeypa (please no reviews)
2012/06/21 23:30:26
Done.
| |
84 | |
82 virtual ~DaemonController() {} | 85 virtual ~DaemonController() {} |
83 | 86 |
84 // Return the "installed/running" state of the daemon process. | 87 // Return the "installed/running" state of the daemon process. |
85 // | 88 // |
86 // TODO(sergeyu): This method is called synchronously from the | 89 // TODO(sergeyu): This method is called synchronously from the |
87 // webapp. In most cases it requires IO operations, so it may block | 90 // webapp. In most cases it requires IO operations, so it may block |
88 // the user interface. Replace it with asynchronous notifications, | 91 // the user interface. Replace it with asynchronous notifications, |
89 // e.g. with StartStateNotifications()/StopStateNotifications() methods. | 92 // e.g. with StartStateNotifications()/StopStateNotifications() methods. |
90 virtual State GetState() = 0; | 93 virtual State GetState() = 0; |
91 | 94 |
92 // Queries current host configuration. The |callback| is called | 95 // Queries current host configuration. The |callback| is called |
93 // after the configuration is read, and any values that might be security | 96 // after the configuration is read, and any values that might be security |
94 // sensitive have been filtered out. | 97 // sensitive have been filtered out. |
95 virtual void GetConfig(const GetConfigCallback& callback) = 0; | 98 virtual void GetConfig(const GetConfigCallback& callback) = 0; |
96 | 99 |
97 // Start the daemon process. This may require that the daemon be | 100 // Start the daemon process. This may require that the daemon be |
98 // downloaded and installed. |done_callback| is called when the | 101 // downloaded and installed. |done_callback| is called when the |
99 // operation is finished or fails. | 102 // operation is finished or fails. |
100 // | 103 // |
101 // TODO(sergeyu): This method writes config and starts the host - | 104 // TODO(sergeyu): This method writes config and starts the host - |
102 // these two steps are merged for simplicity. Consider splitting it | 105 // these two steps are merged for simplicity. Consider splitting it |
103 // into SetConfig() and Start() once we have basic host setup flow | 106 // into SetConfig() and Start() once we have basic host setup flow |
104 // working. | 107 // working. |
105 virtual void SetConfigAndStart(scoped_ptr<base::DictionaryValue> config, | 108 virtual void SetConfigAndStart(scoped_ptr<base::DictionaryValue> config, |
106 const CompletionCallback& done_callback) = 0; | 109 bool consent, |
110 const CompletionCallback& done) = 0; | |
107 | 111 |
108 // Updates current host configuration with the values specified in | 112 // Updates current host configuration with the values specified in |
109 // |config|. Changes must take effect before the call completes. | 113 // |config|. Changes must take effect before the call completes. |
110 // Any value in the existing configuration that isn't specified in |config| | 114 // Any value in the existing configuration that isn't specified in |config| |
111 // is preserved. |config| must not contain host_id or xmpp_login values, | 115 // is preserved. |config| must not contain host_id or xmpp_login values, |
112 // because implementations of this method cannot change them. | 116 // because implementations of this method cannot change them. |
113 virtual void UpdateConfig(scoped_ptr<base::DictionaryValue> config, | 117 virtual void UpdateConfig(scoped_ptr<base::DictionaryValue> config, |
114 const CompletionCallback& done_callback) = 0; | 118 const CompletionCallback& done_callback) = 0; |
115 | 119 |
116 // Stop the daemon process. It is permitted to call Stop while the daemon | 120 // Stop the daemon process. It is permitted to call Stop while the daemon |
117 // process is being installed, in which case the installation should be | 121 // process is being installed, in which case the installation should be |
118 // aborted if possible; if not then it is sufficient to ensure that the | 122 // aborted if possible; if not then it is sufficient to ensure that the |
119 // daemon process is not started automatically upon successful installation. | 123 // daemon process is not started automatically upon successful installation. |
120 // As with Start, Stop may return before the operation is complete--poll | 124 // As with Start, Stop may return before the operation is complete--poll |
121 // GetState until the state is STATE_STOPPED. | 125 // GetState until the state is STATE_STOPPED. |
122 virtual void Stop(const CompletionCallback& done_callback) = 0; | 126 virtual void Stop(const CompletionCallback& done_callback) = 0; |
123 | 127 |
124 // Caches the native handle of the plugin window so it can be used to focus | 128 // Caches the native handle of the plugin window so it can be used to focus |
125 // elevation prompts properly. | 129 // elevation prompts properly. |
126 virtual void SetWindow(void* window_handle) = 0; | 130 virtual void SetWindow(void* window_handle) = 0; |
127 | 131 |
128 // Get the version of the daemon as a dotted decimal string of the form | 132 // Get the version of the daemon as a dotted decimal string of the form |
129 // major.minor.build.patch, if it is installed, or "" otherwise. | 133 // major.minor.build.patch, if it is installed, or "" otherwise. |
130 virtual void GetVersion(const GetVersionCallback& done_callback) = 0; | 134 virtual void GetVersion(const GetVersionCallback& done_callback) = 0; |
131 | 135 |
136 // Get the user's consent to crash reporting. | |
137 virtual void GetUsageStatsConsent( | |
138 const GetUsageStatsConsentCallback& done) = 0; | |
139 | |
132 static scoped_ptr<DaemonController> Create(); | 140 static scoped_ptr<DaemonController> Create(); |
133 }; | 141 }; |
134 | 142 |
135 } // namespace remoting | 143 } // namespace remoting |
136 | 144 |
137 #endif // REMOTING_HOST_DAEMON_CONTROLLER_H_ | 145 #endif // REMOTING_HOST_DAEMON_CONTROLLER_H_ |
OLD | NEW |