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

Side by Side Diff: remoting/host/plugin/daemon_controller_mac.cc

Issue 10007048: Cleanup and simplify HostConfig and JsonHostConfig. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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/json_host_config_unittest.cc ('k') | remoting/host/remoting_me2me_host.cc » ('j') | 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 #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 <sys/types.h> 8 #include <sys/types.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 done_callback.Run(RESULT_FAILED); 129 done_callback.Run(RESULT_FAILED);
130 } 130 }
131 131
132 void DaemonControllerMac::Stop(const CompletionCallback& done_callback) { 132 void DaemonControllerMac::Stop(const CompletionCallback& done_callback) {
133 auth_thread_.message_loop_proxy()->PostTask( 133 auth_thread_.message_loop_proxy()->PostTask(
134 FROM_HERE, base::Bind( 134 FROM_HERE, base::Bind(
135 &DaemonControllerMac::DoStop, base::Unretained(this), done_callback)); 135 &DaemonControllerMac::DoStop, base::Unretained(this), done_callback));
136 } 136 }
137 137
138 void DaemonControllerMac::DoGetConfig(const GetConfigCallback& callback) { 138 void DaemonControllerMac::DoGetConfig(const GetConfigCallback& callback) {
139 JsonHostConfig host_config(FilePath(kHostConfigFile), 139 FilePath config_path(kHostConfigFile);
140 base::MessageLoopProxy::current()); 140 JsonHostConfig host_config(config_path);
141 host_config.Read(); 141 scoped_ptr<base::DictionaryValue> config;
142 142
143 scoped_ptr<base::DictionaryValue> config(new base::DictionaryValue()); 143 if (host_config.Read()) {
144 144 config.reset(new base::DictionaryValue());
145 const char* key = "host_id"; 145 std::string value;
146 std::string value; 146 if (host_config.GetString(kHostIdConfigPath, &value))
147 if (host_config.GetString(key, &value)) 147 config.get()->SetString(kHostIdConfigPath, value);
148 config.get()->SetString(key, value); 148 if (host_config.GetString(kXmppLoginConfigPath, &value))
149 key = "xmpp_login"; 149 config.get()->SetString(kXmppLoginConfigPath, value);
150 if (host_config.GetString(key, &value)) 150 }
151 config.get()->SetString(key, value);
152 151
153 callback.Run(config.Pass()); 152 callback.Run(config.Pass());
154 } 153 }
155 154
156 void DaemonControllerMac::DoSetConfigAndStart( 155 void DaemonControllerMac::DoSetConfigAndStart(
157 scoped_ptr<base::DictionaryValue> config, 156 scoped_ptr<base::DictionaryValue> config,
158 const CompletionCallback& done_callback) { 157 const CompletionCallback& done_callback) {
159 // JsonHostConfig doesn't provide a way to save on the current thread, wait 158 // JsonHostConfig doesn't provide a way to save on the current thread, wait
160 // for completion, and know whether the save succeeded. Instead, use 159 // for completion, and know whether the save succeeded. Instead, use
161 // base::JSONWriter directly. 160 // base::JSONWriter directly.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 return true; 247 return true;
249 } 248 }
250 249
251 } // namespace 250 } // namespace
252 251
253 scoped_ptr<DaemonController> remoting::DaemonController::Create() { 252 scoped_ptr<DaemonController> remoting::DaemonController::Create() {
254 return scoped_ptr<DaemonController>(new DaemonControllerMac()); 253 return scoped_ptr<DaemonController>(new DaemonControllerMac());
255 } 254 }
256 255
257 } // namespace remoting 256 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/json_host_config_unittest.cc ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698