diff options
author | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-21 19:16:42 +0000 |
---|---|---|
committer | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-21 19:16:42 +0000 |
commit | 29a6c9738ebb608d40567189452fd9c19f55569c (patch) | |
tree | 3ec69ea2bb2d88067928a52bfb30ab1536e2da77 /content/browser | |
parent | a78f42738deb2e86f162657fdab4f459df06850f (diff) | |
download | chromium_src-29a6c9738ebb608d40567189452fd9c19f55569c.zip chromium_src-29a6c9738ebb608d40567189452fd9c19f55569c.tar.gz chromium_src-29a6c9738ebb608d40567189452fd9c19f55569c.tar.bz2 |
[Web Intents] Add a source tab observation mechanism so you can see if the source tab closes and avoid updating.
R=groby@chromium.org
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/8365004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106754 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
-rw-r--r-- | content/browser/intents/intent_injector.cc | 10 | ||||
-rw-r--r-- | content/browser/intents/intent_injector.h | 5 |
2 files changed, 10 insertions, 5 deletions
diff --git a/content/browser/intents/intent_injector.cc b/content/browser/intents/intent_injector.cc index a8d74f8..5a7575d 100644 --- a/content/browser/intents/intent_injector.cc +++ b/content/browser/intents/intent_injector.cc @@ -24,7 +24,7 @@ IntentInjector::~IntentInjector() { } void IntentInjector::TabContentsDestroyed(TabContents* tab) { - if (source_tab_.get()) { + if (source_tab_.get() != NULL) { source_tab_->Send(new IntentsMsg_WebIntentReply( 0, webkit_glue::WEB_INTENT_SERVICE_TAB_CLOSED, string16(), intent_id_)); source_tab_.reset(NULL); @@ -33,6 +33,10 @@ void IntentInjector::TabContentsDestroyed(TabContents* tab) { delete this; } +void IntentInjector::SourceTabContentsDestroyed(TabContents* tab) { + source_tab_.reset(NULL); +} + void IntentInjector::SetIntent(IPC::Message::Sender* source_tab, const webkit_glue::WebIntentData& intent, int intent_id) { @@ -91,9 +95,7 @@ void IntentInjector::OnReply(const IPC::Message& message, if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents)) NOTREACHED(); - // TODO(gbillock): We need to observe source_tab_ and make - // sure it hasn't been closed or something... - if (source_tab_.get()) { + if (source_tab_.get() != NULL) { source_tab_->Send(new IntentsMsg_WebIntentReply( 0, reply_type, data, intent_id)); source_tab_.reset(NULL); diff --git a/content/browser/intents/intent_injector.h b/content/browser/intents/intent_injector.h index 497d074..4b9fabb 100644 --- a/content/browser/intents/intent_injector.h +++ b/content/browser/intents/intent_injector.h @@ -41,6 +41,9 @@ class CONTENT_EXPORT IntentInjector : public TabContentsObserver { virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE; + // Used to notify the object that the source tab has been destroyed. + virtual void SourceTabContentsDestroyed(TabContents* tab); + // Sets the intent data to be injected. Call after the user has selected a // service to pass the intent data to that service. // |source_tab| is a sender to use to communicate to the source tab. Takes @@ -65,7 +68,7 @@ class CONTENT_EXPORT IntentInjector : public TabContentsObserver { // Source intent data provided by caller. scoped_ptr<webkit_glue::WebIntentData> source_intent_; - // The tab invoking the intent. + // Message forwarder to the tab invoking the intent. scoped_ptr<IPC::Message::Sender> source_tab_; // Unique ID assigned to the intent by the source tab. |