summaryrefslogtreecommitdiffstats
path: root/content/public/browser/browser_plugin_guest_manager.h
blob: f56cd2abfef86c4e809f4dcc9ba55146de23a130 (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
48
49
50
51
52
// Copyright 2014 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_BROWSER_PLUGIN_GUEST_MANAGER_H_
#define CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_H_

#include <string>

#include "base/callback.h"
#include "content/common/content_export.h"

class GURL;

namespace base {
class DictionaryValue;
}  // namespace base

namespace content {

class SiteInstance;
class WebContents;

// A BrowserPluginGuestManager offloads guest management and routing
// operations outside of the content layer.
class CONTENT_EXPORT BrowserPluginGuestManager {
 public:
  virtual ~BrowserPluginGuestManager() {}

  typedef base::Callback<void(WebContents*)> GuestByInstanceIDCallback;
  // Requests a guest WebContents associated with the provided
  // |guest_instance_id|. If a guest associated with the provided ID
  // does not exist, then the |callback| will be called with a NULL
  // WebContents. If the provided |embedder_render_process_id| does
  // not own the requested guest, then the embedder will be killed,
  // and the |callback| will not be called.
  virtual void MaybeGetGuestByInstanceIDOrKill(
      WebContents* embedder_web_contents,
      int browser_plugin_instance_id,
      const GuestByInstanceIDCallback& callback) {}

  // Iterates over all WebContents belonging to a given |embedder_web_contents|,
  // calling |callback| for each. If one of the callbacks returns true, then
  // the iteration exits early.
  typedef base::Callback<bool(WebContents*)> GuestCallback;
  virtual bool ForEachGuest(WebContents* embedder_web_contents,
                            const GuestCallback& callback);
};

}  // namespace content

#endif  // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_H_