Index: chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.cc |
diff --git a/chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.cc b/chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.cc |
index f58ff7c1af89762c011ac23727aa6ca0e1657fd5..195e45a492619a602d2cd562838ea509cd9b0786 100644 |
--- a/chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.cc |
+++ b/chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.cc |
@@ -4,15 +4,33 @@ |
#include "chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.h" |
+#include "base/file_util.h" |
#include "base/logging.h" |
#include "chrome/browser/value_store/leveldb_value_store.h" |
namespace extensions { |
+namespace { |
+ |
+base::FilePath GetDatabasePath(const base::FilePath& base_path, |
+ const std::string& extension_id) { |
+ return base_path.AppendASCII(extension_id); |
+} |
+ |
+} // namespace |
+ |
ValueStore* LeveldbSettingsStorageFactory::Create( |
const base::FilePath& base_path, |
const std::string& extension_id) { |
- return new LeveldbValueStore(base_path.AppendASCII(extension_id)); |
+ return new LeveldbValueStore(GetDatabasePath(base_path, extension_id)); |
+} |
+ |
+void LeveldbSettingsStorageFactory::DeleteDatabaseIfExists( |
+ const base::FilePath& base_path, |
+ const std::string& extension_id) { |
+ base::FilePath path = GetDatabasePath(base_path, extension_id); |
+ if (base::PathExists(path)) |
+ base::DeleteFile(path, true /* recursive */); |
} |
} // namespace extensions |