Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: remoting/host/plugin/daemon_controller.h

Issue 9316078: Added daemon process NPAPI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Separated out Start/SetPin and added return codes to Stop and Start. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | remoting/host/plugin/daemon_controller_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_HOST_DAEMON_CONTROLLER_H_
6 #define REMOTING_HOST_DAEMON_CONTROLLER_H_
7
8 #include <string>
9
10 namespace remoting {
11
12 class DaemonController {
13 public:
14 enum State {
15 // Placeholder state for platforms on which the daemon process is not
16 // implemented. The web-app will not show the corresponding UI. This value
17 // will eventually be deprecated or removed.
18 STATE_NOT_IMPLEMENTED = -1,
19 // The daemon process is not installed. This is functionally equivalent
20 // to STATE_STOPPED, but the start method is expected to be significantly
21 // slower, and might involve user interaction. It might be appropriate to
22 // indicate this in the UI.
23 STATE_NOT_INSTALLED = 0,
24 // The daemon process is installed but not running. Call Start to start it.
25 STATE_STOPPED = 1,
26 // The daemon process is running. Call Start again to change the PIN or
27 // Stop to stop it.
28 STATE_STARTED = 2,
29 // The previous Start operation failed. This is functionally equivalent
30 // to STATE_STOPPED, but the UI should report an error in this state.
31 // This state should not persist across restarts of the NPAPI process.
32 STATE_START_FAILED = 3,
33 // The state cannot be determined. This could indicate that the plugin
34 // has not been provided with sufficient information, for example, the
35 // user for which to query state on a multi-user system.
36 STATE_UNKNOWN = 4
37 };
38
39 virtual ~DaemonController() {}
40
41 // Return the "installed/running" state of the daemon process.
42 virtual State GetState() = 0;
43
44 // Set the PIN for accessing this host, which should be expressed as a
45 // UTF8-encoded string. It is permitted to call SetPin when the daemon
46 // is already running. Returns true if successful, or false if the PIN
47 // does not satisfy complexity requirements.
48 //
49 // TODO(jamiewalch): More state-setting methods needed here. Sufficient
Wez 2012/02/07 00:39:53 nit: They're not _needed_, unless they're... well.
50 // state must be set prior to calling any other DaemonController method;
51 // this should be documented for each method.
52 virtual bool SetPin(const std::string& pin) = 0;
53
54 // Start the daemon process. Since this may require that the daemon be
55 // downloaded and installed, this may take a long time--poll GetState
56 // until the state is STATE_STARTED or STATE_START_FAILED. Start fails
57 // synchronously and returns false if sufficient state has not been set,
58 // including a valid PIN.
59 virtual bool Start() = 0;
60
61 // Stop the daemon process. It is permitted to call Stop while the daemon
62 // process is being installed, in which case the installation should be
63 // aborted if possible; if not then it is sufficient to ensure that the
64 // daemon process is not started automatically upon successful installation.
65 // Returns false if sufficient state has not been set; Stop is not permitted
66 // to fail for any other reason.
67 virtual bool Stop() = 0;
68
69 static DaemonController* Create();
70 };
71
72 } // namespace remoting
73
74 #endif // REMOTING_HOST_DAEMON_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/host/plugin/daemon_controller_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698