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

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

Issue 23578017: Follow up cleanups for r222162. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | « remoting/host/plugin/host_script_object.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 GetConfigCallback; 79 GetConfigCallback;
80 80
81 // Callback used for asynchronous operations, e.g. when 81 // Callback used for asynchronous operations, e.g. when
82 // starting/stopping the service. 82 // starting/stopping the service.
83 typedef base::Callback<void (AsyncResult result)> CompletionCallback; 83 typedef base::Callback<void (AsyncResult result)> CompletionCallback;
84 84
85 // Callback type for GetVersion(). 85 // Callback type for GetVersion().
86 typedef base::Callback<void (const std::string&)> GetVersionCallback; 86 typedef base::Callback<void (const std::string&)> GetVersionCallback;
87 87
88 struct UsageStatsConsent { 88 struct UsageStatsConsent {
89 // Indicates whether crash dump reporting is supported by the host.
89 bool supported; 90 bool supported;
91
92 // Indicates if crash dump reporting is allowed by the user.
90 bool allowed; 93 bool allowed;
94
95 // Carries information whether the crash dump reporting is controlled by
96 // policy.
91 bool set_by_policy; 97 bool set_by_policy;
92 }; 98 };
93 99
94 // Callback type for GetUsageStatsConsent(). |supported| indicates whether 100 // Callback type for GetUsageStatsConsent().
95 // crash dump reporting is supported by the host. |allowed| indicates if
96 // crash dump reporting is allowed by the user. |set_by_policy| carries
97 // information whether the crash dump reporting is controlled by policy.
98 typedef base::Callback<void (const UsageStatsConsent&)> 101 typedef base::Callback<void (const UsageStatsConsent&)>
99 GetUsageStatsConsentCallback; 102 GetUsageStatsConsentCallback;
100 103
101 // Interface representing the platform-spacific back-end. Most of its methods 104 // Interface representing the platform-spacific back-end. Most of its methods
102 // are blocking and should called on a background thread. There are two 105 // are blocking and should called on a background thread. There are two
103 // exceptions: 106 // exceptions:
104 // - GetState() is synchronous and called on the UI thread. It should avoid 107 // - GetState() is synchronous and called on the UI thread. It should avoid
105 // accessing any data members of the implementation. 108 // accessing any data members of the implementation.
106 // - SetConfigAndStart() is non blocking. |done| callback is posted to 109 // - SetConfigAndStart(), UpdateConfig() and Stop() indicate completion via
107 // |task_runner| when the operation completes. 110 // a callback. There methods are still can be long running and should
111 // be caled on a background thread.
108 class Delegate { 112 class Delegate {
109 public: 113 public:
110 virtual ~Delegate() {} 114 virtual ~Delegate() {}
111 115
112 // Return the "installed/running" state of the daemon process. This method 116 // Return the "installed/running" state of the daemon process. This method
113 // should avoid accessing any data members of the implementation. 117 // should avoid accessing any data members of the implementation.
114 virtual State GetState() = 0; 118 virtual State GetState() = 0;
115 119
116 // Queries current host configuration. Any values that might be security 120 // Queries current host configuration. Any values that might be security
117 // sensitive have been filtered out. 121 // sensitive have been filtered out.
118 virtual scoped_ptr<base::DictionaryValue> GetConfig() = 0; 122 virtual scoped_ptr<base::DictionaryValue> GetConfig() = 0;
119 123
120 // Starts the daemon process. This may require that the daemon be 124 // Starts the daemon process. This may require that the daemon be
121 // downloaded and installed. |done| is invoked when the operation is 125 // downloaded and installed. |done| is invoked on the calling thread when
122 // finished or fails. 126 // the operation is completed.
123 virtual void SetConfigAndStart( 127 virtual void SetConfigAndStart(
124 scoped_ptr<base::DictionaryValue> config, 128 scoped_ptr<base::DictionaryValue> config,
125 bool consent, 129 bool consent,
126 const CompletionCallback& done) = 0; 130 const CompletionCallback& done) = 0;
127 131
128 // Updates current host configuration with the values specified in 132 // Updates current host configuration with the values specified in
129 // |config|. Any value in the existing configuration that isn't specified in 133 // |config|. Any value in the existing configuration that isn't specified in
130 // |config| is preserved. |config| must not contain host_id or xmpp_login 134 // |config| is preserved. |config| must not contain host_id or xmpp_login
131 // values, because implementations of this method cannot change them. 135 // values, because implementations of this method cannot change them. |done|
136 // is invoked on the calling thread when the operation is completed.
132 virtual void UpdateConfig( 137 virtual void UpdateConfig(
133 scoped_ptr<base::DictionaryValue> config, 138 scoped_ptr<base::DictionaryValue> config,
134 const CompletionCallback& done) = 0; 139 const CompletionCallback& done) = 0;
135 140
136 // Stops the daemon process. 141 // Stops the daemon process. |done| is invoked on the calling thread when
142 // the operation is completed.
137 virtual void Stop(const CompletionCallback& done) = 0; 143 virtual void Stop(const CompletionCallback& done) = 0;
138 144
139 // Caches the native handle of the plugin window so it can be used to focus 145 // Caches the native handle of the plugin window so it can be used to focus
140 // elevation prompts properly. 146 // elevation prompts properly.
141 virtual void SetWindow(void* window_handle) = 0; 147 virtual void SetWindow(void* window_handle) = 0;
142 148
143 // Get the version of the daemon as a dotted decimal string of the form 149 // Get the version of the daemon as a dotted decimal string of the form
144 // major.minor.build.patch, if it is installed, or "" otherwise. 150 // major.minor.build.patch, if it is installed, or "" otherwise.
145 virtual std::string GetVersion() = 0; 151 virtual std::string GetVersion() = 0;
146 152
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 243
238 // Queue management methods. 244 // Queue management methods.
239 void ScheduleNext(); 245 void ScheduleNext();
240 void ServiceOrQueueRequest(const base::Closure& request); 246 void ServiceOrQueueRequest(const base::Closure& request);
241 void ServiceNextRequest(); 247 void ServiceNextRequest();
242 248
243 // Task runner on which all public methods of this class should be called. 249 // Task runner on which all public methods of this class should be called.
244 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; 250 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
245 251
246 // Task runner used to run blocking calls to the delegate. A single thread 252 // Task runner used to run blocking calls to the delegate. A single thread
247 // task runner is used to guarantee that one one method of the delegate is 253 // task runner is used to guarantee that one method of the delegate is
248 // called at a time. 254 // called at a time.
249 scoped_refptr<AutoThreadTaskRunner> delegate_task_runner_; 255 scoped_refptr<AutoThreadTaskRunner> delegate_task_runner_;
250 256
251 scoped_ptr<AutoThread> delegate_thread_; 257 scoped_ptr<AutoThread> delegate_thread_;
252 258
253 scoped_ptr<Delegate> delegate_; 259 scoped_ptr<Delegate> delegate_;
254 260
255 std::queue<base::Closure> pending_requests_; 261 std::queue<base::Closure> pending_requests_;
256 262
257 DISALLOW_COPY_AND_ASSIGN(DaemonController); 263 DISALLOW_COPY_AND_ASSIGN(DaemonController);
258 }; 264 };
259 265
260 } // namespace remoting 266 } // namespace remoting
261 267
262 #endif // REMOTING_HOST_SETUP_DAEMON_CONTROLLER_H_ 268 #endif // REMOTING_HOST_SETUP_DAEMON_CONTROLLER_H_
OLDNEW
« no previous file with comments | « remoting/host/plugin/host_script_object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698