Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Side by Side Diff: content/public/browser/browser_plugin_guest_manager_delegate.h

Issue 261013005: BrowserPlugin: Move CreateGuest to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@guestview_manager_simplify_api
Patch Set: Fixed content_browsertests after a change Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <string>
9
8 #include "base/callback.h" 10 #include "base/callback.h"
9 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
10 12
11 class GURL; 13 class GURL;
12 14
15 namespace base {
16 class DictionaryValue;
17 } // namespace base
18
13 namespace content { 19 namespace content {
14 20
15 class SiteInstance; 21 class SiteInstance;
16 class WebContents; 22 class WebContents;
17 23
18 // A BrowserPluginGuestManagerDelegate offloads guest management and routing 24 // A BrowserPluginGuestManagerDelegate offloads guest management and routing
19 // operations outside of the content layer. 25 // operations outside of the content layer.
20 class CONTENT_EXPORT BrowserPluginGuestManagerDelegate { 26 class CONTENT_EXPORT BrowserPluginGuestManagerDelegate {
21 public: 27 public:
22 virtual ~BrowserPluginGuestManagerDelegate() {} 28 virtual ~BrowserPluginGuestManagerDelegate() {}
23 29
30 // Requests the allocation of a new guest WebContents.
31 virtual content::WebContents* CreateGuest(
32 content::SiteInstance* embedder_site_instance,
33 int instance_id,
34 const std::string& storage_partition_id,
35 bool persist_storage,
36 scoped_ptr<base::DictionaryValue> extra_params);
37
24 // Return a new instance ID. 38 // Return a new instance ID.
25 // TODO(fsamuel): Remove this. Once the instance ID concept is moved 39 // TODO(fsamuel): Remove this. Once the instance ID concept is moved
26 // entirely out of content and into chrome, this API will be unnecessary. 40 // entirely out of content and into chrome, this API will be unnecessary.
27 virtual int GetNextInstanceID(); 41 virtual int GetNextInstanceID();
28 42
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; 43 typedef base::Callback<void(WebContents*)> GuestByInstanceIDCallback;
41 // Requests a guest WebContents associated with the provided 44 // Requests a guest WebContents associated with the provided
42 // |guest_instance_id|. If a guest associated with the provided ID 45 // |guest_instance_id|. If a guest associated with the provided ID
43 // does not exist, then the |callback| will be called with a NULL 46 // does not exist, then the |callback| will be called with a NULL
44 // WebContents. If the provided |embedder_render_process_id| does 47 // WebContents. If the provided |embedder_render_process_id| does
45 // not own the requested guest, then the embedder will be killed, 48 // not own the requested guest, then the embedder will be killed,
46 // and the |callback| will not be called. 49 // and the |callback| will not be called.
47 virtual void MaybeGetGuestByInstanceIDOrKill( 50 virtual void MaybeGetGuestByInstanceIDOrKill(
48 int guest_instance_id, 51 int guest_instance_id,
49 int embedder_render_process_id, 52 int embedder_render_process_id,
50 const GuestByInstanceIDCallback& callback) {} 53 const GuestByInstanceIDCallback& callback) {}
51 54
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|, 55 // Iterates over all WebContents belonging to a given |embedder_web_contents|,
59 // calling |callback| for each. If one of the callbacks returns true, then 56 // calling |callback| for each. If one of the callbacks returns true, then
60 // the iteration exits early. 57 // the iteration exits early.
61 typedef base::Callback<bool(WebContents*)> GuestCallback; 58 typedef base::Callback<bool(WebContents*)> GuestCallback;
62 virtual bool ForEachGuest(WebContents* embedder_web_contents, 59 virtual bool ForEachGuest(WebContents* embedder_web_contents,
63 const GuestCallback& callback); 60 const GuestCallback& callback);
64 }; 61 };
65 62
66 } // namespace content 63 } // namespace content
67 64
68 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_ 65 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_MANAGER_DELEGATE_H_
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/public/browser/browser_plugin_guest_manager_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698