Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_GUESTVIEW_GUESTVIEW_MANAGER_H_ | |
| 6 #define CHROME_BROWSER_GUESTVIEW_GUESTVIEW_MANAGER_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "base/lazy_instance.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "content/public/browser/browser_plugin_guest_manager_delegate.h" | |
| 13 #include "content/public/browser/site_instance.h" | |
| 14 #include "content/public/browser/web_contents.h" | |
| 15 | |
| 16 class GuestView; | |
| 17 class GuestWebContentsObserver; | |
| 18 class GURL; | |
| 19 | |
| 20 namespace content { | |
| 21 class BrowserContext; | |
| 22 } // namespace content | |
| 23 | |
| 24 class GuestViewManager : public content::BrowserPluginGuestManagerDelegate, | |
| 25 public base::SupportsUserData::Data { | |
| 26 public: | |
| 27 explicit GuestViewManager(content::BrowserContext* context); | |
| 28 virtual ~GuestViewManager(); | |
| 29 | |
| 30 static GuestViewManager* FromBrowserContext(content::BrowserContext* context); | |
| 31 | |
| 32 // BrowserPluginGuestManagerDelegate implementation. | |
| 33 virtual int GetNextInstanceID() OVERRIDE; | |
| 34 virtual void AddGuest(int guest_instance_id, | |
| 35 content::WebContents* guest_web_contents) OVERRIDE; | |
| 36 virtual void RemoveGuest(int guest_instance_id) OVERRIDE; | |
| 37 virtual content::WebContents* GetGuestByInstanceID( | |
| 38 int guest_instance_id, | |
| 39 int embedder_render_process_id) OVERRIDE; | |
| 40 virtual bool CanEmbedderAccessInstanceIDMaybeKill( | |
| 41 int embedder_render_process_id, | |
| 42 int guest_instance_id) OVERRIDE; | |
| 43 virtual bool CanEmbedderAccessInstanceID(int embedder_render_process_id, | |
| 44 int guest_instance_id) OVERRIDE; | |
| 45 virtual content::SiteInstance* GetGuestSiteInstance( | |
| 46 const GURL& guest_site) OVERRIDE; | |
| 47 virtual bool ForEachGuest(content::WebContents* embedder_web_contents, | |
| 48 const GuestCallback& callback) OVERRIDE; | |
| 49 virtual void RequestInstanceID( | |
| 50 const std::string& src, | |
| 51 const InstanceIDResponseCallback& callback) OVERRIDE; | |
| 52 | |
| 53 private: | |
| 54 friend class GuestWebContentsObserver; | |
| 55 | |
| 56 void AddRenderProcessHostID(int render_process_host_id); | |
| 57 | |
| 58 static bool CanEmbedderAccessGuest(int embedder_render_process_id, | |
| 59 GuestView* guest); | |
| 60 | |
| 61 // Counts RenderProcessHost IDs of GuestViews. | |
| 62 std::multiset<int> render_process_host_id_set_; | |
| 63 | |
| 64 // Contains guests' WebContents, mapping from their instance ids. | |
| 65 typedef std::map<int, content::WebContents*> GuestInstanceMap; | |
| 66 GuestInstanceMap guest_web_contents_by_instance_id_; | |
| 67 | |
| 68 int next_instance_id_; | |
|
lazyboy
2014/04/30 08:40:15
From its value in .cc, seems this is current insta
Fady Samuel
2014/05/01 02:04:42
Done.
Fady Samuel
2014/05/01 02:04:42
Done.
Fady Samuel
2014/05/01 02:04:42
Done.
| |
| 69 content::BrowserContext* context_; | |
| 70 | |
| 71 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); | |
| 72 }; | |
| 73 | |
| 74 #endif // CHROME_BROWSER_GUESTVIEW_GUESTVIEW_MANAGER_H_ | |
| OLD | NEW |