Index: chrome/browser/extensions/api/declarative/declarative_api.cc |
diff --git a/chrome/browser/extensions/api/declarative/declarative_api.cc b/chrome/browser/extensions/api/declarative/declarative_api.cc |
index 8f094117fd946f7e73dfcbaccc5b0d5bf5c37705..d85caa287d9459f3f70f5f0ed53f9df374fa6d6c 100644 |
--- a/chrome/browser/extensions/api/declarative/declarative_api.cc |
+++ b/chrome/browser/extensions/api/declarative/declarative_api.cc |
@@ -53,23 +53,21 @@ bool RulesFunction::RunImpl() { |
EXTENSION_FUNCTION_VALIDATE(rules_registry_); |
if (content::BrowserThread::CurrentlyOn(rules_registry_->GetOwnerThread())) { |
- RunImplOnCorrectThread(); |
- SendResponseOnUIThread(); |
+ bool success = RunImplOnCorrectThread(); |
+ SendResponse(success); |
} else { |
- content::BrowserThread::PostTaskAndReply( |
- rules_registry_->GetOwnerThread(), FROM_HERE, |
- base::Bind(base::IgnoreResult(&RulesFunction::RunImplOnCorrectThread), |
- this), |
- base::Bind(&RulesFunction::SendResponseOnUIThread, this)); |
+ scoped_refptr<base::MessageLoopProxy> message_loop_proxy = |
+ content::BrowserThread::GetMessageLoopProxyForThread( |
+ rules_registry_->GetOwnerThread()); |
+ message_loop_proxy->PostTaskAndReplyWithResult( |
+ FROM_HERE, |
+ base::Bind(&RulesFunction::RunImplOnCorrectThread, this), |
+ base::Bind(&RulesFunction::SendResponse, this)); |
} |
return true; |
} |
-void RulesFunction::SendResponseOnUIThread() { |
- SendResponse(error_.empty()); |
-} |
- |
bool AddRulesFunction::RunImplOnCorrectThread() { |
scoped_ptr<AddRules::Params> params(AddRules::Params::Create(*args_)); |
EXTENSION_FUNCTION_VALIDATE(params.get()); |