Chromium Code Reviews| Index: content/browser/intents/internal_web_intents_dispatcher.h |
| diff --git a/content/browser/intents/internal_web_intents_dispatcher.h b/content/browser/intents/internal_web_intents_dispatcher.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..34f39acee96514feb62ca43efd3594612bf1d40b |
| --- /dev/null |
| +++ b/content/browser/intents/internal_web_intents_dispatcher.h |
| @@ -0,0 +1,67 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_INTENTS_INTERNAL_WEB_INTENTS_DISPATCHER_H_ |
| +#define CONTENT_BROWSER_INTENTS_INTERNAL_WEB_INTENTS_DISPATCHER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/callback.h" |
| +#include "base/compiler_specific.h" |
| +#include "content/public/browser/web_intents_dispatcher.h" |
| +#include "webkit/glue/web_intent_data.h" |
| + |
| +class IntentInjector; |
| + |
| +// This class implements a web intents dispatcher which originates |
| +// within the browser process rather than with a particular renderer. |
| +// The implementation handles replies to the web intents invocation by |
| +// notifying a registered callback rather than returning |
| +// those messages to any renderer. |
| +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
|
| + public: |
| + typedef base::Callback<void(webkit_glue::WebIntentReplyType, |
| + const string16&)> ReplyCallback; |
| + |
| + // |intent| is the intent payload to be dispatched. |
| + explicit InternalWebIntentsDispatcher( |
| + const webkit_glue::WebIntentData& intent); |
| + |
| + // |intent| is the intent payload to be dispatched. |
| + // |reply_callback| is the callback to notify when the intent is replied to. |
| + InternalWebIntentsDispatcher( |
| + const webkit_glue::WebIntentData& intent, |
| + ReplyCallback reply_callback); |
| + |
| + virtual ~InternalWebIntentsDispatcher(); |
| + |
| + // WebIntentsDispatcher implementation. |
| + virtual const webkit_glue::WebIntentData& GetIntent() OVERRIDE; |
| + virtual void DispatchIntent(content::WebContents* destination_tab) OVERRIDE; |
| + virtual void SendReplyMessage(webkit_glue::WebIntentReplyType reply_type, |
| + const string16& data) OVERRIDE; |
| + virtual void RegisterReplyNotification( |
| + const base::Callback<void(webkit_glue::WebIntentReplyType)>& |
| + closure) OVERRIDE; |
| + |
| + private: |
| + // The intent data to be delivered. |
| + webkit_glue::WebIntentData intent_; |
| + |
| + // Weak pointer to the internal object which provides the intent to the |
| + // newly-created service tab contents. This object is self-deleting |
| + // (connected to the service TabContents). |
| + IntentInjector* intent_injector_; |
| + |
| + // Callbacks to be notified when SendReplyMessage is called. |
| + 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.
|
| + reply_notifiers_; |
| + |
| + // Callback to be invoked when the intent is replied to. |
| + ReplyCallback reply_callback_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(InternalWebIntentsDispatcher); |
| +}; |
| + |
| +#endif // CONTENT_BROWSER_INTENTS_INTERNAL_WEB_INTENTS_DISPATCHER_H_ |