Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(960)

Unified Diff: content/browser/intents/internal_web_intents_dispatcher.h

Issue 9692017: An internal intents dispatcher useful for initiating an intent from the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..801a497b69968e9cd5eaf9e35b463e5ee0c85376
--- /dev/null
+++ b/content/browser/intents/internal_web_intents_dispatcher.h
@@ -0,0 +1,63 @@
+// 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"
James Hawkins 2012/03/12 23:19:11 nit: Blank line in between std includes and src in
Greg Billock 2012/03/12 23:52:22 Done.
+#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 coordinator object which originates
James Hawkins 2012/03/12 23:19:11 We use coordinator in the comment and dispatcher i
Greg Billock 2012/03/12 23:52:22 Reworded a bit.
+// within the browser process rather than with a particular renderer.
+// It will terminate callbacks by notifying its delegate rather than returning
James Hawkins 2012/03/12 23:19:11 We should probably expand on some of the terminolo
James Hawkins 2012/03/12 23:19:11 Optional nit: "It" is less ambiguous in class-leve
Greg Billock 2012/03/12 23:52:22 Done.
Greg Billock 2012/03/12 23:52:22 Done.
+// those messages to a renderer.
+class InternalWebIntentsDispatcher : public content::WebIntentsDispatcher {
+ public:
+ // |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,
+ base::Callback<void(webkit_glue::WebIntentReplyType,
James Hawkins 2012/03/12 23:19:11 typedef this.
Greg Billock 2012/03/12 23:52:22 Done.
+ const string16&)> 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:
+ webkit_glue::WebIntentData intent_;
James Hawkins 2012/03/12 23:19:11 Document member variable.
Greg Billock 2012/03/12 23:52:22 Done.
+
+ // 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)> >
+ reply_notifiers_;
+
+ // Callback to be invoked when the intent is replied to.
+ base::Callback<void(webkit_glue::WebIntentReplyType,
+ const string16&)> reply_callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(InternalWebIntentsDispatcher);
+};
+
+#endif // CONTENT_BROWSER_INTENTS_INTERNAL_WEB_INTENTS_DISPATCHER_H_

Powered by Google App Engine
This is Rietveld 408576698