OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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_PUBLIC_BROWSER_INTENTS_HOST_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_INTENTS_HOST_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "webkit/glue/web_intent_reply_data.h" |
| 10 |
| 11 class TabContents; |
| 12 |
| 13 namespace webkit_glue { |
| 14 struct WebIntentData; |
| 15 } |
| 16 |
| 17 namespace content { |
| 18 |
| 19 // This class is the coordinator for dispatching web intents and seeing that |
| 20 // return messages are sent to the correct invoking context. The TabContents |
| 21 // for the invoking context will create one of these for each intent and hand |
| 22 // ownership to the client TabContentsDelegate code. The TabContentsDelegate |
| 23 // code can then read the intent data, create UI to pick the service, and |
| 24 // create a new context for that service. At that point, it should call |
| 25 // DispatchIntent, which will connect the object to the new context. |
| 26 class CONTENT_EXPORT IntentsHost { |
| 27 public: |
| 28 virtual ~IntentsHost() {} |
| 29 |
| 30 // Get the intent data being dispatched. |
| 31 virtual const webkit_glue::WebIntentData& GetIntent() = 0; |
| 32 |
| 33 // Attach the intent to a new context in which the service is loaded. |
| 34 virtual void DispatchIntent(TabContents* tab_contents) = 0; |
| 35 |
| 36 // Return a success or failure message to the source context which invoked |
| 37 // the intent. |
| 38 virtual void SendReplyMessage(webkit_glue::WebIntentReplyType reply_type, |
| 39 const string16& data) = 0; |
| 40 |
| 41 // Register a callback to be notified when SendReplyMessage is called. |
| 42 virtual void RegisterReplyNotification(const base::Closure& closure) = 0; |
| 43 }; |
| 44 |
| 45 } // namespace content |
| 46 |
| 47 #endif // CONTENT_PUBLIC_BROWSER_INTENTS_HOST_H_ |
OLD | NEW |