Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: chrome/browser/extensions/api/storage/settings_storage_factory.h

Issue 165223003: Add a Restore() method to ValueStore and make StorageAPI use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_API_STORAGE_SETTINGS_STORAGE_FACTORY_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_STORAGE_FACTORY_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_STORAGE_FACTORY_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_STORAGE_FACTORY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 12
13 class ValueStore; 13 class ValueStore;
14 14
15 namespace extensions { 15 namespace extensions {
16 16
17 // Factory for creating SettingStorage instances. 17 // Factory for creating SettingStorage instances.
18 // 18 //
19 // Refcouted because it's just too messy to distribute these objects between 19 // Refcouted because it's just too messy to distribute these objects between
20 // SettingsBackend instances any other way. 20 // SettingsBackend instances any other way.
21 class SettingsStorageFactory 21 class SettingsStorageFactory
22 : public base::RefCountedThreadSafe<SettingsStorageFactory> { 22 : public base::RefCountedThreadSafe<SettingsStorageFactory> {
23 public: 23 public:
24 // Creates a new ValueStore area for an extension under |base_path|. 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. 25 // Return NULL to indicate failure. Must be called on the FILE thread.
26 virtual ValueStore* Create(const base::FilePath& base_path, 26 virtual ValueStore* Create(const base::FilePath& base_path,
27 const std::string& extension_id) = 0; 27 const std::string& extension_id) = 0;
28 28
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;
34
29 protected: 35 protected:
30 friend class base::RefCountedThreadSafe<SettingsStorageFactory>; 36 friend class base::RefCountedThreadSafe<SettingsStorageFactory>;
31 virtual ~SettingsStorageFactory() {} 37 virtual ~SettingsStorageFactory() {}
32 }; 38 };
33 39
34 } // namespace extensions 40 } // namespace extensions
35 41
36 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_STORAGE_FACTORY_H_ 42 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_STORAGE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698