Update path of checkdeps to buildtools checkout
[chromium-blink-merge.git] / extensions / browser / api / storage / settings_storage_factory.h
blob14f61878174be065a22b7054220177bfbe0eb385
1 // Copyright 2014 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.
5 #ifndef EXTENSIONS_BROWSER_API_STORAGE_SETTINGS_STORAGE_FACTORY_H_
6 #define EXTENSIONS_BROWSER_API_STORAGE_SETTINGS_STORAGE_FACTORY_H_
8 #include <string>
10 #include "base/files/file_path.h"
11 #include "base/memory/ref_counted.h"
13 class ValueStore;
15 namespace extensions {
17 // Factory for creating SettingStorage instances.
19 // Refcouted because it's just too messy to distribute these objects between
20 // ValueStoreCache instances any other way.
21 class SettingsStorageFactory
22 : public base::RefCountedThreadSafe<SettingsStorageFactory> {
23 public:
24 // Creates a new ValueStore area for an extension under |base_path|.
25 // Return NULL to indicate failure. Must be called on the FILE thread.
26 virtual ValueStore* Create(const base::FilePath& base_path,
27 const std::string& extension_id) = 0;
29 // Deletes the database for the extension, if one exists.
30 // Note: it is important to delete references to the database if any are
31 // held, because ValueStores will create themselves if there is no file.
32 virtual void DeleteDatabaseIfExists(const base::FilePath& base_path,
33 const std::string& extension_id) = 0;
35 protected:
36 friend class base::RefCountedThreadSafe<SettingsStorageFactory>;
37 virtual ~SettingsStorageFactory() {}
40 } // namespace extensions
42 #endif // EXTENSIONS_BROWSER_API_STORAGE_SETTINGS_STORAGE_FACTORY_H_