OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 // TODO(fsamuel): Remove this. Once guest WebContents allocation | 30 // TODO(fsamuel): Remove this. Once guest WebContents allocation |
31 // moves outside of content, this API will be unnecessary. | 31 // moves outside of content, this API will be unnecessary. |
32 virtual void AddGuest(int guest_instance_id, | 32 virtual void AddGuest(int guest_instance_id, |
33 WebContents* guest_web_contents) {} | 33 WebContents* guest_web_contents) {} |
34 | 34 |
35 // Removes a |guest_instance_id| as a valid guest. | 35 // Removes a |guest_instance_id| as a valid guest. |
36 // TODO(fsamuel): Remove this. Once guest WebContents allocation | 36 // TODO(fsamuel): Remove this. Once guest WebContents allocation |
37 // moves outside of content, this API will be unnecessary. | 37 // moves outside of content, this API will be unnecessary. |
38 virtual void RemoveGuest(int guest_instance_id) {} | 38 virtual void RemoveGuest(int guest_instance_id) {} |
39 | 39 |
40 // Returns a Webcontents given a |guest_instance_id|. Returns NULL if the | 40 typedef base::Callback<void(WebContents*)> GuestByInstanceIDCallback; |
41 // guest wasn't found. If the embedder is not permitted to access the given | 41 // Requests a guest WebContents associated with the provided |
42 // |guest_instance_id|, the embedder is killed, and NULL is returned. | 42 // |guest_instance_id|. If a guest associated with the provided ID |
43 virtual WebContents* GetGuestByInstanceID(int guest_instance_id, | 43 // does not exist, then the |callback| will be called with a NULL |
44 int embedder_render_process_id); | 44 // WebContents. If the provided |embedder_render_process_id| does |
45 | 45 // not own the requested guest, then the embedder will be killed, |
46 // Returns whether the specified embedder is permitted to access the given | 46 // and the |callback| will not be called. |
47 // |guest_instance_id|. | 47 virtual void MaybeGetGuestByInstanceIDOrKill( |
48 // TODO(fsamuel): Remove this. | 48 int guest_instance_id, |
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, | 49 int embedder_render_process_id, |
57 int guest_instance_id); | 50 const GuestByInstanceIDCallback& callback) {} |
58 | 51 |
59 // Returns an existing SiteInstance if the current profile has a guest of the | 52 // Returns an existing SiteInstance if the current profile has a guest of the |
60 // given |guest_site|. | 53 // given |guest_site|. |
61 // TODO(fsamuel): Remove this. Once guest WebContents allocation | 54 // TODO(fsamuel): Remove this. Once guest WebContents allocation |
62 // moves outside of content, this API will be unnecessary. | 55 // moves outside of content, this API will be unnecessary. |
63 virtual content::SiteInstance* GetGuestSiteInstance(const GURL& guest_site); | 56 virtual content::SiteInstance* GetGuestSiteInstance(const GURL& guest_site); |
64 | 57 |
65 // Iterates over all WebContents belonging to a given |embedder_web_contents|, | 58 // Iterates over all WebContents belonging to a given |embedder_web_contents|, |
66 // calling |callback| for each. If one of the callbacks returns true, then | 59 // calling |callback| for each. If one of the callbacks returns true, then |
67 // the iteration exits early. | 60 // the iteration exits early. |
68 typedef base::Callback<bool(WebContents*)> GuestCallback; | 61 typedef base::Callback<bool(WebContents*)> GuestCallback; |
69 virtual bool ForEachGuest(WebContents* embedder_web_contents, | 62 virtual bool ForEachGuest(WebContents* embedder_web_contents, |
70 const GuestCallback& callback); | 63 const GuestCallback& callback); |
71 }; | 64 }; |
72 | 65 |
73 } // namespace content | 66 } // namespace content |
74 | 67 |
75 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_ | 68 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_ |
OLD | NEW |