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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class DictionaryValue; | 14 class DictionaryValue; |
15 } // namespace base | 15 } // namespace base |
16 | 16 |
17 namespace remoting { | 17 namespace remoting { |
18 | 18 |
19 class DaemonController { | 19 class DaemonController { |
20 public: | 20 public: |
21 // Note that these enumeration values are duplicated in daemon_plugin.js and | 21 // Note that these enumeration values are duplicated in daemon_plugin.js and |
22 // must be kept in sync. | 22 // must be kept in sync. |
23 enum State { | 23 enum State { |
24 // Placeholder state for platforms on which the daemon process is not | 24 // Placeholder state for platforms on which the daemon process is not |
25 // implemented. The web-app will not show the corresponding UI. This value | 25 // implemented. The web-app will not show the corresponding UI. This value |
26 // will eventually be deprecated or removed. | 26 // will eventually be deprecated or removed. |
27 STATE_NOT_IMPLEMENTED = -1, | 27 STATE_NOT_IMPLEMENTED = -1, |
28 // The daemon process is not installed. This is functionally equivalent | 28 // The daemon is not installed. This is functionally equivalent to |
29 // to STATE_STOPPED, but the start method is expected to be significantly | 29 // STATE_STOPPED, but the start method is expected to be significantly |
30 // slower, and might involve user interaction. It might be appropriate to | 30 // slower, and might involve user interaction. It might be appropriate to |
31 // indicate this in the UI. | 31 // indicate this in the UI. |
32 STATE_NOT_INSTALLED = 0, | 32 STATE_NOT_INSTALLED = 0, |
33 // The daemon process is installed but not running. Call Start to start it. | 33 // The daemon is being installed. |
34 STATE_STOPPED = 1, | 34 STATE_INSTALLING = 1, |
| 35 // The daemon is installed but not running. Call Start to start it. |
| 36 STATE_STOPPED = 2, |
| 37 // The daemon process is starting. |
| 38 STATE_STARTING = 3, |
35 // The daemon process is running. Call Start again to change the PIN or | 39 // The daemon process is running. Call Start again to change the PIN or |
36 // Stop to stop it. | 40 // Stop to stop it. |
37 STATE_STARTED = 2, | 41 STATE_STARTED = 4, |
| 42 // The daemon process is stopping. |
| 43 STATE_STOPPING = 5, |
38 // The previous Start operation failed. This is functionally equivalent | 44 // The previous Start operation failed. This is functionally equivalent |
39 // to STATE_STOPPED, but the UI should report an error in this state. | 45 // to STATE_STOPPED, but the UI should report an error in this state. |
40 // This state should not persist across restarts of the NPAPI process. | 46 // This state should not persist across restarts of the NPAPI process. |
41 STATE_START_FAILED = 3, | 47 STATE_START_FAILED = 6, |
42 // The state cannot be determined. This could indicate that the plugin | 48 // The state cannot be determined. This could indicate that the plugin |
43 // has not been provided with sufficient information, for example, the | 49 // has not been provided with sufficient information, for example, the |
44 // user for which to query state on a multi-user system. | 50 // user for which to query state on a multi-user system. |
45 STATE_UNKNOWN = 4 | 51 STATE_UNKNOWN = 7 |
46 }; | 52 }; |
47 | 53 |
48 // The callback for GetConfig(). |config| is set to NULL in case of | 54 // The callback for GetConfig(). |config| is set to NULL in case of |
49 // an error. Otherwise it is a dictionary that contains the | 55 // an error. Otherwise it is a dictionary that contains the |
50 // following values: host_id and xmpp_login, which may be empty if | 56 // following values: host_id and xmpp_login, which may be empty if |
51 // the host is not initialized yet. The config must not contain any | 57 // the host is not initialized yet. The config must not contain any |
52 // security sensitive information, such as authentication tokens and | 58 // security sensitive information, such as authentication tokens and |
53 // private keys. | 59 // private keys. |
54 typedef base::Callback<void (scoped_ptr<base::DictionaryValue> config)> | 60 typedef base::Callback<void (scoped_ptr<base::DictionaryValue> config)> |
55 GetConfigCallback; | 61 GetConfigCallback; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // As with Start, Stop may return before the operation is complete--poll | 100 // As with Start, Stop may return before the operation is complete--poll |
95 // GetState until the state is STATE_STOPPED. | 101 // GetState until the state is STATE_STOPPED. |
96 virtual void Stop() = 0; | 102 virtual void Stop() = 0; |
97 | 103 |
98 static DaemonController* Create(); | 104 static DaemonController* Create(); |
99 }; | 105 }; |
100 | 106 |
101 } // namespace remoting | 107 } // namespace remoting |
102 | 108 |
103 #endif // REMOTING_HOST_DAEMON_CONTROLLER_H_ | 109 #endif // REMOTING_HOST_DAEMON_CONTROLLER_H_ |
OLD | NEW |