OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_INTENTS_INTERNAL_WEB_INTENTS_DISPATCHER_H_ |
| 6 #define CONTENT_BROWSER_INTENTS_INTERNAL_WEB_INTENTS_DISPATCHER_H_ |
| 7 |
| 8 #include <vector> |
| 9 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" |
| 11 #include "content/public/browser/web_intents_dispatcher.h" |
| 12 #include "webkit/glue/web_intent_data.h" |
| 13 |
| 14 class IntentInjector; |
| 15 |
| 16 // This class implements a web intents coordinator object which originates |
| 17 // within the browser process rather than with a particular renderer. |
| 18 // It will terminate callbacks by notifying its delegate rather than returning |
| 19 // those messages to a renderer. |
| 20 class InternalWebIntentsDispatcher : public content::WebIntentsDispatcher { |
| 21 public: |
| 22 // |intent| is the intent payload to be dispatched. |
| 23 explicit InternalWebIntentsDispatcher( |
| 24 const webkit_glue::WebIntentData& intent); |
| 25 virtual ~InternalWebIntentsDispatcher(); |
| 26 |
| 27 // WebIntentsDispatcher implementation. |
| 28 virtual const webkit_glue::WebIntentData& GetIntent() OVERRIDE; |
| 29 virtual void DispatchIntent(content::WebContents* destination_tab) OVERRIDE; |
| 30 virtual void SendReplyMessage(webkit_glue::WebIntentReplyType reply_type, |
| 31 const string16& data) OVERRIDE; |
| 32 virtual void RegisterReplyNotification( |
| 33 const base::Callback<void(webkit_glue::WebIntentReplyType)>& |
| 34 closure) OVERRIDE; |
| 35 |
| 36 private: |
| 37 webkit_glue::WebIntentData intent_; |
| 38 |
| 39 // Weak pointer to the internal object which provides the intent to the |
| 40 // newly-created service tab contents. This object is self-deleting |
| 41 // (connected to the service TabContents). |
| 42 IntentInjector* intent_injector_; |
| 43 |
| 44 // Callbacks to be notified when SendReplyMessage is called. |
| 45 std::vector<base::Callback<void(webkit_glue::WebIntentReplyType)> > |
| 46 reply_notifiers_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(InternalWebIntentsDispatcher); |
| 49 }; |
| 50 |
| 51 #endif // CONTENT_BROWSER_INTENTS_INTERNAL_WEB_INTENTS_DISPATCHER_H_ |
OLD | NEW |