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

Unified Diff: extensions/browser/extension_function.cc

Issue 2348723002: [Extensions] Remove UIThreadExtensionFunction::DelegateForTests (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
« no previous file with comments | « extensions/browser/extension_function.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_function.cc
diff --git a/extensions/browser/extension_function.cc b/extensions/browser/extension_function.cc
index e734dee7e8699e31f7f27ca9e813a853eeb2bc05..2ae214106f4cff0be94992fc35c3bbe208874b90 100644
--- a/extensions/browser/extension_function.cc
+++ b/extensions/browser/extension_function.cc
@@ -449,17 +449,18 @@ bool ExtensionFunction::HasOptionalArgument(size_t index) {
void ExtensionFunction::SendResponseImpl(bool success) {
DCHECK(!response_callback_.is_null());
- ResponseType type = success ? SUCCEEDED : FAILED;
+ ResponseType response = success ? SUCCEEDED : FAILED;
if (bad_message_) {
- type = BAD_MESSAGE;
+ response = BAD_MESSAGE;
LOG(ERROR) << "Bad extension message " << name_;
}
+ response_type_ = base::MakeUnique<ResponseType>(response);
// If results were never set, we send an empty argument list.
if (!results_)
results_.reset(new base::ListValue());
- response_callback_.Run(type, *results_, GetError(), histogram_value());
+ response_callback_.Run(response, *results_, GetError(), histogram_value());
LogUma(success, timer_.Elapsed(), histogram_value_);
}
@@ -470,8 +471,7 @@ void ExtensionFunction::OnRespondingLater(ResponseValue value) {
UIThreadExtensionFunction::UIThreadExtensionFunction()
: context_(nullptr),
render_frame_host_(nullptr),
- is_from_service_worker_(false),
- delegate_(nullptr) {}
+ is_from_service_worker_(false) {}
UIThreadExtensionFunction::~UIThreadExtensionFunction() {
if (dispatcher() && render_frame_host())
@@ -551,13 +551,9 @@ content::WebContents* UIThreadExtensionFunction::GetSenderWebContents() {
void UIThreadExtensionFunction::SendResponse(bool success) {
DCHECK(!did_respond_) << name_;
did_respond_ = true;
- if (delegate_)
- delegate_->OnSendResponse(this, success, bad_message_);
- else
- SendResponseImpl(success);
+ SendResponseImpl(success);
if (!transferred_blob_uuids_.empty()) {
- DCHECK(!delegate_) << "Blob transfer not supported with test delegate.";
render_frame_host_->Send(
new ExtensionMsg_TransferBlobs(transferred_blob_uuids_));
}
« no previous file with comments | « extensions/browser/extension_function.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698