| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef REMOTING_HOST_HOST_CONFIG_H_ | 5 #ifndef REMOTING_HOST_HOST_CONFIG_H_ |
| 6 #define REMOTING_HOST_HOST_CONFIG_H_ | 6 #define REMOTING_HOST_HOST_CONFIG_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 public: | 32 public: |
| 33 HostConfig() { }; | 33 HostConfig() { }; |
| 34 virtual ~HostConfig() { } | 34 virtual ~HostConfig() { } |
| 35 | 35 |
| 36 virtual bool GetString(const std::string& path, std::string* out_value) = 0; | 36 virtual bool GetString(const std::string& path, std::string* out_value) = 0; |
| 37 | 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(HostConfig); | 38 DISALLOW_COPY_AND_ASSIGN(HostConfig); |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // MutableHostConfig extends HostConfig for mutability. | 41 // MutableHostConfig extends HostConfig for mutability. |
| 42 // |
| 43 // TODO(sergeyu): Simplify this interface. |
| 42 class MutableHostConfig : public HostConfig { | 44 class MutableHostConfig : public HostConfig { |
| 43 public: | 45 public: |
| 44 MutableHostConfig() { }; | 46 MutableHostConfig() { }; |
| 45 | 47 |
| 46 // Update() must be used to update config values. | 48 // Update() must be used to update config values. |
| 47 // It acquires lock, calls the specified task, releases the lock and | 49 // It acquires lock, calls the specified task, releases the lock and |
| 48 // then schedules the config to be written to storage. | 50 // then schedules the config to be written to storage. |
| 49 virtual void Update(Task* task) = 0; | 51 virtual void Update(Task* task) = 0; |
| 50 | 52 |
| 51 // SetString() updates specified config value. This methods must only | 53 // SetString() updates specified config value. This methods must only |
| 52 // be called from task specified in Update(). | 54 // be called from task specified in Update(). |
| 53 virtual void SetString(const std::string& path, | 55 virtual void SetString(const std::string& path, |
| 54 const std::string& in_value) = 0; | 56 const std::string& in_value) = 0; |
| 55 | 57 |
| 56 DISALLOW_COPY_AND_ASSIGN(MutableHostConfig); | 58 DISALLOW_COPY_AND_ASSIGN(MutableHostConfig); |
| 57 }; | 59 }; |
| 58 | 60 |
| 59 } // namespace remoting | 61 } // namespace remoting |
| 60 | 62 |
| 61 #endif // REMOTING_HOST_HOST_CONFIG_H_ | 63 #endif // REMOTING_HOST_HOST_CONFIG_H_ |
| OLD | NEW |