Chromium Code Reviews| 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 class CONTENT_EXPORT BrowserPluginGuestManagerDelegate { | |
|
jam
2014/05/02 19:09:06
nit: document
Fady Samuel
2014/05/02 21:28:20
Done.
| |
| 19 public: | |
| 20 virtual ~BrowserPluginGuestManagerDelegate() {} | |
| 21 | |
| 22 // Return a new instance ID. | |
| 23 virtual int GetNextInstanceID(); | |
|
jam
2014/05/02 19:09:06
this and GetGuestByInstanceID can go away as well
Fady Samuel
2014/05/02 21:28:20
GetGuestByInstanceID goes away in a subsequent pat
| |
| 24 | |
| 25 // Adds a new WebContents |guest_web_contents| as a guest. | |
| 26 // TODO(fsamuel): Remove this. Once guest WebContents allocation | |
| 27 // moves outside of content, this API will be unnecessary. | |
| 28 virtual void AddGuest(int guest_instance_id, | |
| 29 WebContents* guest_web_contents) {} | |
| 30 | |
| 31 // Removes a |guest_instance_id| as a valid guest. | |
| 32 // TODO(fsamuel): Remove this. Once guest WebContents allocation | |
| 33 // moves outside of content, this API will be unnecessary. | |
| 34 virtual void RemoveGuest(int guest_instance_id) {} | |
| 35 | |
| 36 // Returns a Webcontents given a |guest_instance_id|. Returns NULL if the | |
| 37 // guest wasn't found. If the embedder is not permitted to access the given | |
| 38 // |guest_instance_id|, the embedder is killed, and NULL is returned. | |
| 39 virtual WebContents* GetGuestByInstanceID(int guest_instance_id, | |
| 40 int embedder_render_process_id); | |
| 41 | |
| 42 // Returns whether the specified embedder is permitted to access the given | |
| 43 // |guest_instance_id|. | |
| 44 // TODO(fsamuel): Remove this. | |
| 45 virtual bool CanEmbedderAccessInstanceID(int embedder_render_process_id, | |
| 46 int guest_instance_id); | |
| 47 | |
| 48 // Returns whether the specified embedder is permitted to access the given | |
| 49 // |guest_instance_id|, and kills the embedder if not. | |
| 50 // TODO(fsamuel): Remove this. | |
| 51 virtual bool CanEmbedderAccessInstanceIDMaybeKill( | |
| 52 int embedder_render_process_id, | |
| 53 int guest_instance_id); | |
| 54 | |
| 55 // Returns an existing SiteInstance if the current profile has a guest of the | |
| 56 // given |guest_site|. | |
| 57 // TODO(fsamuel): Remove this. Once guest WebContents allocation | |
| 58 // moves outside of content, this API will be unnecessary. | |
| 59 virtual content::SiteInstance* GetGuestSiteInstance(const GURL& guest_site); | |
| 60 | |
| 61 // Iterates over all WebContents belonging to a given |embedder_web_contents|, | |
| 62 // calling |callback| for each. If one of the callbacks returns true, then | |
| 63 // the iteration exits early. | |
| 64 typedef base::Callback<bool(WebContents*)> GuestCallback; | |
| 65 virtual bool ForEachGuest(WebContents* embedder_web_contents, | |
| 66 const GuestCallback& callback); | |
| 67 }; | |
| 68 | |
| 69 } // namespace content | |
| 70 | |
| 71 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_ | |
| OLD | NEW |