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 <launch.h> | 7 #include <launch.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.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/mac/foundation_util.h" | 18 #include "base/mac/foundation_util.h" |
19 #include "base/mac/launchd.h" | 19 #include "base/mac/launchd.h" |
20 #include "base/mac/mac_logging.h" | 20 #include "base/mac/mac_logging.h" |
21 #include "base/mac/mac_util.h" | 21 #include "base/mac/mac_util.h" |
22 #include "base/mac/scoped_launch_data.h" | 22 #include "base/mac/scoped_launch_data.h" |
23 #include "base/threading/thread.h" | 23 #include "base/threading/thread.h" |
24 #include "base/time.h" | 24 #include "base/time.h" |
25 #include "base/values.h" | 25 #include "base/values.h" |
| 26 #include "remoting/host/breakpad.h" |
26 #include "remoting/host/json_host_config.h" | 27 #include "remoting/host/json_host_config.h" |
27 | 28 |
28 namespace remoting { | 29 namespace remoting { |
29 | 30 |
30 namespace { | 31 namespace { |
31 | 32 |
32 // The NSSystemDirectories.h header has a conflicting definition of | 33 // The NSSystemDirectories.h header has a conflicting definition of |
33 // NSSearchPathDirectory with the one in base/mac/foundation_util.h. | 34 // NSSearchPathDirectory with the one in base/mac/foundation_util.h. |
34 // Foundation.h would work, but it can only be included from Objective-C files. | 35 // Foundation.h would work, but it can only be included from Objective-C files. |
35 // Therefore, we define the needed constants here. | 36 // Therefore, we define the needed constants here. |
(...skipping 27 matching lines...) Expand all Loading... |
63 virtual State GetState() OVERRIDE; | 64 virtual State GetState() OVERRIDE; |
64 virtual void GetConfig(const GetConfigCallback& callback) OVERRIDE; | 65 virtual void GetConfig(const GetConfigCallback& callback) OVERRIDE; |
65 virtual void SetConfigAndStart( | 66 virtual void SetConfigAndStart( |
66 scoped_ptr<base::DictionaryValue> config, | 67 scoped_ptr<base::DictionaryValue> config, |
67 const CompletionCallback& done_callback) OVERRIDE; | 68 const CompletionCallback& done_callback) OVERRIDE; |
68 virtual void UpdateConfig(scoped_ptr<base::DictionaryValue> config, | 69 virtual void UpdateConfig(scoped_ptr<base::DictionaryValue> config, |
69 const CompletionCallback& done_callback) OVERRIDE; | 70 const CompletionCallback& done_callback) OVERRIDE; |
70 virtual void Stop(const CompletionCallback& done_callback) OVERRIDE; | 71 virtual void Stop(const CompletionCallback& done_callback) OVERRIDE; |
71 virtual void SetWindow(void* window_handle) OVERRIDE; | 72 virtual void SetWindow(void* window_handle) OVERRIDE; |
72 virtual void GetVersion(const GetVersionCallback& done_callback) OVERRIDE; | 73 virtual void GetVersion(const GetVersionCallback& done_callback) OVERRIDE; |
| 74 virtual void GetUsageStatsConsent( |
| 75 const GetUsageStatsConsentCallback& callback) OVERRIDE; |
| 76 virtual void SetUsageStatsConsent(bool consent) OVERRIDE; |
73 | 77 |
74 private: | 78 private: |
75 void DoGetConfig(const GetConfigCallback& callback); | 79 void DoGetConfig(const GetConfigCallback& callback); |
76 void DoGetVersion(const GetVersionCallback& callback); | 80 void DoGetVersion(const GetVersionCallback& callback); |
77 void DoSetConfigAndStart(scoped_ptr<base::DictionaryValue> config, | 81 void DoSetConfigAndStart(scoped_ptr<base::DictionaryValue> config, |
78 const CompletionCallback& done_callback); | 82 const CompletionCallback& done_callback); |
79 void DoUpdateConfig(scoped_ptr<base::DictionaryValue> config, | 83 void DoUpdateConfig(scoped_ptr<base::DictionaryValue> config, |
80 const CompletionCallback& done_callback); | 84 const CompletionCallback& done_callback); |
81 void DoStop(const CompletionCallback& done_callback); | 85 void DoStop(const CompletionCallback& done_callback); |
82 | 86 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // noop | 177 // noop |
174 } | 178 } |
175 | 179 |
176 void DaemonControllerMac::GetVersion(const GetVersionCallback& callback) { | 180 void DaemonControllerMac::GetVersion(const GetVersionCallback& callback) { |
177 auth_thread_.message_loop_proxy()->PostTask( | 181 auth_thread_.message_loop_proxy()->PostTask( |
178 FROM_HERE, | 182 FROM_HERE, |
179 base::Bind(&DaemonControllerMac::DoGetVersion, base::Unretained(this), | 183 base::Bind(&DaemonControllerMac::DoGetVersion, base::Unretained(this), |
180 callback)); | 184 callback)); |
181 } | 185 } |
182 | 186 |
| 187 void DaemonControllerMac::GetUsageStatsConsent( |
| 188 const GetUsageStatsConsentCallback& callback) { |
| 189 // Crash dump collection is not implemented on Mac yet. |
| 190 // http://crbug.com/130678. |
| 191 callback.Run(false, false); |
| 192 } |
| 193 |
| 194 void DaemonControllerMac::SetUsageStatsConsent(bool consent) { |
| 195 // Crash dump collection is not implemented on Mac yet. |
| 196 // http://crbug.com/130678. |
| 197 } |
| 198 |
183 void DaemonControllerMac::DoGetConfig(const GetConfigCallback& callback) { | 199 void DaemonControllerMac::DoGetConfig(const GetConfigCallback& callback) { |
184 FilePath config_path(kHostConfigFile); | 200 FilePath config_path(kHostConfigFile); |
185 JsonHostConfig host_config(config_path); | 201 JsonHostConfig host_config(config_path); |
186 scoped_ptr<base::DictionaryValue> config; | 202 scoped_ptr<base::DictionaryValue> config; |
187 | 203 |
188 if (host_config.Read()) { | 204 if (host_config.Read()) { |
189 config.reset(new base::DictionaryValue()); | 205 config.reset(new base::DictionaryValue()); |
190 std::string value; | 206 std::string value; |
191 if (host_config.GetString(kHostIdConfigPath, &value)) | 207 if (host_config.GetString(kHostIdConfigPath, &value)) |
192 config.get()->SetString(kHostIdConfigPath, value); | 208 config.get()->SetString(kHostIdConfigPath, value); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 } | 388 } |
373 } | 389 } |
374 | 390 |
375 } // namespace | 391 } // namespace |
376 | 392 |
377 scoped_ptr<DaemonController> remoting::DaemonController::Create() { | 393 scoped_ptr<DaemonController> remoting::DaemonController::Create() { |
378 return scoped_ptr<DaemonController>(new DaemonControllerMac()); | 394 return scoped_ptr<DaemonController>(new DaemonControllerMac()); |
379 } | 395 } |
380 | 396 |
381 } // namespace remoting | 397 } // namespace remoting |
OLD | NEW |