summaryrefslogtreecommitdiffstats
path: root/content/public/browser/web_intents_dispatcher.h
blob: 33b10e7707ffccbafefb6a212ec0ab745a8ea1ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) 2011 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_PUBLIC_BROWSER_WEB_INTENTS_DISPATCHER_H_
#define CONTENT_PUBLIC_BROWSER_WEB_INTENTS_DISPATCHER_H_

#include "base/callback.h"
#include "webkit/glue/web_intent_reply_data.h"

namespace webkit_glue {
struct WebIntentData;
}

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
// for the invoking context will create one of these for each intent and hand
// ownership 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.
class CONTENT_EXPORT WebIntentsDispatcher {
 public:
  virtual ~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.
  virtual void DispatchIntent(WebContents* web_contents) = 0;

  // Return a success or failure message to the source context which invoked
  // the intent.
  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;
};

}  // namespace content

#endif  // CONTENT_PUBLIC_BROWSER_WEB_INTENTS_DISPATCHER_H_