|
@@ -588,7 +588,7 @@ void FileSystemAccessPermissionContext::ConfirmSensitiveEntryAccess(
|
|
|
content::GlobalRenderFrameHostId frame_id,
|
|
|
base::OnceCallback<void(SensitiveEntryResult)> callback) {
|
|
|
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
- callback_ = std::move(callback);
|
|
|
+ callback_map_[path_info.path] = std::move(callback);
|
|
|
|
|
|
auto after_blocklist_check_callback = base::BindOnce(
|
|
|
&FileSystemAccessPermissionContext::DidCheckPathAgainstBlocklist,
|
|
@@ -632,16 +632,18 @@ void FileSystemAccessPermissionContext::PerformAfterWriteChecks(
|
|
|
}
|
|
|
|
|
|
void FileSystemAccessPermissionContext::RunRestrictedPathCallback(
|
|
|
+ const base::FilePath& file_path,
|
|
|
SensitiveEntryResult result) {
|
|
|
- if (callback_)
|
|
|
- std::move(callback_).Run(result);
|
|
|
+ if (base::Contains(callback_map_, file_path))
|
|
|
+ std::move(callback_map_[file_path]).Run(result);
|
|
|
}
|
|
|
|
|
|
void FileSystemAccessPermissionContext::OnRestrictedPathResult(
|
|
|
+ const base::FilePath& file_path,
|
|
|
gin::Arguments* args) {
|
|
|
SensitiveEntryResult result = SensitiveEntryResult::kAbort;
|
|
|
args->GetNext(&result);
|
|
|
- RunRestrictedPathCallback(result);
|
|
|
+ RunRestrictedPathCallback(file_path, result);
|
|
|
}
|
|
|
|
|
|
void FileSystemAccessPermissionContext::DidCheckPathAgainstBlocklist(
|
|
@@ -654,8 +656,9 @@ void FileSystemAccessPermissionContext::DidCheckPathAgainstBlocklist(
|
|
|
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
|
|
|
|
|
if (user_action == UserAction::kNone) {
|
|
|
- RunRestrictedPathCallback(should_block ? SensitiveEntryResult::kAbort
|
|
|
- : SensitiveEntryResult::kAllowed);
|
|
|
+ auto result = should_block ? SensitiveEntryResult::kAbort
|
|
|
+ : SensitiveEntryResult::kAllowed;
|
|
|
+ RunRestrictedPathCallback(path_info.path, result);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -674,11 +677,11 @@ void FileSystemAccessPermissionContext::DidCheckPathAgainstBlocklist(
|
|
|
"file-system-access-restricted", details,
|
|
|
base::BindRepeating(
|
|
|
&FileSystemAccessPermissionContext::OnRestrictedPathResult,
|
|
|
- weak_factory_.GetWeakPtr()));
|
|
|
+ weak_factory_.GetWeakPtr(), path_info.path));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- RunRestrictedPathCallback(SensitiveEntryResult::kAllowed);
|
|
|
+ RunRestrictedPathCallback(path_info.path, SensitiveEntryResult::kAllowed);
|
|
|
}
|
|
|
|
|
|
void FileSystemAccessPermissionContext::MaybeEvictEntries(
|