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

Side by Side Diff: remoting/host/json_host_config.cc

Issue 8493020: Move code in src/remoting to the new callbacks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: - Created 9 years, 1 month 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
« no previous file with comments | « remoting/host/host_mock_objects.h ('k') | remoting/host/local_input_monitor_mac.mm » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/json_host_config.h" 5 #include "remoting/host/json_host_config.h"
6 6
7 #include "base/bind.h"
7 #include "base/file_util.h" 8 #include "base/file_util.h"
8 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
10 #include "base/location.h" 11 #include "base/location.h"
11 #include "base/message_loop_proxy.h" 12 #include "base/message_loop_proxy.h"
12 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
13 #include "base/task.h" 14 #include "base/task.h"
14 #include "base/values.h" 15 #include "base/values.h"
15 16
16 namespace remoting { 17 namespace remoting {
(...skipping 20 matching lines...) Expand all
37 } 38 }
38 39
39 DictionaryValue* dictionary = static_cast<DictionaryValue*>(value.release()); 40 DictionaryValue* dictionary = static_cast<DictionaryValue*>(value.release());
40 base::AutoLock auto_lock(lock_); 41 base::AutoLock auto_lock(lock_);
41 values_.reset(dictionary); 42 values_.reset(dictionary);
42 return true; 43 return true;
43 } 44 }
44 45
45 void JsonHostConfig::Save() { 46 void JsonHostConfig::Save() {
46 message_loop_proxy_->PostTask( 47 message_loop_proxy_->PostTask(
47 FROM_HERE, NewRunnableMethod(this, &JsonHostConfig::DoWrite)); 48 FROM_HERE, base::Bind(&JsonHostConfig::DoWrite, this));
48 } 49 }
49 50
50 void JsonHostConfig::DoWrite() { 51 void JsonHostConfig::DoWrite() {
51 std::string file_content; 52 std::string file_content;
52 base::AutoLock auto_lock(lock_); 53 base::AutoLock auto_lock(lock_);
53 base::JSONWriter::Write(values_.get(), true, &file_content); 54 base::JSONWriter::Write(values_.get(), true, &file_content);
54 // TODO(sergeyu): Move ImportantFileWriter to base and use it here. 55 // TODO(sergeyu): Move ImportantFileWriter to base and use it here.
55 file_util::WriteFile(filename_, file_content.c_str(), file_content.size()); 56 file_util::WriteFile(filename_, file_content.c_str(), file_content.size());
56 } 57 }
57 58
58 } // namespace remoting 59 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/host_mock_objects.h ('k') | remoting/host/local_input_monitor_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698