| 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_STORAGE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_FACTORY_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_FACTORY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_FACTORY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 class FilePath; | 9 #include <string> |
| 10 |
| 11 #include "base/file_path.h" |
| 12 #include "base/memory/ref_counted.h" |
| 10 | 13 |
| 11 namespace extensions { | 14 namespace extensions { |
| 12 | 15 |
| 13 class SettingsStorage; | 16 class SettingsStorage; |
| 14 | 17 |
| 15 // Factory for creating SettingStorage instances. | 18 // Factory for creating SettingStorage instances. |
| 16 class SettingsStorageFactory { | 19 // |
| 20 // Refcouted because it's just too messy to distribute these objects between |
| 21 // SettingsBackend instances any other way. |
| 22 class SettingsStorageFactory |
| 23 : public base::RefCountedThreadSafe<SettingsStorageFactory> { |
| 17 public: | 24 public: |
| 18 virtual ~SettingsStorageFactory() {} | 25 // Creates a new SettingsStorage area for an extension under |base_path|. |
| 19 | 26 // Return NULL to indicate failure. Must be called on the FILE thread. |
| 20 // Create a new SettingsLeveldbStorage area. Return NULL to indicate | |
| 21 // failure. Must be called on the FILE thread. | |
| 22 virtual SettingsStorage* Create( | 27 virtual SettingsStorage* Create( |
| 23 const FilePath& base_path, const std::string& extension_id) = 0; | 28 const FilePath& base_path, const std::string& extension_id) = 0; |
| 29 |
| 30 protected: |
| 31 friend class base::RefCountedThreadSafe<SettingsStorageFactory>; |
| 32 virtual ~SettingsStorageFactory() {} |
| 24 }; | 33 }; |
| 25 | 34 |
| 26 } // namespace extensions | 35 } // namespace extensions |
| 27 | 36 |
| 28 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_FACTORY_H_ | 37 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_FACTORY_H_ |
| OLD | NEW |