Make sure webrtc::VideoSourceInterface is released on the main render thread.
[chromium-blink-merge.git] / content / public / browser / browser_plugin_guest_manager_delegate.h
blob484b09c48ff6899b56a90cfa1df54d7563e7c663
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_
8 #include "base/callback.h"
9 #include "content/common/content_export.h"
11 class GURL;
13 namespace content {
15 class SiteInstance;
16 class WebContents;
18 // A BrowserPluginGuestManagerDelegate offloads guest management and routing
19 // operations outside of the content layer.
20 class CONTENT_EXPORT BrowserPluginGuestManagerDelegate {
21 public:
22 virtual ~BrowserPluginGuestManagerDelegate() {}
24 // Return a new instance ID.
25 // TODO(fsamuel): Remove this. Once the instance ID concept is moved
26 // entirely out of content and into chrome, this API will be unnecessary.
27 virtual int GetNextInstanceID();
29 // Adds a new WebContents |guest_web_contents| as a guest.
30 // TODO(fsamuel): Remove this. Once guest WebContents allocation
31 // moves outside of content, this API will be unnecessary.
32 virtual void AddGuest(int guest_instance_id,
33 WebContents* guest_web_contents) {}
35 // Removes a |guest_instance_id| as a valid guest.
36 // TODO(fsamuel): Remove this. Once guest WebContents allocation
37 // moves outside of content, this API will be unnecessary.
38 virtual void RemoveGuest(int guest_instance_id) {}
40 typedef base::Callback<void(WebContents*)> GuestByInstanceIDCallback;
41 // Requests a guest WebContents associated with the provided
42 // |guest_instance_id|. If a guest associated with the provided ID
43 // does not exist, then the |callback| will be called with a NULL
44 // WebContents. If the provided |embedder_render_process_id| does
45 // not own the requested guest, then the embedder will be killed,
46 // and the |callback| will not be called.
47 virtual void MaybeGetGuestByInstanceIDOrKill(
48 int guest_instance_id,
49 int embedder_render_process_id,
50 const GuestByInstanceIDCallback& callback) {}
52 // Returns an existing SiteInstance if the current profile has a guest of the
53 // given |guest_site|.
54 // TODO(fsamuel): Remove this. Once guest WebContents allocation
55 // moves outside of content, this API will be unnecessary.
56 virtual content::SiteInstance* GetGuestSiteInstance(const GURL& guest_site);
58 // Iterates over all WebContents belonging to a given |embedder_web_contents|,
59 // calling |callback| for each. If one of the callbacks returns true, then
60 // the iteration exits early.
61 typedef base::Callback<bool(WebContents*)> GuestCallback;
62 virtual bool ForEachGuest(WebContents* embedder_web_contents,
63 const GuestCallback& callback);
66 } // namespace content
68 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_