OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "remoting/host/composite_host_config.h" |
| 6 |
| 7 #include "base/stl_util.h" |
| 8 #include "remoting/host/json_host_config.h" |
| 9 |
| 10 namespace remoting { |
| 11 |
| 12 CompositeHostConfig::CompositeHostConfig() { |
| 13 } |
| 14 |
| 15 CompositeHostConfig::~CompositeHostConfig() { |
| 16 STLDeleteElements(&configs_); |
| 17 } |
| 18 |
| 19 bool CompositeHostConfig::AddConfigPath(const FilePath& path) { |
| 20 scoped_ptr<JsonHostConfig> config(new JsonHostConfig(path)); |
| 21 if (!config->Read()) { |
| 22 return false; |
| 23 } |
| 24 configs_.push_back(config.release()); |
| 25 return true; |
| 26 } |
| 27 |
| 28 bool CompositeHostConfig::GetString(const std::string& path, |
| 29 std::string* out_value) const { |
| 30 for (std::vector<HostConfig*>::const_iterator it = configs_.begin(); |
| 31 it != configs_.end(); ++it) { |
| 32 if ((*it)->GetString(path, out_value)) |
| 33 return true; |
| 34 } |
| 35 return false; |
| 36 } |
| 37 |
| 38 bool CompositeHostConfig::GetBoolean(const std::string& path, |
| 39 bool* out_value) const { |
| 40 for (std::vector<HostConfig*>::const_iterator it = configs_.begin(); |
| 41 it != configs_.end(); ++it) { |
| 42 if ((*it)->GetBoolean(path, out_value)) |
| 43 return true; |
| 44 } |
| 45 return false; |
| 46 } |
| 47 |
| 48 } // namespace remoting |
OLD | NEW |