| 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 |
| 22 struct StorageInfo { |
| 23 bool persist; |
| 24 std::string partition_id; |
| 25 }; |
| 26 |
| 18 class CONTENT_EXPORT BrowserPluginGuestManagerDelegate { | 27 class CONTENT_EXPORT BrowserPluginGuestManagerDelegate { |
| 19 public: | 28 public: |
| 20 virtual ~BrowserPluginGuestManagerDelegate() {} | 29 virtual ~BrowserPluginGuestManagerDelegate() {} |
| 21 | 30 |
| 31 virtual content::WebContents* CreateGuest( |
| 32 content::SiteInstance* embedder_site_instance, |
| 33 int instance_id, |
| 34 const StorageInfo& storage_info, |
| 35 scoped_ptr<base::DictionaryValue> extra_params); |
| 36 |
| 22 // Return a new instance ID. | 37 // Return a new instance ID. |
| 23 virtual int GetNextInstanceID(); | 38 virtual int GetNextInstanceID(); |
| 24 | 39 |
| 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 typedef base::Callback<void(WebContents*)> GuestByInstanceIDCallback; | 40 typedef base::Callback<void(WebContents*)> GuestByInstanceIDCallback; |
| 37 virtual void MaybeGetGuestByInstanceIDOrKill( | 41 virtual void MaybeGetGuestByInstanceIDOrKill( |
| 38 int guest_instance_id, | 42 int guest_instance_id, |
| 39 int embedder_render_process_id, | 43 int embedder_render_process_id, |
| 40 const GuestByInstanceIDCallback& callback) {} | 44 const GuestByInstanceIDCallback& callback) {} |
| 41 | 45 |
| 42 // Returns an existing SiteInstance if the current profile has a guest of the | |
| 43 // given |guest_site|. | |
| 44 // TODO(fsamuel): Remove this. Once guest WebContents allocation | |
| 45 // moves outside of content, this API will be unnecessary. | |
| 46 virtual content::SiteInstance* GetGuestSiteInstance(const GURL& guest_site); | |
| 47 | |
| 48 // Iterates over all WebContents belonging to a given |embedder_web_contents|, | 46 // Iterates over all WebContents belonging to a given |embedder_web_contents|, |
| 49 // calling |callback| for each. If one of the callbacks returns true, then | 47 // calling |callback| for each. If one of the callbacks returns true, then |
| 50 // the iteration exits early. | 48 // the iteration exits early. |
| 51 typedef base::Callback<bool(WebContents*)> GuestCallback; | 49 typedef base::Callback<bool(WebContents*)> GuestCallback; |
| 52 virtual bool ForEachGuest(WebContents* embedder_web_contents, | 50 virtual bool ForEachGuest(WebContents* embedder_web_contents, |
| 53 const GuestCallback& callback); | 51 const GuestCallback& callback); |
| 54 }; | 52 }; |
| 55 | 53 |
| 56 } // namespace content | 54 } // namespace content |
| 57 | 55 |
| 58 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_ | 56 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_ |
| OLD | NEW |