OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "content/common/content_export.h" |
| 10 |
| 11 class GURL; |
| 12 |
| 13 namespace content { |
| 14 |
| 15 class SiteInstance; |
| 16 class WebContents; |
| 17 |
| 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() {} |
| 23 |
| 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(); |
| 28 |
| 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) {} |
| 34 |
| 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) {} |
| 39 |
| 40 // Returns a Webcontents given a |guest_instance_id|. Returns NULL if the |
| 41 // guest wasn't found. If the embedder is not permitted to access the given |
| 42 // |guest_instance_id|, the embedder is killed, and NULL is returned. |
| 43 virtual WebContents* GetGuestByInstanceID(int guest_instance_id, |
| 44 int embedder_render_process_id); |
| 45 |
| 46 // Returns whether the specified embedder is permitted to access the given |
| 47 // |guest_instance_id|. |
| 48 // TODO(fsamuel): Remove this. |
| 49 virtual bool CanEmbedderAccessInstanceID(int embedder_render_process_id, |
| 50 int guest_instance_id); |
| 51 |
| 52 // Returns whether the specified embedder is permitted to access the given |
| 53 // |guest_instance_id|, and kills the embedder if not. |
| 54 // TODO(fsamuel): Remove this. |
| 55 virtual bool CanEmbedderAccessInstanceIDMaybeKill( |
| 56 int embedder_render_process_id, |
| 57 int guest_instance_id); |
| 58 |
| 59 // Returns an existing SiteInstance if the current profile has a guest of the |
| 60 // given |guest_site|. |
| 61 // TODO(fsamuel): Remove this. Once guest WebContents allocation |
| 62 // moves outside of content, this API will be unnecessary. |
| 63 virtual content::SiteInstance* GetGuestSiteInstance(const GURL& guest_site); |
| 64 |
| 65 // Iterates over all WebContents belonging to a given |embedder_web_contents|, |
| 66 // calling |callback| for each. If one of the callbacks returns true, then |
| 67 // the iteration exits early. |
| 68 typedef base::Callback<bool(WebContents*)> GuestCallback; |
| 69 virtual bool ForEachGuest(WebContents* embedder_web_contents, |
| 70 const GuestCallback& callback); |
| 71 }; |
| 72 |
| 73 } // namespace content |
| 74 |
| 75 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_ |
OLD | NEW |