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

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

Issue 10218009: Allow severing connection between dispatcher and injector (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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
Index: content/browser/intents/intent_injector.h
diff --git a/content/browser/intents/intent_injector.h b/content/browser/intents/intent_injector.h
index 30b9c7a616d41a48cf3363a52c13b7eaae4fafac..85d290ee6ae527552d8d379ab8e504a391374a82 100644
--- a/content/browser/intents/intent_injector.h
+++ b/content/browser/intents/intent_injector.h
@@ -7,7 +7,9 @@
#pragma once
#include "base/basictypes.h"
+#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "base/string16.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/common/content_export.h"
@@ -55,7 +57,14 @@ class CONTENT_EXPORT IntentInjector : public content::WebContentsObserver {
void SetIntent(content::WebIntentsDispatcher* intents_dispatcher,
const webkit_glue::WebIntentData& intent);
+ // Abandon this injector. Used when re-delivering an intent to a different
+ // service provider, i.e. when abandoning an inline disposition and picking
+ // a new provider.
Greg Billock 2012/04/25 14:26:52 Document that this self-deletes.
groby-ooo-7-16 2012/04/25 16:40:10 Done.
+ void Abandon();
+
private:
+ FRIEND_TEST_ALL_PREFIXES(IntentInjectorTest, AbandonDeletes);
+
// Handles receiving a reply from the intent delivery page.
void OnReply(webkit_glue::WebIntentReplyType reply_type,
const string16& data);
@@ -72,6 +81,11 @@ class CONTENT_EXPORT IntentInjector : public content::WebContentsObserver {
// Remember the initial delivery url for origin restriction.
GURL initial_url_;
+ // The injector is used as a callback target by the intent dispatcher,
+ // but is not guaranteed to outlive it. Use weak pointers to handle lifetime
Greg Billock 2012/04/25 14:26:52 "The injector may be Abandon()ed and deleted befor
groby-ooo-7-16 2012/04/25 16:40:10 Done.
+ // issues.
+ base::WeakPtrFactory<IntentInjector> weak_factory_;
Greg Billock 2012/04/25 14:26:52 weak_ptr_factory_
groby-ooo-7-16 2012/04/25 16:40:10 weak_factory_ seems to be the preferred naming, ac
+
DISALLOW_COPY_AND_ASSIGN(IntentInjector);
};
« no previous file with comments | « no previous file | content/browser/intents/intent_injector.cc » ('j') | content/browser/intents/intent_injector_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698