| 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_SETUP_DAEMON_CONTROLLER_H_ | 5 #ifndef REMOTING_HOST_SETUP_DAEMON_CONTROLLER_H_ |
| 6 #define REMOTING_HOST_SETUP_DAEMON_CONTROLLER_H_ | 6 #define REMOTING_HOST_SETUP_DAEMON_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 virtual ~Delegate() {} | 114 virtual ~Delegate() {} |
| 115 | 115 |
| 116 // Return the "installed/running" state of the daemon process. This method | 116 // Return the "installed/running" state of the daemon process. This method |
| 117 // should avoid accessing any data members of the implementation. | 117 // should avoid accessing any data members of the implementation. |
| 118 virtual State GetState() = 0; | 118 virtual State GetState() = 0; |
| 119 | 119 |
| 120 // Queries current host configuration. Any values that might be security | 120 // Queries current host configuration. Any values that might be security |
| 121 // sensitive have been filtered out. | 121 // sensitive have been filtered out. |
| 122 virtual scoped_ptr<base::DictionaryValue> GetConfig() = 0; | 122 virtual scoped_ptr<base::DictionaryValue> GetConfig() = 0; |
| 123 | 123 |
| 124 // Download and install the host component. |done| is invoked on the |
| 125 // calling thread when the operation is completed. |
| 126 virtual void InstallHost(const CompletionCallback& done) = 0; |
| 127 |
| 124 // Starts the daemon process. This may require that the daemon be | 128 // Starts the daemon process. This may require that the daemon be |
| 125 // downloaded and installed. |done| is invoked on the calling thread when | 129 // downloaded and installed. |done| is invoked on the calling thread when |
| 126 // the operation is completed. | 130 // the operation is completed. |
| 127 virtual void SetConfigAndStart( | 131 virtual void SetConfigAndStart( |
| 128 scoped_ptr<base::DictionaryValue> config, | 132 scoped_ptr<base::DictionaryValue> config, |
| 129 bool consent, | 133 bool consent, |
| 130 const CompletionCallback& done) = 0; | 134 const CompletionCallback& done) = 0; |
| 131 | 135 |
| 132 // Updates current host configuration with the values specified in | 136 // Updates current host configuration with the values specified in |
| 133 // |config|. Any value in the existing configuration that isn't specified in | 137 // |config|. Any value in the existing configuration that isn't specified in |
| (...skipping 30 matching lines...) Expand all Loading... |
| 164 // webapp. In most cases it requires IO operations, so it may block | 168 // webapp. In most cases it requires IO operations, so it may block |
| 165 // the user interface. Replace it with asynchronous notifications, | 169 // the user interface. Replace it with asynchronous notifications, |
| 166 // e.g. with StartStateNotifications()/StopStateNotifications() methods. | 170 // e.g. with StartStateNotifications()/StopStateNotifications() methods. |
| 167 State GetState(); | 171 State GetState(); |
| 168 | 172 |
| 169 // Queries current host configuration. The |done| is called | 173 // Queries current host configuration. The |done| is called |
| 170 // after the configuration is read, and any values that might be security | 174 // after the configuration is read, and any values that might be security |
| 171 // sensitive have been filtered out. | 175 // sensitive have been filtered out. |
| 172 void GetConfig(const GetConfigCallback& done); | 176 void GetConfig(const GetConfigCallback& done); |
| 173 | 177 |
| 178 // Download and install the host component. |done| is called when the |
| 179 // operation is finished or fails. |
| 180 void InstallHost(const CompletionCallback& done); |
| 181 |
| 174 // Start the daemon process. This may require that the daemon be | 182 // Start the daemon process. This may require that the daemon be |
| 175 // downloaded and installed. |done| is called when the | 183 // downloaded and installed. |done| is called when the |
| 176 // operation is finished or fails. | 184 // operation is finished or fails. |
| 177 // | 185 // |
| 178 // TODO(sergeyu): This method writes config and starts the host - | 186 // TODO(sergeyu): This method writes config and starts the host - |
| 179 // these two steps are merged for simplicity. Consider splitting it | 187 // these two steps are merged for simplicity. Consider splitting it |
| 180 // into SetConfig() and Start() once we have basic host setup flow | 188 // into SetConfig() and Start() once we have basic host setup flow |
| 181 // working. | 189 // working. |
| 182 void SetConfigAndStart(scoped_ptr<base::DictionaryValue> config, | 190 void SetConfigAndStart(scoped_ptr<base::DictionaryValue> config, |
| 183 bool consent, | 191 bool consent, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 209 | 217 |
| 210 // Get the user's consent to crash reporting. | 218 // Get the user's consent to crash reporting. |
| 211 void GetUsageStatsConsent(const GetUsageStatsConsentCallback& done); | 219 void GetUsageStatsConsent(const GetUsageStatsConsentCallback& done); |
| 212 | 220 |
| 213 private: | 221 private: |
| 214 friend class base::RefCountedThreadSafe<DaemonController>; | 222 friend class base::RefCountedThreadSafe<DaemonController>; |
| 215 virtual ~DaemonController(); | 223 virtual ~DaemonController(); |
| 216 | 224 |
| 217 // Blocking helper methods used to call the delegate. | 225 // Blocking helper methods used to call the delegate. |
| 218 void DoGetConfig(const GetConfigCallback& done); | 226 void DoGetConfig(const GetConfigCallback& done); |
| 227 void DoInstallHost(const CompletionCallback& done); |
| 219 void DoSetConfigAndStart(scoped_ptr<base::DictionaryValue> config, | 228 void DoSetConfigAndStart(scoped_ptr<base::DictionaryValue> config, |
| 220 bool consent, | 229 bool consent, |
| 221 const CompletionCallback& done); | 230 const CompletionCallback& done); |
| 222 void DoUpdateConfig(scoped_ptr<base::DictionaryValue> config, | 231 void DoUpdateConfig(scoped_ptr<base::DictionaryValue> config, |
| 223 const CompletionCallback& done); | 232 const CompletionCallback& done); |
| 224 void DoStop(const CompletionCallback& done); | 233 void DoStop(const CompletionCallback& done); |
| 225 void DoSetWindow(void* window_handle, const base::Closure& done); | 234 void DoSetWindow(void* window_handle, const base::Closure& done); |
| 226 void DoGetVersion(const GetVersionCallback& done); | 235 void DoGetVersion(const GetVersionCallback& done); |
| 227 void DoGetUsageStatsConsent(const GetUsageStatsConsentCallback& done); | 236 void DoGetUsageStatsConsent(const GetUsageStatsConsentCallback& done); |
| 228 | 237 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 259 scoped_ptr<Delegate> delegate_; | 268 scoped_ptr<Delegate> delegate_; |
| 260 | 269 |
| 261 std::queue<base::Closure> pending_requests_; | 270 std::queue<base::Closure> pending_requests_; |
| 262 | 271 |
| 263 DISALLOW_COPY_AND_ASSIGN(DaemonController); | 272 DISALLOW_COPY_AND_ASSIGN(DaemonController); |
| 264 }; | 273 }; |
| 265 | 274 |
| 266 } // namespace remoting | 275 } // namespace remoting |
| 267 | 276 |
| 268 #endif // REMOTING_HOST_SETUP_DAEMON_CONTROLLER_H_ | 277 #endif // REMOTING_HOST_SETUP_DAEMON_CONTROLLER_H_ |
| OLD | NEW |