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

Unified Diff: content/browser/intents/intent_injector.cc

Issue 8508019: Add a method to the controller to close the picker/service tab when a return value is passed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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: content/browser/intents/intent_injector.cc
diff --git a/content/browser/intents/intent_injector.cc b/content/browser/intents/intent_injector.cc
index 5a7575d62f74545ef4a8edb32161dad8582faea1..9b972b18cb3d1bad9f1dcdbf329b27c876880811 100644
--- a/content/browser/intents/intent_injector.cc
+++ b/content/browser/intents/intent_injector.cc
@@ -25,9 +25,10 @@ IntentInjector::~IntentInjector() {
void IntentInjector::TabContentsDestroyed(TabContents* tab) {
if (source_tab_.get() != NULL) {
- source_tab_->Send(new IntentsMsg_WebIntentReply(
+ scoped_ptr<IPC::Message::Sender> sender;
+ sender.swap(source_tab_);
+ sender->Send(new IntentsMsg_WebIntentReply(
0, webkit_glue::WEB_INTENT_SERVICE_TAB_CLOSED, string16(), intent_id_));
- source_tab_.reset(NULL);
}
delete this;
@@ -96,8 +97,11 @@ void IntentInjector::OnReply(const IPC::Message& message,
NOTREACHED();
if (source_tab_.get() != NULL) {
- source_tab_->Send(new IntentsMsg_WebIntentReply(
+ // Swap before use since sending this message may cause
+ // TabContentsDestroyed to be called.
+ scoped_ptr<IPC::Message::Sender> sender;
+ sender.swap(source_tab_);
+ sender->Send(new IntentsMsg_WebIntentReply(
0, reply_type, data, intent_id));
- source_tab_.reset(NULL);
}
}

Powered by Google App Engine
This is Rietveld 408576698