diff options
Diffstat (limited to 'content/public/browser/web_intents_dispatcher.h')
-rw-r--r-- | content/public/browser/web_intents_dispatcher.h | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/content/public/browser/web_intents_dispatcher.h b/content/public/browser/web_intents_dispatcher.h index 33b10e7..ccfdf52 100644 --- a/content/public/browser/web_intents_dispatcher.h +++ b/content/public/browser/web_intents_dispatcher.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -9,6 +9,7 @@ #include "webkit/glue/web_intent_reply_data.h" namespace webkit_glue { +enum WebIntentReplyType; struct WebIntentData; } @@ -17,12 +18,19 @@ namespace content { class WebContents; // This class is the coordinator for dispatching web intents and seeing that -// return messages are sent to the correct invoking context. TheWebContents +// return messages are sent to the correct invoking context. The WebContents // for the invoking context will create one of these for each intent and hand -// ownership to the client WebContentsDelegate code. The WebContentsDelegate +// a pointer to the client WebContentsDelegate code. The WebContentsDelegate // code can then read the intent data, create UI to pick the service, and -// create a new context for that service. At that point, it should call -// DispatchIntent, which will connect the object to the new context. +// create a new context for that service. +// +// At that point, it should call DispatchIntent, which will connect the object +// to the new context. If anything goes wrong, the client should call +// SendReplyMessage with an error. That will self-delete the object. +// +// At that point, before the client may use the object again, it must register a +// reply notification, so it can avoid referencing the dispatcher after other +// code calls SendReplyMessage. class CONTENT_EXPORT WebIntentsDispatcher { public: virtual ~WebIntentsDispatcher() {} @@ -30,16 +38,18 @@ class CONTENT_EXPORT WebIntentsDispatcher { // Get the intent data being dispatched. virtual const webkit_glue::WebIntentData& GetIntent() = 0; - // Attach the intent to a new context in which the service is loaded. + // Attach the intent to a new context in which the service page is loaded. virtual void DispatchIntent(WebContents* web_contents) = 0; // Return a success or failure message to the source context which invoked - // the intent. + // the intent. Deletes the object; it should not be used after this call + // returns. Calls the reply notification, if registered. virtual void SendReplyMessage(webkit_glue::WebIntentReplyType reply_type, const string16& data) = 0; // Register a callback to be notified when SendReplyMessage is called. - virtual void RegisterReplyNotification(const base::Closure& closure) = 0; + virtual void RegisterReplyNotification( + const base::Callback<void(webkit_glue::WebIntentReplyType)>& closure) = 0; }; } // namespace content |