| 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 #ifndef CONTENT_BROWSER_INTENTS_INTERNAL_WEB_INTENTS_DISPATCHER_H_ | 5 #ifndef CONTENT_BROWSER_INTENTS_INTERNAL_WEB_INTENTS_DISPATCHER_H_ |
| 6 #define CONTENT_BROWSER_INTENTS_INTERNAL_WEB_INTENTS_DISPATCHER_H_ | 6 #define CONTENT_BROWSER_INTENTS_INTERNAL_WEB_INTENTS_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/gtest_prod_util.h" |
| 12 #include "content/public/browser/web_intents_dispatcher.h" | 13 #include "content/public/browser/web_intents_dispatcher.h" |
| 13 #include "webkit/glue/web_intent_data.h" | 14 #include "webkit/glue/web_intent_data.h" |
| 14 | 15 |
| 15 class IntentInjector; | 16 class IntentInjector; |
| 16 | 17 |
| 17 // This class implements a web intents dispatcher which originates | 18 // This class implements a web intents dispatcher which originates |
| 18 // within the browser process rather than with a particular renderer. | 19 // within the browser process rather than with a particular renderer. |
| 19 // The implementation handles replies to the web intents invocation by | 20 // The implementation handles replies to the web intents invocation by |
| 20 // notifying a registered callback rather than returning | 21 // notifying a registered callback rather than returning |
| 21 // those messages to any renderer. | 22 // those messages to any renderer. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 36 InternalWebIntentsDispatcher( | 37 InternalWebIntentsDispatcher( |
| 37 const webkit_glue::WebIntentData& intent, | 38 const webkit_glue::WebIntentData& intent, |
| 38 const ReplyCallback& reply_callback); | 39 const ReplyCallback& reply_callback); |
| 39 | 40 |
| 40 virtual ~InternalWebIntentsDispatcher(); | 41 virtual ~InternalWebIntentsDispatcher(); |
| 41 | 42 |
| 42 // WebIntentsDispatcher implementation. | 43 // WebIntentsDispatcher implementation. |
| 43 virtual const webkit_glue::WebIntentData& GetIntent() OVERRIDE; | 44 virtual const webkit_glue::WebIntentData& GetIntent() OVERRIDE; |
| 44 virtual void DispatchIntent( | 45 virtual void DispatchIntent( |
| 45 content::WebContents* destination_contents) OVERRIDE; | 46 content::WebContents* destination_contents) OVERRIDE; |
| 47 virtual void ResetDispatch() OVERRIDE; |
| 46 virtual void SendReplyMessage(webkit_glue::WebIntentReplyType reply_type, | 48 virtual void SendReplyMessage(webkit_glue::WebIntentReplyType reply_type, |
| 47 const string16& data) OVERRIDE; | 49 const string16& data) OVERRIDE; |
| 48 virtual void RegisterReplyNotification( | 50 virtual void RegisterReplyNotification( |
| 49 const content::WebIntentsDispatcher::ReplyNotification& closure) OVERRIDE; | 51 const content::WebIntentsDispatcher::ReplyNotification& closure) OVERRIDE; |
| 50 | 52 |
| 51 private: | 53 private: |
| 54 FRIEND_TEST_ALL_PREFIXES(InternalWebIntentsDispatcherTest, |
| 55 CancelAbandonsInjector); |
| 52 // The intent data to be delivered. | 56 // The intent data to be delivered. |
| 53 webkit_glue::WebIntentData intent_; | 57 webkit_glue::WebIntentData intent_; |
| 54 | 58 |
| 55 // Weak pointer to the internal object which delivers the intent to the | 59 // Weak pointer to the internal object which delivers the intent to the |
| 56 // newly-created service WebContents. This object is self-deleting | 60 // newly-created service WebContents. This object is self-deleting |
| 57 // (connected to the service WebContents). | 61 // (connected to the service WebContents). |
| 58 IntentInjector* intent_injector_; | 62 IntentInjector* intent_injector_; |
| 59 | 63 |
| 60 // Callbacks to be notified when SendReplyMessage is called. | 64 // Callbacks to be notified when SendReplyMessage is called. |
| 61 std::vector<content::WebIntentsDispatcher::ReplyNotification> | 65 std::vector<content::WebIntentsDispatcher::ReplyNotification> |
| 62 reply_notifiers_; | 66 reply_notifiers_; |
| 63 | 67 |
| 64 // Callback to be invoked when the intent is replied to. | 68 // Callback to be invoked when the intent is replied to. |
| 65 ReplyCallback reply_callback_; | 69 ReplyCallback reply_callback_; |
| 66 | 70 |
| 67 DISALLOW_COPY_AND_ASSIGN(InternalWebIntentsDispatcher); | 71 DISALLOW_COPY_AND_ASSIGN(InternalWebIntentsDispatcher); |
| 68 }; | 72 }; |
| 69 | 73 |
| 70 #endif // CONTENT_BROWSER_INTENTS_INTERNAL_WEB_INTENTS_DISPATCHER_H_ | 74 #endif // CONTENT_BROWSER_INTENTS_INTERNAL_WEB_INTENTS_DISPATCHER_H_ |
| OLD | NEW |