| 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_JSON_HOST_CONFIG_H_ | 5 #ifndef REMOTING_HOST_JSON_HOST_CONFIG_H_ |
| 6 #define REMOTING_HOST_JSON_HOST_CONFIG_H_ | 6 #define REMOTING_HOST_JSON_HOST_CONFIG_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/lock.h" | 11 #include "base/lock.h" |
| 12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "remoting/host/host_config.h" | 14 #include "remoting/host/host_config.h" |
| 15 | 15 |
| 16 class DictionaryValue; | 16 class DictionaryValue; |
| 17 class Task; | 17 class Task; |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 class MessageLoopProxy; | 20 class MessageLoopProxy; |
| 21 } // namespace base | 21 } // namespace base |
| 22 | 22 |
| 23 namespace remoting { | 23 namespace remoting { |
| 24 | 24 |
| 25 // JsonHostConfig implements MutableHostConfig for JSON file. | 25 // JsonHostConfig implements MutableHostConfig for JSON file. |
| 26 class JsonHostConfig : public MutableHostConfig { | 26 class JsonHostConfig : public MutableHostConfig { |
| 27 public: | 27 public: |
| 28 JsonHostConfig(const FilePath& pref_filename, | 28 JsonHostConfig(const FilePath& pref_filename, |
| 29 base::MessageLoopProxy* file_message_loop_proxy); | 29 base::MessageLoopProxy* file_message_loop_proxy); |
| 30 virtual ~JsonHostConfig(); |
| 30 | 31 |
| 31 virtual bool Read(); | 32 virtual bool Read(); |
| 32 | 33 |
| 33 // MutableHostConfig interface. | 34 // MutableHostConfig interface. |
| 34 virtual bool GetString(const std::string& path, std::string* out_value); | 35 virtual bool GetString(const std::string& path, std::string* out_value); |
| 35 | 36 |
| 36 virtual void Update(Task* task); | 37 virtual void Update(Task* task); |
| 37 | 38 |
| 38 virtual void SetString(const std::string& path, const std::string& in_value); | 39 virtual void SetString(const std::string& path, const std::string& in_value); |
| 39 | 40 |
| 40 private: | 41 private: |
| 41 void DoWrite(); | 42 void DoWrite(); |
| 42 | 43 |
| 43 // |lock_| must be locked whenever we access values_; | 44 // |lock_| must be locked whenever we access values_; |
| 44 Lock lock_; | 45 Lock lock_; |
| 45 FilePath filename_; | 46 FilePath filename_; |
| 46 scoped_ptr<DictionaryValue> values_; | 47 scoped_ptr<DictionaryValue> values_; |
| 47 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 48 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
| 48 | 49 |
| 49 DISALLOW_COPY_AND_ASSIGN(JsonHostConfig); | 50 DISALLOW_COPY_AND_ASSIGN(JsonHostConfig); |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 } // namespace remoting | 53 } // namespace remoting |
| 53 | 54 |
| 54 #endif // REMOTING_HOST_JSON_HOST_CONFIG_H_ | 55 #endif // REMOTING_HOST_JSON_HOST_CONFIG_H_ |
| OLD | NEW |