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

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

Issue 10218009: Allow severing connection between dispatcher and injector (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix compile issue for browser_tests Created 8 years, 8 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 | « content/browser/intents/intent_injector.h ('k') | content/browser/intents/intent_injector_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « content/browser/intents/intent_injector.h ('k') | content/browser/intents/intent_injector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698