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

Side by Side Diff: content/browser/intents/web_intents_dispatcher_impl.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/intents/web_intents_dispatcher_impl.h" 5 #include "content/browser/intents/web_intents_dispatcher_impl.h"
6 6
7 #include "content/browser/intents/intent_injector.h" 7 #include "content/browser/intents/intent_injector.h"
8 #include "content/browser/intents/internal_web_intents_dispatcher.h" 8 #include "content/browser/intents/internal_web_intents_dispatcher.h"
9 #include "content/browser/web_contents/web_contents_impl.h" 9 #include "content/browser/web_contents/web_contents_impl.h"
10 #include "content/common/intents_messages.h" 10 #include "content/common/intents_messages.h"
(...skipping 27 matching lines...) Expand all
38 return intent_; 38 return intent_;
39 } 39 }
40 40
41 void WebIntentsDispatcherImpl::DispatchIntent( 41 void WebIntentsDispatcherImpl::DispatchIntent(
42 WebContents* destination_contents) { 42 WebContents* destination_contents) {
43 DCHECK(!intent_injector_); 43 DCHECK(!intent_injector_);
44 intent_injector_ = new IntentInjector(destination_contents); 44 intent_injector_ = new IntentInjector(destination_contents);
45 intent_injector_->SetIntent(this, intent_); 45 intent_injector_->SetIntent(this, intent_);
46 } 46 }
47 47
48 void WebIntentsDispatcherImpl::ResetDispatch() {
49 if (intent_injector_) {
50 intent_injector_->Abandon();
51 intent_injector_ = NULL;
52 }
53 }
54
48 void WebIntentsDispatcherImpl::SendReplyMessage( 55 void WebIntentsDispatcherImpl::SendReplyMessage(
49 webkit_glue::WebIntentReplyType reply_type, 56 webkit_glue::WebIntentReplyType reply_type,
50 const string16& data) { 57 const string16& data) {
51 intent_injector_ = NULL; 58 intent_injector_ = NULL;
52 59
53 if (web_contents()) { 60 if (web_contents()) {
54 Send(new IntentsMsg_WebIntentReply( 61 Send(new IntentsMsg_WebIntentReply(
55 routing_id(), reply_type, data, intent_id_)); 62 routing_id(), reply_type, data, intent_id_));
56 } 63 }
57 64
58 for (size_t i = 0; i < reply_notifiers_.size(); ++i) { 65 for (size_t i = 0; i < reply_notifiers_.size(); ++i) {
59 if (!reply_notifiers_[i].is_null()) 66 if (!reply_notifiers_[i].is_null())
60 reply_notifiers_[i].Run(reply_type); 67 reply_notifiers_[i].Run(reply_type);
61 } 68 }
62 69
63 delete this; 70 delete this;
64 } 71 }
65 72
66 void WebIntentsDispatcherImpl::RegisterReplyNotification( 73 void WebIntentsDispatcherImpl::RegisterReplyNotification(
67 const content::WebIntentsDispatcher::ReplyNotification& closure) { 74 const content::WebIntentsDispatcher::ReplyNotification& closure) {
68 reply_notifiers_.push_back(closure); 75 reply_notifiers_.push_back(closure);
69 } 76 }
70 77
71 void WebIntentsDispatcherImpl::WebContentsDestroyed(WebContents* contents) { 78 void WebIntentsDispatcherImpl::WebContentsDestroyed(WebContents* contents) {
72 if (intent_injector_) 79 if (intent_injector_)
73 intent_injector_->SourceWebContentsDestroyed(contents); 80 intent_injector_->SourceWebContentsDestroyed(contents);
74 81
75 intent_injector_ = NULL; 82 intent_injector_ = NULL;
76 } 83 }
OLDNEW
« no previous file with comments | « content/browser/intents/web_intents_dispatcher_impl.h ('k') | content/public/browser/web_intents_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698