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 11 matching lines...) Expand all Loading... | |
22 } // namespace content | 22 } // namespace content |
23 | 23 |
24 class GuestViewManager : public content::BrowserPluginGuestManagerDelegate, | 24 class GuestViewManager : public content::BrowserPluginGuestManagerDelegate, |
25 public base::SupportsUserData::Data { | 25 public base::SupportsUserData::Data { |
26 public: | 26 public: |
27 explicit GuestViewManager(content::BrowserContext* context); | 27 explicit GuestViewManager(content::BrowserContext* context); |
28 virtual ~GuestViewManager(); | 28 virtual ~GuestViewManager(); |
29 | 29 |
30 static GuestViewManager* FromBrowserContext(content::BrowserContext* context); | 30 static GuestViewManager* FromBrowserContext(content::BrowserContext* context); |
31 | 31 |
32 void AddGuest(int guest_instance_id, | |
lazyboy
2014/05/02 19:52:52
Description for added public methods.
Fady Samuel
2014/05/06 20:02:48
Moved to private. These need to be accessed by Gue
| |
33 content::WebContents* guest_web_contents); | |
34 void RemoveGuest(int guest_instance_id); | |
35 | |
32 content::WebContents* GetGuestByInstanceIDSafely( | 36 content::WebContents* GetGuestByInstanceIDSafely( |
33 int guest_instance_id, | 37 int guest_instance_id, |
34 int embedder_render_process_id); | 38 int embedder_render_process_id); |
35 bool CanEmbedderAccessInstanceIDMaybeKill( | 39 bool CanEmbedderAccessInstanceIDMaybeKill( |
36 int embedder_render_process_id, | 40 int embedder_render_process_id, |
37 int guest_instance_id); | 41 int guest_instance_id); |
38 bool CanEmbedderAccessInstanceID(int embedder_render_process_id, | 42 bool CanEmbedderAccessInstanceID(int embedder_render_process_id, |
39 int guest_instance_id); | 43 int guest_instance_id); |
40 | 44 |
41 // BrowserPluginGuestManagerDelegate implementation. | 45 // BrowserPluginGuestManagerDelegate implementation. |
46 virtual content::WebContents* CreateGuest( | |
47 content::SiteInstance* embedder_site_instance, | |
48 int instance_id, | |
49 const content::StorageInfo& storage_info, | |
50 scoped_ptr<base::DictionaryValue> extra_params) OVERRIDE; | |
42 virtual int GetNextInstanceID() OVERRIDE; | 51 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( | 52 virtual void MaybeGetGuestByInstanceIDOrKill( |
47 int guest_instance_id, | 53 int guest_instance_id, |
48 int embedder_render_process_id, | 54 int embedder_render_process_id, |
49 const GuestByInstanceIDCallback& callback) OVERRIDE; | 55 const GuestByInstanceIDCallback& callback) OVERRIDE; |
50 virtual content::SiteInstance* GetGuestSiteInstance( | |
51 const GURL& guest_site) OVERRIDE; | |
52 virtual bool ForEachGuest(content::WebContents* embedder_web_contents, | 56 virtual bool ForEachGuest(content::WebContents* embedder_web_contents, |
53 const GuestCallback& callback) OVERRIDE; | 57 const GuestCallback& callback) OVERRIDE; |
54 | 58 |
55 private: | 59 private: |
56 friend class GuestWebContentsObserver; | 60 friend class GuestWebContentsObserver; |
57 | 61 |
58 void AddRenderProcessHostID(int render_process_host_id); | 62 void AddRenderProcessHostID(int render_process_host_id); |
59 | 63 |
60 content::WebContents* GetGuestByInstanceID( | 64 content::WebContents* GetGuestByInstanceID( |
61 int guest_instance_id, | 65 int guest_instance_id, |
62 int embedder_render_process_id); | 66 int embedder_render_process_id); |
63 | 67 |
68 content::SiteInstance* GetGuestSiteInstance( | |
69 const GURL& guest_site); | |
70 | |
64 static bool CanEmbedderAccessGuest(int embedder_render_process_id, | 71 static bool CanEmbedderAccessGuest(int embedder_render_process_id, |
65 GuestViewBase* guest); | 72 GuestViewBase* guest); |
66 | 73 |
67 // Counts RenderProcessHost IDs of GuestViewBases. | 74 // Counts RenderProcessHost IDs of GuestViewBases. |
68 std::multiset<int> render_process_host_id_multiset_; | 75 std::multiset<int> render_process_host_id_multiset_; |
69 | 76 |
70 // Contains guests' WebContents, mapping from their instance ids. | 77 // Contains guests' WebContents, mapping from their instance ids. |
71 typedef std::map<int, content::WebContents*> GuestInstanceMap; | 78 typedef std::map<int, content::WebContents*> GuestInstanceMap; |
72 GuestInstanceMap guest_web_contents_by_instance_id_; | 79 GuestInstanceMap guest_web_contents_by_instance_id_; |
73 | 80 |
74 int current_instance_id_; | 81 int current_instance_id_; |
75 content::BrowserContext* context_; | 82 content::BrowserContext* context_; |
76 | 83 |
77 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); | 84 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); |
78 }; | 85 }; |
79 | 86 |
80 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ | 87 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ |
OLD | NEW |