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

Unified Diff: storage/browser/fileapi/obfuscated_file_util.cc

Issue 580363003: Fix ObfuscatedFileUtil::DeleteDirectoryForOriginAndType() to support plugin private file system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: storage/browser/fileapi/obfuscated_file_util.cc
diff --git a/storage/browser/fileapi/obfuscated_file_util.cc b/storage/browser/fileapi/obfuscated_file_util.cc
index 8c02dd11bf4a18e2fbcbd7ab2bdc0edbd6b6a1ca..58c0fe1759665414d3cd3f0c669564e9a7cf2fa4 100644
--- a/storage/browser/fileapi/obfuscated_file_util.cc
+++ b/storage/browser/fileapi/obfuscated_file_util.cc
@@ -874,23 +874,35 @@ bool ObfuscatedFileUtil::DeleteDirectoryForOriginAndType(
return false;
}
+ if (type_string.empty()) {
+ // The |origin_type_path| is the topmost origin directory if |type_string|
+ // is empty. We should have already deleted that directory.
+ // Now clear the database and we are done.
+ InitOriginDatabase(origin, false);
+ if (origin_database_) {
+ if (!origin_database_->RemovePathForOrigin(
+ storage::GetIdentifierFromOrigin(origin))) {
+ LOG(WARNING) << "Cannot remove path from origin database.";
+ }
+ }
+ return true;
+ }
+
base::FilePath origin_path = VirtualPath::DirName(origin_type_path);
DCHECK_EQ(origin_path.value(),
GetDirectoryForOrigin(origin, false, NULL).value());
- if (!type_string.empty()) {
- // At this point we are sure we had successfully deleted the origin/type
- // directory (i.e. we're ready to just return true).
- // See if we have other directories in this origin directory.
- for (std::set<std::string>::iterator iter = known_type_strings_.begin();
- iter != known_type_strings_.end();
- ++iter) {
- if (*iter == type_string)
- continue;
- if (base::DirectoryExists(origin_path.AppendASCII(*iter))) {
- // Other type's directory exists; just return true here.
- return true;
- }
+ // At this point we are sure we had successfully deleted the origin/type
+ // directory (i.e. we're ready to just return true).
+ // See if we have other directories in this origin directory.
+ for (std::set<std::string>::iterator iter = known_type_strings_.begin();
+ iter != known_type_strings_.end();
+ ++iter) {
+ if (*iter == type_string)
+ continue;
+ if (base::DirectoryExists(origin_path.AppendASCII(*iter))) {
+ // Other type's directory exists; just return true here.
+ return true;
}
}

Powered by Google App Engine
This is Rietveld 408576698