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 #include "remoting/host/plugin/daemon_controller.h" | 5 #include "remoting/host/plugin/daemon_controller.h" |
6 | 6 |
7 #include <unistd.h> | 7 #include <unistd.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/environment.h" | 13 #include "base/environment.h" |
14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
16 #include "base/json/json_writer.h" | 16 #include "base/json/json_writer.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/md5.h" | 18 #include "base/md5.h" |
19 #include "base/process_util.h" | 19 #include "base/process_util.h" |
20 #include "base/string_number_conversions.h" | 20 #include "base/string_number_conversions.h" |
21 #include "base/string_split.h" | 21 #include "base/string_split.h" |
22 #include "base/string_util.h" | 22 #include "base/string_util.h" |
23 #include "base/threading/thread.h" | 23 #include "base/threading/thread.h" |
24 #include "base/values.h" | 24 #include "base/values.h" |
25 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
| 26 #include "remoting/host/breakpad.h" |
26 #include "remoting/host/host_config.h" | 27 #include "remoting/host/host_config.h" |
27 #include "remoting/host/json_host_config.h" | 28 #include "remoting/host/json_host_config.h" |
28 | 29 |
29 namespace remoting { | 30 namespace remoting { |
30 | 31 |
31 namespace { | 32 namespace { |
32 | 33 |
33 const char kDaemonScript[] = "me2me_virtual_host.py"; | 34 const char kDaemonScript[] = "me2me_virtual_host.py"; |
34 const int64 kDaemonTimeoutMs = 5000; | 35 const int64 kDaemonTimeoutMs = 5000; |
35 | 36 |
(...skipping 22 matching lines...) Expand all Loading... |
58 virtual State GetState() OVERRIDE; | 59 virtual State GetState() OVERRIDE; |
59 virtual void GetConfig(const GetConfigCallback& callback) OVERRIDE; | 60 virtual void GetConfig(const GetConfigCallback& callback) OVERRIDE; |
60 virtual void SetConfigAndStart( | 61 virtual void SetConfigAndStart( |
61 scoped_ptr<base::DictionaryValue> config, | 62 scoped_ptr<base::DictionaryValue> config, |
62 const CompletionCallback& done_callback) OVERRIDE; | 63 const CompletionCallback& done_callback) OVERRIDE; |
63 virtual void UpdateConfig(scoped_ptr<base::DictionaryValue> config, | 64 virtual void UpdateConfig(scoped_ptr<base::DictionaryValue> config, |
64 const CompletionCallback& done_callback) OVERRIDE; | 65 const CompletionCallback& done_callback) OVERRIDE; |
65 virtual void Stop(const CompletionCallback& done_callback) OVERRIDE; | 66 virtual void Stop(const CompletionCallback& done_callback) OVERRIDE; |
66 virtual void SetWindow(void* window_handle) OVERRIDE; | 67 virtual void SetWindow(void* window_handle) OVERRIDE; |
67 virtual void GetVersion(const GetVersionCallback& done_callback) OVERRIDE; | 68 virtual void GetVersion(const GetVersionCallback& done_callback) OVERRIDE; |
| 69 virtual void GetUsageStatsConsent( |
| 70 const GetUsageStatsConsentCallback& callback) OVERRIDE; |
| 71 virtual void SetUsageStatsConsent(bool consent) OVERRIDE; |
68 | 72 |
69 private: | 73 private: |
70 FilePath GetConfigPath(); | 74 FilePath GetConfigPath(); |
71 | 75 |
72 void DoGetConfig(const GetConfigCallback& callback); | 76 void DoGetConfig(const GetConfigCallback& callback); |
73 void DoSetConfigAndStart(scoped_ptr<base::DictionaryValue> config, | 77 void DoSetConfigAndStart(scoped_ptr<base::DictionaryValue> config, |
74 const CompletionCallback& done_callback); | 78 const CompletionCallback& done_callback); |
75 void DoUpdateConfig(scoped_ptr<base::DictionaryValue> config, | 79 void DoUpdateConfig(scoped_ptr<base::DictionaryValue> config, |
76 const CompletionCallback& done_callback); | 80 const CompletionCallback& done_callback); |
77 void DoStop(const CompletionCallback& done_callback); | 81 void DoStop(const CompletionCallback& done_callback); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 return remoting::DaemonController::STATE_STOPPED; | 156 return remoting::DaemonController::STATE_STOPPED; |
153 } | 157 } |
154 } | 158 } |
155 | 159 |
156 void DaemonControllerLinux::GetConfig(const GetConfigCallback& callback) { | 160 void DaemonControllerLinux::GetConfig(const GetConfigCallback& callback) { |
157 // base::Unretained() is safe because we control lifetime of the thread. | 161 // base::Unretained() is safe because we control lifetime of the thread. |
158 file_io_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( | 162 file_io_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( |
159 &DaemonControllerLinux::DoGetConfig, base::Unretained(this), callback)); | 163 &DaemonControllerLinux::DoGetConfig, base::Unretained(this), callback)); |
160 } | 164 } |
161 | 165 |
| 166 void DaemonControllerLinux::GetUsageStatsConsent( |
| 167 const GetUsageStatsConsentCallback& callback) { |
| 168 // Crash dump collection is not implemented on Linux yet. |
| 169 // http://crbug.com/130678. |
| 170 callback.Run(false, false); |
| 171 } |
| 172 |
| 173 void DaemonControllerLinux::SetUsageStatsConsent(bool consent) { |
| 174 // Crash dump collection is not implemented on Linux yet. |
| 175 // http://crbug.com/130678. |
| 176 } |
| 177 |
162 void DaemonControllerLinux::SetConfigAndStart( | 178 void DaemonControllerLinux::SetConfigAndStart( |
163 scoped_ptr<base::DictionaryValue> config, | 179 scoped_ptr<base::DictionaryValue> config, |
164 const CompletionCallback& done_callback) { | 180 const CompletionCallback& done_callback) { |
165 // base::Unretained() is safe because we control lifetime of the thread. | 181 // base::Unretained() is safe because we control lifetime of the thread. |
166 file_io_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( | 182 file_io_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( |
167 &DaemonControllerLinux::DoSetConfigAndStart, base::Unretained(this), | 183 &DaemonControllerLinux::DoSetConfigAndStart, base::Unretained(this), |
168 base::Passed(&config), done_callback)); | 184 base::Passed(&config), done_callback)); |
169 } | 185 } |
170 | 186 |
171 void DaemonControllerLinux::UpdateConfig( | 187 void DaemonControllerLinux::UpdateConfig( |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 done_callback.Run(result); | 289 done_callback.Run(result); |
274 } | 290 } |
275 | 291 |
276 } // namespace | 292 } // namespace |
277 | 293 |
278 scoped_ptr<DaemonController> remoting::DaemonController::Create() { | 294 scoped_ptr<DaemonController> remoting::DaemonController::Create() { |
279 return scoped_ptr<DaemonController>(new DaemonControllerLinux()); | 295 return scoped_ptr<DaemonController>(new DaemonControllerLinux()); |
280 } | 296 } |
281 | 297 |
282 } // namespace remoting | 298 } // namespace remoting |
OLD | NEW |