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 CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ |
6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ | 6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // Returns the guest WebContents associated with the given |guest_instance_id| | 32 // Returns the guest WebContents associated with the given |guest_instance_id| |
33 // if the provided |embedder_render_process_id| is allowed to access it. | 33 // if the provided |embedder_render_process_id| is allowed to access it. |
34 // If the embedder is not allowed access, the embedder will be killed, and | 34 // If the embedder is not allowed access, the embedder will be killed, and |
35 // this method will return NULL. If no WebContents exists with the given | 35 // this method will return NULL. If no WebContents exists with the given |
36 // instance ID, then NULL will also be returned. | 36 // instance ID, then NULL will also be returned. |
37 content::WebContents* GetGuestByInstanceIDSafely( | 37 content::WebContents* GetGuestByInstanceIDSafely( |
38 int guest_instance_id, | 38 int guest_instance_id, |
39 int embedder_render_process_id); | 39 int embedder_render_process_id); |
40 | 40 |
41 // BrowserPluginGuestManagerDelegate implementation. | 41 // BrowserPluginGuestManagerDelegate implementation. |
| 42 virtual content::WebContents* CreateGuest( |
| 43 content::SiteInstance* embedder_site_instance, |
| 44 int instance_id, |
| 45 const content::StorageInfo& storage_info, |
| 46 scoped_ptr<base::DictionaryValue> extra_params) OVERRIDE; |
42 virtual int GetNextInstanceID() OVERRIDE; | 47 virtual int GetNextInstanceID() OVERRIDE; |
43 virtual void AddGuest(int guest_instance_id, | |
44 content::WebContents* guest_web_contents) OVERRIDE; | |
45 virtual void RemoveGuest(int guest_instance_id) OVERRIDE; | |
46 virtual void MaybeGetGuestByInstanceIDOrKill( | 48 virtual void MaybeGetGuestByInstanceIDOrKill( |
47 int guest_instance_id, | 49 int guest_instance_id, |
48 int embedder_render_process_id, | 50 int embedder_render_process_id, |
49 const GuestByInstanceIDCallback& callback) OVERRIDE; | 51 const GuestByInstanceIDCallback& callback) OVERRIDE; |
50 virtual content::SiteInstance* GetGuestSiteInstance( | |
51 const GURL& guest_site) OVERRIDE; | |
52 virtual bool ForEachGuest(content::WebContents* embedder_web_contents, | 52 virtual bool ForEachGuest(content::WebContents* embedder_web_contents, |
53 const GuestCallback& callback) OVERRIDE; | 53 const GuestCallback& callback) OVERRIDE; |
54 | 54 |
55 private: | 55 private: |
| 56 friend class GuestViewBase; |
56 friend class GuestWebContentsObserver; | 57 friend class GuestWebContentsObserver; |
57 | 58 |
| 59 void AddGuest(int guest_instance_id, |
| 60 content::WebContents* guest_web_contents); |
| 61 |
| 62 void RemoveGuest(int guest_instance_id); |
| 63 |
58 void AddRenderProcessHostID(int render_process_host_id); | 64 void AddRenderProcessHostID(int render_process_host_id); |
59 | 65 |
| 66 content::SiteInstance* GetGuestSiteInstance( |
| 67 const GURL& guest_site); |
| 68 |
60 content::WebContents* GetGuestByInstanceID( | 69 content::WebContents* GetGuestByInstanceID( |
61 int guest_instance_id, | 70 int guest_instance_id, |
62 int embedder_render_process_id); | 71 int embedder_render_process_id); |
63 | 72 |
64 bool CanEmbedderAccessInstanceIDMaybeKill( | 73 bool CanEmbedderAccessInstanceIDMaybeKill( |
65 int embedder_render_process_id, | 74 int embedder_render_process_id, |
66 int guest_instance_id); | 75 int guest_instance_id); |
67 | 76 |
68 bool CanEmbedderAccessInstanceID(int embedder_render_process_id, | 77 bool CanEmbedderAccessInstanceID(int embedder_render_process_id, |
69 int guest_instance_id); | 78 int guest_instance_id); |
70 | 79 |
71 static bool CanEmbedderAccessGuest(int embedder_render_process_id, | 80 static bool CanEmbedderAccessGuest(int embedder_render_process_id, |
72 GuestViewBase* guest); | 81 GuestViewBase* guest); |
73 | 82 |
74 // Counts RenderProcessHost IDs of GuestViewBases. | 83 // Counts RenderProcessHost IDs of GuestViewBases. |
75 std::multiset<int> render_process_host_id_multiset_; | 84 std::multiset<int> render_process_host_id_multiset_; |
76 | 85 |
77 // Contains guests' WebContents, mapping from their instance ids. | 86 // Contains guests' WebContents, mapping from their instance ids. |
78 typedef std::map<int, content::WebContents*> GuestInstanceMap; | 87 typedef std::map<int, content::WebContents*> GuestInstanceMap; |
79 GuestInstanceMap guest_web_contents_by_instance_id_; | 88 GuestInstanceMap guest_web_contents_by_instance_id_; |
80 | 89 |
81 int current_instance_id_; | 90 int current_instance_id_; |
82 content::BrowserContext* context_; | 91 content::BrowserContext* context_; |
83 | 92 |
84 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); | 93 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); |
85 }; | 94 }; |
86 | 95 |
87 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ | 96 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ |
OLD | NEW |