| OLD | NEW |
| 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 25 matching lines...) Expand all Loading... |
| 36 intent_injector_->SetIntent(this, intent_); | 36 intent_injector_->SetIntent(this, intent_); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void InternalWebIntentsDispatcher::ResetDispatch() { | 39 void InternalWebIntentsDispatcher::ResetDispatch() { |
| 40 if (intent_injector_) { | 40 if (intent_injector_) { |
| 41 intent_injector_->Abandon(); | 41 intent_injector_->Abandon(); |
| 42 intent_injector_ = NULL; | 42 intent_injector_ = NULL; |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 void InternalWebIntentsDispatcher::SendReplyMessage( | |
| 47 webkit_glue::WebIntentReplyType reply_type, | |
| 48 const string16& data) { | |
| 49 SendReply(webkit_glue::WebIntentReply(reply_type, data)); | |
| 50 } | |
| 51 | |
| 52 void InternalWebIntentsDispatcher::SendReply( | 46 void InternalWebIntentsDispatcher::SendReply( |
| 53 const webkit_glue::WebIntentReply& reply) { | 47 const webkit_glue::WebIntentReply& reply) { |
| 54 intent_injector_ = NULL; | 48 intent_injector_ = NULL; |
| 55 | 49 |
| 56 for (size_t i = 0; i < reply_notifiers_.size(); ++i) { | 50 for (size_t i = 0; i < reply_notifiers_.size(); ++i) { |
| 57 if (!reply_notifiers_[i].is_null()) | 51 if (!reply_notifiers_[i].is_null()) |
| 58 reply_notifiers_[i].Run(reply.type); | 52 reply_notifiers_[i].Run(reply.type); |
| 59 } | 53 } |
| 60 | 54 |
| 61 // Notify the callback of the reply. | 55 // Notify the callback of the reply. |
| 62 if (!reply_callback_.is_null()) | 56 if (!reply_callback_.is_null()) |
| 63 reply_callback_.Run(reply); | 57 reply_callback_.Run(reply); |
| 64 | 58 |
| 65 delete this; | 59 delete this; |
| 66 } | 60 } |
| 67 | 61 |
| 68 void InternalWebIntentsDispatcher::RegisterReplyNotification( | 62 void InternalWebIntentsDispatcher::RegisterReplyNotification( |
| 69 const WebIntentsDispatcher::ReplyNotification& closure) { | 63 const WebIntentsDispatcher::ReplyNotification& closure) { |
| 70 reply_notifiers_.push_back(closure); | 64 reply_notifiers_.push_back(closure); |
| 71 } | 65 } |
| 72 | 66 |
| 73 } // namespace content | 67 } // namespace content |
| OLD | NEW |