| Index: content/browser/intents/intent_injector.cc
|
| diff --git a/content/browser/intents/intent_injector.cc b/content/browser/intents/intent_injector.cc
|
| index 3ff86221213c222e90af21079e56bc89aeb57b51..1b44df180fda70770ebe32607723ab06d3445bec 100644
|
| --- a/content/browser/intents/intent_injector.cc
|
| +++ b/content/browser/intents/intent_injector.cc
|
| @@ -23,7 +23,8 @@ using content::WebContents;
|
|
|
| IntentInjector::IntentInjector(WebContents* web_contents)
|
| : content::WebContentsObserver(web_contents),
|
| - intents_dispatcher_(NULL) {
|
| + intents_dispatcher_(NULL),
|
| + ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
|
| DCHECK(web_contents);
|
| }
|
|
|
| @@ -48,11 +49,17 @@ void IntentInjector::SetIntent(
|
| const webkit_glue::WebIntentData& intent) {
|
| intents_dispatcher_ = intents_dispatcher;
|
| intents_dispatcher_->RegisterReplyNotification(
|
| - base::Bind(&IntentInjector::OnSendReturnMessage, base::Unretained(this)));
|
| + base::Bind(&IntentInjector::OnSendReturnMessage,
|
| + weak_factory_.GetWeakPtr()));
|
| source_intent_.reset(new webkit_glue::WebIntentData(intent));
|
| initial_url_ = web_contents()->GetPendingSiteInstance()->GetSite();
|
| }
|
|
|
| +void IntentInjector::Abandon() {
|
| + intents_dispatcher_ = NULL;
|
| + delete this;
|
| +}
|
| +
|
| void IntentInjector::OnSendReturnMessage(
|
| webkit_glue::WebIntentReplyType reply_type) {
|
| intents_dispatcher_ = NULL;
|
|
|