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

Unified Diff: extensions/browser/extension_function.cc

Issue 2348723002: [Extensions] Remove UIThreadExtensionFunction::DelegateForTests (Closed)
Patch Set: polish 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: extensions/browser/extension_function.cc
diff --git a/extensions/browser/extension_function.cc b/extensions/browser/extension_function.cc
index e734dee7e8699e31f7f27ca9e813a853eeb2bc05..a32bdc2e3bf29320bb52ae940da9660017d3242c 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_ = base::MakeUnique<ResponseType>(response);
lazyboy 2016/09/19 18:08:56 I'd name this response_type_ (and the getter). Bec
Devlin 2016/09/19 20:14:20 SG, done.
// 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_));
}
« extensions/browser/extension_function.h ('K') | « extensions/browser/extension_function.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698