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

Unified Diff: chrome/browser/extensions/api/file_system/file_system_api.cc

Issue 2351823004: [Extensions] Consolidate ExtensionFunction::SendResponse()s (Closed)
Patch Set: lazyboy's Created 4 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: chrome/browser/extensions/api/file_system/file_system_api.cc
diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc
index 20b79586e87e5d760991f8810f18100ec2ea13e5..59614be6404cbddedb47a2bce17976c63c2d6029 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_api.cc
@@ -1330,13 +1330,11 @@ void FileSystemRequestFileSystemFunction::OnConsentReceived(
switch (result) {
case ConsentProvider::CONSENT_REJECTED:
- SetError(kSecurityError);
- SendResponse(false);
+ Respond(Error(kSecurityError));
return;
case ConsentProvider::CONSENT_IMPOSSIBLE:
- SetError(kConsentImpossible);
- SendResponse(false);
+ Respond(Error(kConsentImpossible));
return;
case ConsentProvider::CONSENT_GRANTED:
@@ -1344,8 +1342,7 @@ void FileSystemRequestFileSystemFunction::OnConsentReceived(
}
if (!volume.get()) {
- SetError(kVolumeNotFoundError);
- SendResponse(false);
+ Respond(Error(kVolumeNotFoundError));
return;
}
@@ -1360,8 +1357,7 @@ void FileSystemRequestFileSystemFunction::OnConsentReceived(
base::FilePath virtual_path;
if (!backend->GetVirtualPath(volume->mount_path(), &virtual_path)) {
- SetError(kSecurityError);
- SendResponse(false);
+ Respond(Error(kSecurityError));
return;
}
@@ -1384,8 +1380,7 @@ void FileSystemRequestFileSystemFunction::OnConsentReceived(
std::string() /* file_system_id */, original_url.path(),
&register_name);
if (file_system_id.empty()) {
- SetError(kSecurityError);
- SendResponse(false);
+ Respond(Error(kSecurityError));
return;
}
@@ -1420,8 +1415,7 @@ void FileSystemRequestFileSystemFunction::OnConsentReceived(
dict->SetString("file_system_id", file_system_id);
dict->SetString("file_system_path", register_name);
- SetResult(std::move(dict));
- SendResponse(true);
+ Respond(OneArgument(std::move(dict)));
}
FileSystemGetVolumeListFunction::FileSystemGetVolumeListFunction()

Powered by Google App Engine
This is Rietveld 408576698