| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_PREFS_DUMMY_PREF_STORE_H_ | |
| 6 #define CHROME_BROWSER_PREFS_DUMMY_PREF_STORE_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/scoped_ptr.h" | |
| 11 #include "chrome/common/pref_store.h" | |
| 12 | |
| 13 class DictionaryValue; | |
| 14 | |
| 15 // |DummyPrefStore| is a stub implementation of the |PrefStore| interface. | |
| 16 // It allows to get and set the state of the |PrefStore|. | |
| 17 class DummyPrefStore : public PrefStore { | |
| 18 public: | |
| 19 DummyPrefStore(); | |
| 20 virtual ~DummyPrefStore() {} | |
| 21 | |
| 22 virtual DictionaryValue* prefs() const { return prefs_.get(); } | |
| 23 | |
| 24 virtual PrefStore::PrefReadError ReadPrefs(); | |
| 25 | |
| 26 virtual bool ReadOnly() { return read_only_; } | |
| 27 | |
| 28 virtual bool WritePrefs(); | |
| 29 | |
| 30 // Getter and Setter methods for setting and getting the state of the | |
| 31 // |DummyPrefStore|. | |
| 32 virtual void set_read_only(bool read_only) { read_only_ = read_only; } | |
| 33 virtual void set_prefs(DictionaryValue* prefs) { prefs_.reset(prefs); } | |
| 34 virtual void set_prefs_written(bool status) { prefs_written_ = status; } | |
| 35 virtual bool get_prefs_written() { return prefs_written_; } | |
| 36 | |
| 37 private: | |
| 38 scoped_ptr<DictionaryValue> prefs_; | |
| 39 | |
| 40 // Flag that indicates if the PrefStore is read-only | |
| 41 bool read_only_; | |
| 42 | |
| 43 // Flag that indicates if the method WritePrefs was called. | |
| 44 bool prefs_written_; | |
| 45 | |
| 46 DISALLOW_COPY_AND_ASSIGN(DummyPrefStore); | |
| 47 }; | |
| 48 | |
| 49 #endif // CHROME_BROWSER_PREFS_DUMMY_PREF_STORE_H_ | |
| OLD | NEW |