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

Side by Side Diff: content/browser/intents/internal_web_intents_dispatcher.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/internal_web_intents_dispatcher.h" 5 #include "content/browser/intents/internal_web_intents_dispatcher.h"
6 6
7 #include "content/browser/intents/intent_injector.h" 7 #include "content/browser/intents/intent_injector.h"
8 #include "webkit/glue/web_intent_data.h" 8 #include "webkit/glue/web_intent_data.h"
9 #include "webkit/glue/web_intent_reply_data.h" 9 #include "webkit/glue/web_intent_reply_data.h"
10 10
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 void InternalWebIntentsDispatcher::DispatchIntent( 31 void InternalWebIntentsDispatcher::DispatchIntent(
32 WebContents* destination_contents) { 32 WebContents* destination_contents) {
33 DCHECK(destination_contents); 33 DCHECK(destination_contents);
34 DCHECK(!intent_injector_); 34 DCHECK(!intent_injector_);
35 intent_injector_ = new IntentInjector(destination_contents); 35 intent_injector_ = new IntentInjector(destination_contents);
36 intent_injector_->SetIntent(this, intent_); 36 intent_injector_->SetIntent(this, intent_);
37 } 37 }
38 38
39 void InternalWebIntentsDispatcher::ResetDispatch() {
40 if (intent_injector_) {
41 intent_injector_->Abandon();
42 intent_injector_ = NULL;
43 }
44 }
45
39 void InternalWebIntentsDispatcher::SendReplyMessage( 46 void InternalWebIntentsDispatcher::SendReplyMessage(
40 webkit_glue::WebIntentReplyType reply_type, 47 webkit_glue::WebIntentReplyType reply_type,
41 const string16& data) { 48 const string16& data) {
42 intent_injector_ = NULL; 49 intent_injector_ = NULL;
43 50
44 for (size_t i = 0; i < reply_notifiers_.size(); ++i) { 51 for (size_t i = 0; i < reply_notifiers_.size(); ++i) {
45 if (!reply_notifiers_[i].is_null()) 52 if (!reply_notifiers_[i].is_null())
46 reply_notifiers_[i].Run(reply_type); 53 reply_notifiers_[i].Run(reply_type);
47 } 54 }
48 55
49 // Notify the callback of the reply. 56 // Notify the callback of the reply.
50 if (!reply_callback_.is_null()) 57 if (!reply_callback_.is_null())
51 reply_callback_.Run(reply_type, data); 58 reply_callback_.Run(reply_type, data);
52 59
53 delete this; 60 delete this;
54 } 61 }
55 62
56 void InternalWebIntentsDispatcher::RegisterReplyNotification( 63 void InternalWebIntentsDispatcher::RegisterReplyNotification(
57 const content::WebIntentsDispatcher::ReplyNotification& closure) { 64 const content::WebIntentsDispatcher::ReplyNotification& closure) {
58 reply_notifiers_.push_back(closure); 65 reply_notifiers_.push_back(closure);
59 } 66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698