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_H_ |
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_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 { | 13 namespace base { |
14 class DictionaryValue; | 14 class DictionaryValue; |
15 } // namespace base | 15 } // namespace base |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 class SiteInstance; | 19 class SiteInstance; |
20 class WebContents; | 20 class WebContents; |
21 | 21 |
22 // A BrowserPluginGuestManagerDelegate offloads guest management and routing | 22 // A BrowserPluginGuestManager offloads guest management and routing |
23 // operations outside of the content layer. | 23 // operations outside of the content layer. |
24 struct StorageInfo { | 24 struct StorageInfo { |
25 bool persist; | 25 bool persist; |
26 std::string partition_id; | 26 std::string partition_id; |
27 }; | 27 }; |
28 | 28 |
29 class CONTENT_EXPORT BrowserPluginGuestManagerDelegate { | 29 class CONTENT_EXPORT BrowserPluginGuestManager { |
30 public: | 30 public: |
31 virtual ~BrowserPluginGuestManagerDelegate() {} | 31 virtual ~BrowserPluginGuestManager() {} |
32 | 32 |
33 virtual content::WebContents* CreateGuest( | 33 virtual content::WebContents* CreateGuest( |
34 content::SiteInstance* embedder_site_instance, | 34 content::SiteInstance* embedder_site_instance, |
35 int instance_id, | 35 int instance_id, |
36 const StorageInfo& storage_info, | 36 const StorageInfo& storage_info, |
37 scoped_ptr<base::DictionaryValue> extra_params); | 37 scoped_ptr<base::DictionaryValue> extra_params); |
38 | 38 |
39 // Return a new instance ID. | 39 // Return a new instance ID. |
40 // TODO(fsamuel): Remove this. Once the instance ID concept is moved | 40 // TODO(fsamuel): Remove this. Once the instance ID concept is moved |
41 // 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. |
42 virtual int GetNextInstanceID(); | 42 virtual int GetNextInstanceID(); |
43 | 43 |
44 typedef base::Callback<void(WebContents*)> GuestByInstanceIDCallback; | 44 typedef base::Callback<void(WebContents*)> GuestByInstanceIDCallback; |
45 virtual void MaybeGetGuestByInstanceIDOrKill( | 45 virtual void MaybeGetGuestByInstanceIDOrKill( |
46 int guest_instance_id, | 46 int guest_instance_id, |
47 int embedder_render_process_id, | 47 int embedder_render_process_id, |
48 const GuestByInstanceIDCallback& callback) {} | 48 const GuestByInstanceIDCallback& callback) {} |
49 | 49 |
50 // Iterates over all WebContents belonging to a given |embedder_web_contents|, | 50 // Iterates over all WebContents belonging to a given |embedder_web_contents|, |
51 // calling |callback| for each. If one of the callbacks returns true, then | 51 // calling |callback| for each. If one of the callbacks returns true, then |
52 // the iteration exits early. | 52 // the iteration exits early. |
53 typedef base::Callback<bool(WebContents*)> GuestCallback; | 53 typedef base::Callback<bool(WebContents*)> GuestCallback; |
54 virtual bool ForEachGuest(WebContents* embedder_web_contents, | 54 virtual bool ForEachGuest(WebContents* embedder_web_contents, |
55 const GuestCallback& callback); | 55 const GuestCallback& callback); |
56 }; | 56 }; |
57 | 57 |
58 } // namespace content | 58 } // namespace content |
59 | 59 |
60 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_ | 60 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_H_ |
OLD | NEW |