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

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

Issue 8666013: Add a public content/ interface for intents. Use it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For try servers. 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
« no previous file with comments | « content/browser/intents/intent_injector.h ('k') | content/browser/intents/intents_host_impl.h » ('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 1fc3bf3475feb9793acfdc0fb0bbfa39fb08d13a..dd8f5fb7b6a371b9bab94b6b8c7b8195870d8de4 100644
--- a/content/browser/intents/intent_injector.cc
+++ b/content/browser/intents/intent_injector.cc
@@ -16,6 +16,7 @@
IntentInjector::IntentInjector(TabContents* tab_contents)
: TabContentsObserver(tab_contents),
+ source_tab_(NULL),
intent_id_(0) {
DCHECK(tab_contents);
}
@@ -24,10 +25,8 @@ IntentInjector::~IntentInjector() {
}
void IntentInjector::TabContentsDestroyed(TabContents* tab) {
- if (source_tab_.get() != NULL) {
- scoped_ptr<IPC::Message::Sender> sender;
- sender.swap(source_tab_);
- sender->Send(new IntentsMsg_WebIntentReply(
+ if (source_tab_) {
+ source_tab_->Send(new IntentsMsg_WebIntentReply(
0, webkit_glue::WEB_INTENT_SERVICE_TAB_CLOSED, string16(), intent_id_));
}
@@ -35,13 +34,13 @@ void IntentInjector::TabContentsDestroyed(TabContents* tab) {
}
void IntentInjector::SourceTabContentsDestroyed(TabContents* tab) {
- source_tab_.reset(NULL);
+ source_tab_ = NULL;
}
void IntentInjector::SetIntent(IPC::Message::Sender* source_tab,
const webkit_glue::WebIntentData& intent,
int intent_id) {
- source_tab_.reset(source_tab);
+ source_tab_ = source_tab;
source_intent_.reset(new webkit_glue::WebIntentData(intent));
intent_id_ = intent_id;
@@ -96,12 +95,8 @@ void IntentInjector::OnReply(const IPC::Message& message,
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents))
NOTREACHED();
- if (source_tab_.get() != NULL) {
- // 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(
+ if (source_tab_) {
+ source_tab_->Send(new IntentsMsg_WebIntentReply(
0, reply_type, data, intent_id));
}
}
« no previous file with comments | « content/browser/intents/intent_injector.h ('k') | content/browser/intents/intents_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698