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