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/in_memory_host_config.h" | 5 #include "remoting/host/in_memory_host_config.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 | 9 |
10 namespace remoting { | 10 namespace remoting { |
(...skipping 26 matching lines...) Expand all Loading... |
37 const std::string& in_value) { | 37 const std::string& in_value) { |
38 DCHECK(CalledOnValidThread()); | 38 DCHECK(CalledOnValidThread()); |
39 values_->SetString(path, in_value); | 39 values_->SetString(path, in_value); |
40 } | 40 } |
41 | 41 |
42 void InMemoryHostConfig::SetBoolean(const std::string& path, bool in_value) { | 42 void InMemoryHostConfig::SetBoolean(const std::string& path, bool in_value) { |
43 DCHECK(CalledOnValidThread()); | 43 DCHECK(CalledOnValidThread()); |
44 values_->SetBoolean(path, in_value); | 44 values_->SetBoolean(path, in_value); |
45 } | 45 } |
46 | 46 |
| 47 bool InMemoryHostConfig::CopyFrom(const base::DictionaryValue* dictionary) { |
| 48 bool result = true; |
| 49 |
| 50 for (DictionaryValue::key_iterator key(dictionary->begin_keys()); |
| 51 key != dictionary->end_keys(); ++key) { |
| 52 std::string str_value; |
| 53 bool bool_value; |
| 54 if (dictionary->GetString(*key, &str_value)) { |
| 55 SetString(*key, str_value); |
| 56 } else if (dictionary->GetBoolean(*key, &bool_value)) { |
| 57 SetBoolean(*key, bool_value); |
| 58 } else { |
| 59 result = false; |
| 60 } |
| 61 } |
| 62 |
| 63 return result; |
| 64 } |
| 65 |
47 } // namespace remoting | 66 } // namespace remoting |
OLD | NEW |