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

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

Issue 10824286: Fix DaemonControllerLinux::SetConfigAndStart() to reload config automatically. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
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 <stdio.h> 8 #include <stdio.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 10
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 void DaemonControllerMac::DoUpdateConfig( 222 void DaemonControllerMac::DoUpdateConfig(
223 scoped_ptr<base::DictionaryValue> config, 223 scoped_ptr<base::DictionaryValue> config,
224 const CompletionCallback& done_callback) { 224 const CompletionCallback& done_callback) {
225 FilePath config_file_path(kHostConfigFilePath); 225 FilePath config_file_path(kHostConfigFilePath);
226 JsonHostConfig config_file(config_file_path); 226 JsonHostConfig config_file(config_file_path);
227 if (!config_file.Read()) { 227 if (!config_file.Read()) {
228 done_callback.Run(RESULT_FAILED); 228 done_callback.Run(RESULT_FAILED);
229 return; 229 return;
230 } 230 }
231 for (DictionaryValue::key_iterator key(config->begin_keys()); 231 if (!config_file.CopyFrom(config.Get())) {
232 key != config->end_keys(); ++key) { 232 LOG(ERROR) << "Failed to update configuration.";
233 std::string value; 233 done_callback.Run(RESULT_FAILED);
234 if (!config->GetString(*key, &value)) { 234 return;
235 LOG(ERROR) << *key << " is not a string.";
236 done_callback.Run(RESULT_FAILED);
237 return;
238 }
239 config_file.SetString(*key, value);
240 } 235 }
241 236
242 std::string config_data = config_file.GetSerializedData(); 237 std::string config_data = config_file.GetSerializedData();
243 ShowPreferencePane(config_data, done_callback); 238 ShowPreferencePane(config_data, done_callback);
244 } 239 }
245 240
246 void DaemonControllerMac::ShowPreferencePane( 241 void DaemonControllerMac::ShowPreferencePane(
247 const std::string& config_data, const CompletionCallback& done_callback) { 242 const std::string& config_data, const CompletionCallback& done_callback) {
248 if (DoShowPreferencePane(config_data)) { 243 if (DoShowPreferencePane(config_data)) {
249 RegisterForPreferencePaneNotifications(done_callback); 244 RegisterForPreferencePaneNotifications(done_callback);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 359 }
365 } 360 }
366 361
367 } // namespace 362 } // namespace
368 363
369 scoped_ptr<DaemonController> remoting::DaemonController::Create() { 364 scoped_ptr<DaemonController> remoting::DaemonController::Create() {
370 return scoped_ptr<DaemonController>(new DaemonControllerMac()); 365 return scoped_ptr<DaemonController>(new DaemonControllerMac());
371 } 366 }
372 367
373 } // namespace remoting 368 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698