| 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 11 matching lines...) Expand all Loading... |
| 22 // Extension settings storage object, backed by a leveldb database. | 22 // Extension settings storage object, backed by a leveldb database. |
| 23 // | 23 // |
| 24 // No caching is done; that should be handled by wrapping with an | 24 // No caching is done; that should be handled by wrapping with an |
| 25 // SettingsStorageCache. | 25 // SettingsStorageCache. |
| 26 // All methods must be run on the FILE thread. | 26 // All methods must be run on the FILE thread. |
| 27 class SettingsLeveldbStorage : public SettingsStorage { | 27 class SettingsLeveldbStorage : public SettingsStorage { |
| 28 public: | 28 public: |
| 29 // Factory for creating SettingsLeveldbStorage instances. | 29 // Factory for creating SettingsLeveldbStorage instances. |
| 30 class Factory : public SettingsStorageFactory { | 30 class Factory : public SettingsStorageFactory { |
| 31 public: | 31 public: |
| 32 Factory() {} | |
| 33 virtual ~Factory() {} | |
| 34 | |
| 35 // SettingsStorageFactory implementation. | |
| 36 virtual SettingsStorage* Create( | 32 virtual SettingsStorage* Create( |
| 37 const FilePath& base_path, const std::string& extension_id) OVERRIDE; | 33 const FilePath& base_path, |
| 34 const std::string& extension_id) OVERRIDE; |
| 38 | 35 |
| 39 private: | 36 private: |
| 40 DISALLOW_COPY_AND_ASSIGN(Factory); | 37 // SettingsStorageFactory is refcounted. |
| 38 virtual ~Factory() {} |
| 41 }; | 39 }; |
| 42 | 40 |
| 43 // Must be deleted on the FILE thread. | 41 // Must be deleted on the FILE thread. |
| 44 virtual ~SettingsLeveldbStorage(); | 42 virtual ~SettingsLeveldbStorage(); |
| 45 | 43 |
| 46 // SettingsStorage implementation. | 44 // SettingsStorage implementation. |
| 47 virtual ReadResult Get(const std::string& key) OVERRIDE; | 45 virtual ReadResult Get(const std::string& key) OVERRIDE; |
| 48 virtual ReadResult Get(const std::vector<std::string>& keys) OVERRIDE; | 46 virtual ReadResult Get(const std::vector<std::string>& keys) OVERRIDE; |
| 49 virtual ReadResult Get() OVERRIDE; | 47 virtual ReadResult Get() OVERRIDE; |
| 50 virtual WriteResult Set( | 48 virtual WriteResult Set( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 79 | 77 |
| 80 // leveldb backend. | 78 // leveldb backend. |
| 81 scoped_ptr<leveldb::DB> db_; | 79 scoped_ptr<leveldb::DB> db_; |
| 82 | 80 |
| 83 DISALLOW_COPY_AND_ASSIGN(SettingsLeveldbStorage); | 81 DISALLOW_COPY_AND_ASSIGN(SettingsLeveldbStorage); |
| 84 }; | 82 }; |
| 85 | 83 |
| 86 } // namespace extensions | 84 } // namespace extensions |
| 87 | 85 |
| 88 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_LEVELDB_STORAGE_H_ | 86 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_LEVELDB_STORAGE_H_ |
| OLD | NEW |