| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_LEVELDB_STORAGE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_LEVELDB_STORAGE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_LEVELDB_STORAGE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_LEVELDB_STORAGE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 DISALLOW_COPY_AND_ASSIGN(Factory); | 40 DISALLOW_COPY_AND_ASSIGN(Factory); |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 // Must be deleted on the FILE thread. | 43 // Must be deleted on the FILE thread. |
| 44 virtual ~SettingsLeveldbStorage(); | 44 virtual ~SettingsLeveldbStorage(); |
| 45 | 45 |
| 46 // SettingsStorage implementation. | 46 // SettingsStorage implementation. |
| 47 virtual ReadResult Get(const std::string& key) OVERRIDE; | 47 virtual ReadResult Get(const std::string& key) OVERRIDE; |
| 48 virtual ReadResult Get(const std::vector<std::string>& keys) OVERRIDE; | 48 virtual ReadResult Get(const std::vector<std::string>& keys) OVERRIDE; |
| 49 virtual ReadResult Get() OVERRIDE; | 49 virtual ReadResult Get() OVERRIDE; |
| 50 virtual WriteResult Set(const std::string& key, const Value& value) OVERRIDE; | 50 virtual WriteResult Set( |
| 51 virtual WriteResult Set(const DictionaryValue& settings) OVERRIDE; | 51 WriteOptions options, |
| 52 virtual WriteResult Remove(const std::string& key) OVERRIDE; | 52 const std::string& key, |
| 53 virtual WriteResult Remove(const std::vector<std::string>& keys) OVERRIDE; | 53 const Value& value) OVERRIDE; |
| 54 virtual WriteResult Clear() OVERRIDE; | 54 virtual WriteResult Set( |
| 55 WriteOptions options, const DictionaryValue& values) OVERRIDE; |
| 56 virtual WriteResult Remove( |
| 57 WriteOptions options, const std::string& key) OVERRIDE; |
| 58 virtual WriteResult Remove( |
| 59 WriteOptions options, const std::vector<std::string>& keys) OVERRIDE; |
| 60 virtual WriteResult Clear(WriteOptions options) OVERRIDE; |
| 55 | 61 |
| 56 private: | 62 private: |
| 57 // Ownership of db is taken. | 63 // Ownership of db is taken. |
| 58 explicit SettingsLeveldbStorage( | 64 explicit SettingsLeveldbStorage( |
| 59 const FilePath& db_path, leveldb::DB* db); | 65 const FilePath& db_path, leveldb::DB* db); |
| 60 | 66 |
| 61 // Reads a setting from the database. Returns whether the read was | 67 // Reads a setting from the database. Returns whether the read was |
| 62 // successful, in which case |setting| will be reset to the Value read | 68 // successful, in which case |setting| will be reset to the Value read |
| 63 // from the database. This value may be NULL. | 69 // from the database. This value may be NULL. |
| 64 bool ReadFromDb( | 70 bool ReadFromDb( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 75 | 81 |
| 76 // leveldb backend. | 82 // leveldb backend. |
| 77 scoped_ptr<leveldb::DB> db_; | 83 scoped_ptr<leveldb::DB> db_; |
| 78 | 84 |
| 79 DISALLOW_COPY_AND_ASSIGN(SettingsLeveldbStorage); | 85 DISALLOW_COPY_AND_ASSIGN(SettingsLeveldbStorage); |
| 80 }; | 86 }; |
| 81 | 87 |
| 82 } // namespace extensions | 88 } // namespace extensions |
| 83 | 89 |
| 84 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_LEVELDB_STORAGE_H_ | 90 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_LEVELDB_STORAGE_H_ |
| OLD | NEW |