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 | |
10 #include "base/callback.h" | |
11 #include "base/compiler_specific.h" | |
12 #include "content/public/browser/web_intents_dispatcher.h" | |
13 #include "webkit/glue/web_intent_data.h" | |
14 | |
15 class IntentInjector; | |
16 | |
17 // This class implements a web intents dispatcher which originates | |
18 // within the browser process rather than with a particular renderer. | |
19 // The implementation handles replies to the web intents invocation by | |
20 // notifying a registered callback rather than returning | |
21 // those messages to any renderer. | |
22 class InternalWebIntentsDispatcher : public content::WebIntentsDispatcher { | |
James Hawkins
2012/03/13 00:59:02
I'm just curious, and jam will likely know better,
Greg Billock
2012/03/13 17:42:38
Good question. I'm thinking of it as a content-sid
| |
23 public: | |
24 typedef base::Callback<void(webkit_glue::WebIntentReplyType, | |
25 const string16&)> ReplyCallback; | |
26 | |
27 // |intent| is the intent payload to be dispatched. | |
28 explicit InternalWebIntentsDispatcher( | |
29 const webkit_glue::WebIntentData& intent); | |
30 | |
31 // |intent| is the intent payload to be dispatched. | |
32 // |reply_callback| is the callback to notify when the intent is replied to. | |
33 InternalWebIntentsDispatcher( | |
34 const webkit_glue::WebIntentData& intent, | |
35 ReplyCallback reply_callback); | |
36 | |
37 virtual ~InternalWebIntentsDispatcher(); | |
38 | |
39 // WebIntentsDispatcher implementation. | |
40 virtual const webkit_glue::WebIntentData& GetIntent() OVERRIDE; | |
41 virtual void DispatchIntent(content::WebContents* destination_tab) OVERRIDE; | |
42 virtual void SendReplyMessage(webkit_glue::WebIntentReplyType reply_type, | |
43 const string16& data) OVERRIDE; | |
44 virtual void RegisterReplyNotification( | |
45 const base::Callback<void(webkit_glue::WebIntentReplyType)>& | |
46 closure) OVERRIDE; | |
47 | |
48 private: | |
49 // The intent data to be delivered. | |
50 webkit_glue::WebIntentData intent_; | |
51 | |
52 // Weak pointer to the internal object which provides the intent to the | |
53 // newly-created service tab contents. This object is self-deleting | |
54 // (connected to the service TabContents). | |
55 IntentInjector* intent_injector_; | |
56 | |
57 // Callbacks to be notified when SendReplyMessage is called. | |
58 std::vector<base::Callback<void(webkit_glue::WebIntentReplyType)> > | |
James Hawkins
2012/03/13 00:59:02
typedef this callback as well.
Greg Billock
2012/03/13 17:42:38
This type is really from the base class.
James Hawkins
2012/03/13 18:22:03
typedef it in the base class.
Greg Billock
2012/03/13 19:26:50
Done.
| |
59 reply_notifiers_; | |
60 | |
61 // Callback to be invoked when the intent is replied to. | |
62 ReplyCallback reply_callback_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(InternalWebIntentsDispatcher); | |
65 }; | |
66 | |
67 #endif // CONTENT_BROWSER_INTENTS_INTERNAL_WEB_INTENTS_DISPATCHER_H_ | |
OLD | NEW |