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 |
11 class GURL; | 11 class GURL; |
12 | 12 |
13 namespace base { | |
14 class DictionaryValue; | |
15 } // namespace base | |
16 | |
13 namespace content { | 17 namespace content { |
14 | 18 |
15 class SiteInstance; | 19 class SiteInstance; |
16 class WebContents; | 20 class WebContents; |
17 | 21 |
18 // A BrowserPluginGuestManagerDelegate offloads guest management and routing | 22 // A BrowserPluginGuestManagerDelegate offloads guest management and routing |
19 // operations outside of the content layer. | 23 // operations outside of the content layer. |
24 struct StorageInfo { | |
jam
2014/05/06 23:43:53
why a struct for two params instead of putting the
Fady Samuel
2014/05/07 00:07:47
Done.
| |
25 bool persist; | |
26 std::string partition_id; | |
27 }; | |
28 | |
20 class CONTENT_EXPORT BrowserPluginGuestManagerDelegate { | 29 class CONTENT_EXPORT BrowserPluginGuestManagerDelegate { |
21 public: | 30 public: |
22 virtual ~BrowserPluginGuestManagerDelegate() {} | 31 virtual ~BrowserPluginGuestManagerDelegate() {} |
23 | 32 |
33 virtual content::WebContents* CreateGuest( | |
34 content::SiteInstance* embedder_site_instance, | |
35 int instance_id, | |
36 const StorageInfo& storage_info, | |
37 scoped_ptr<base::DictionaryValue> extra_params); | |
38 | |
24 // Return a new instance ID. | 39 // Return a new instance ID. |
25 // TODO(fsamuel): Remove this. Once the instance ID concept is moved | 40 // TODO(fsamuel): Remove this. Once the instance ID concept is moved |
26 // entirely out of content and into chrome, this API will be unnecessary. | 41 // entirely out of content and into chrome, this API will be unnecessary. |
27 virtual int GetNextInstanceID(); | 42 virtual int GetNextInstanceID(); |
28 | 43 |
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 typedef base::Callback<void(WebContents*)> GuestByInstanceIDCallback; | 44 typedef base::Callback<void(WebContents*)> GuestByInstanceIDCallback; |
41 // Requests a guest WebContents associated with the provided | 45 // Requests a guest WebContents associated with the provided |
42 // |guest_instance_id|. If a guest associated with the provided ID | 46 // |guest_instance_id|. If a guest associated with the provided ID |
43 // does not exist, then the |callback| will be called with a NULL | 47 // does not exist, then the |callback| will be called with a NULL |
44 // WebContents. If the provided |embedder_render_process_id| does | 48 // WebContents. If the provided |embedder_render_process_id| does |
45 // not own the requested guest, then the embedder will be killed, | 49 // not own the requested guest, then the embedder will be killed, |
46 // and the |callback| will not be called. | 50 // and the |callback| will not be called. |
47 virtual void MaybeGetGuestByInstanceIDOrKill( | 51 virtual void MaybeGetGuestByInstanceIDOrKill( |
48 int guest_instance_id, | 52 int guest_instance_id, |
49 int embedder_render_process_id, | 53 int embedder_render_process_id, |
50 const GuestByInstanceIDCallback& callback) {} | 54 const GuestByInstanceIDCallback& callback) {} |
51 | 55 |
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); | |
57 | |
58 // Iterates over all WebContents belonging to a given |embedder_web_contents|, | 56 // Iterates over all WebContents belonging to a given |embedder_web_contents|, |
59 // calling |callback| for each. If one of the callbacks returns true, then | 57 // calling |callback| for each. If one of the callbacks returns true, then |
60 // the iteration exits early. | 58 // the iteration exits early. |
61 typedef base::Callback<bool(WebContents*)> GuestCallback; | 59 typedef base::Callback<bool(WebContents*)> GuestCallback; |
62 virtual bool ForEachGuest(WebContents* embedder_web_contents, | 60 virtual bool ForEachGuest(WebContents* embedder_web_contents, |
63 const GuestCallback& callback); | 61 const GuestCallback& callback); |
64 }; | 62 }; |
65 | 63 |
66 } // namespace content | 64 } // namespace content |
67 | 65 |
68 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_ | 66 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_ |
OLD | NEW |