Chromium Code Reviews| 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 content::WebContents* GetGuestByInstanceIDSafely( | |
| 33 int guest_instance_id, | |
| 34 int embedder_render_process_id); | |
| 35 bool CanEmbedderAccessInstanceIDMaybeKill( | |
| 36 int embedder_render_process_id, | |
| 37 int guest_instance_id); | |
| 38 bool CanEmbedderAccessInstanceID(int embedder_render_process_id, | |
|
lazyboy
2014/05/01 23:27:58
Exposing this publicly defeats the purpose since i
Fady Samuel
2014/05/06 16:51:36
Done.
| |
| 39 int guest_instance_id); | |
| 40 | |
| 32 // BrowserPluginGuestManagerDelegate implementation. | 41 // BrowserPluginGuestManagerDelegate implementation. |
| 33 virtual int GetNextInstanceID() OVERRIDE; | 42 virtual int GetNextInstanceID() OVERRIDE; |
| 34 virtual void AddGuest(int guest_instance_id, | 43 virtual void AddGuest(int guest_instance_id, |
| 35 content::WebContents* guest_web_contents) OVERRIDE; | 44 content::WebContents* guest_web_contents) OVERRIDE; |
| 36 virtual void RemoveGuest(int guest_instance_id) OVERRIDE; | 45 virtual void RemoveGuest(int guest_instance_id) OVERRIDE; |
| 37 virtual content::WebContents* GetGuestByInstanceID( | 46 virtual void MaybeGetGuestByInstanceIDOrKill( |
| 38 int guest_instance_id, | 47 int guest_instance_id, |
| 39 int embedder_render_process_id) OVERRIDE; | |
| 40 virtual bool CanEmbedderAccessInstanceIDMaybeKill( | |
| 41 int embedder_render_process_id, | 48 int embedder_render_process_id, |
| 42 int guest_instance_id) OVERRIDE; | 49 const GuestByInstanceIDCallback& callback) OVERRIDE; |
| 43 virtual bool CanEmbedderAccessInstanceID(int embedder_render_process_id, | |
| 44 int guest_instance_id) OVERRIDE; | |
| 45 virtual content::SiteInstance* GetGuestSiteInstance( | 50 virtual content::SiteInstance* GetGuestSiteInstance( |
| 46 const GURL& guest_site) OVERRIDE; | 51 const GURL& guest_site) OVERRIDE; |
| 47 virtual bool ForEachGuest(content::WebContents* embedder_web_contents, | 52 virtual bool ForEachGuest(content::WebContents* embedder_web_contents, |
| 48 const GuestCallback& callback) OVERRIDE; | 53 const GuestCallback& callback) OVERRIDE; |
| 49 | 54 |
| 50 private: | 55 private: |
| 51 friend class GuestWebContentsObserver; | 56 friend class GuestWebContentsObserver; |
| 52 | 57 |
| 53 void AddRenderProcessHostID(int render_process_host_id); | 58 void AddRenderProcessHostID(int render_process_host_id); |
| 54 | 59 |
| 60 content::WebContents* GetGuestByInstanceID( | |
|
lazyboy
2014/05/01 23:27:58
Doc, also say when it returns NULL etc.
Fady Samuel
2014/05/06 16:51:36
I documented the public method.
| |
| 61 int guest_instance_id, | |
| 62 int embedder_render_process_id); | |
| 63 | |
| 55 static bool CanEmbedderAccessGuest(int embedder_render_process_id, | 64 static bool CanEmbedderAccessGuest(int embedder_render_process_id, |
| 56 GuestViewBase* guest); | 65 GuestViewBase* guest); |
| 57 | 66 |
| 58 // Counts RenderProcessHost IDs of GuestViewBases. | 67 // Counts RenderProcessHost IDs of GuestViewBases. |
| 59 std::multiset<int> render_process_host_id_multiset_; | 68 std::multiset<int> render_process_host_id_multiset_; |
| 60 | 69 |
| 61 // Contains guests' WebContents, mapping from their instance ids. | 70 // Contains guests' WebContents, mapping from their instance ids. |
| 62 typedef std::map<int, content::WebContents*> GuestInstanceMap; | 71 typedef std::map<int, content::WebContents*> GuestInstanceMap; |
| 63 GuestInstanceMap guest_web_contents_by_instance_id_; | 72 GuestInstanceMap guest_web_contents_by_instance_id_; |
| 64 | 73 |
| 65 int current_instance_id_; | 74 int current_instance_id_; |
| 66 content::BrowserContext* context_; | 75 content::BrowserContext* context_; |
| 67 | 76 |
| 68 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); | 77 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); |
| 69 }; | 78 }; |
| 70 | 79 |
| 71 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ | 80 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ |
| OLD | NEW |