Chromium Code Reviews| Index: chrome/browser/guestview/guestview_manager.h |
| diff --git a/chrome/browser/guestview/guestview_manager.h b/chrome/browser/guestview/guestview_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2e487c8c34bb8a19a5ab58aed189925236b9703a |
| --- /dev/null |
| +++ b/chrome/browser/guestview/guestview_manager.h |
| @@ -0,0 +1,74 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_GUESTVIEW_GUESTVIEW_MANAGER_H_ |
| +#define CHROME_BROWSER_GUESTVIEW_GUESTVIEW_MANAGER_H_ |
| + |
| +#include <map> |
| + |
| +#include "base/lazy_instance.h" |
| +#include "base/macros.h" |
| +#include "content/public/browser/browser_plugin_guest_manager_delegate.h" |
| +#include "content/public/browser/site_instance.h" |
| +#include "content/public/browser/web_contents.h" |
| + |
| +class GuestView; |
| +class GuestWebContentsObserver; |
| +class GURL; |
| + |
| +namespace content { |
| +class BrowserContext; |
| +} // namespace content |
| + |
| +class GuestViewManager : public content::BrowserPluginGuestManagerDelegate, |
| + public base::SupportsUserData::Data { |
| + public: |
| + explicit GuestViewManager(content::BrowserContext* context); |
| + virtual ~GuestViewManager(); |
| + |
| + static GuestViewManager* FromBrowserContext(content::BrowserContext* context); |
| + |
| + // BrowserPluginGuestManagerDelegate implementation. |
| + virtual int GetNextInstanceID() OVERRIDE; |
| + virtual void AddGuest(int guest_instance_id, |
| + content::WebContents* guest_web_contents) OVERRIDE; |
| + virtual void RemoveGuest(int guest_instance_id) OVERRIDE; |
| + virtual content::WebContents* GetGuestByInstanceID( |
| + int guest_instance_id, |
| + int embedder_render_process_id) OVERRIDE; |
| + virtual bool CanEmbedderAccessInstanceIDMaybeKill( |
| + int embedder_render_process_id, |
| + int guest_instance_id) OVERRIDE; |
| + virtual bool CanEmbedderAccessInstanceID(int embedder_render_process_id, |
| + int guest_instance_id) OVERRIDE; |
| + virtual content::SiteInstance* GetGuestSiteInstance( |
| + const GURL& guest_site) OVERRIDE; |
| + virtual bool ForEachGuest(content::WebContents* embedder_web_contents, |
| + const GuestCallback& callback) OVERRIDE; |
| + virtual void RequestInstanceID( |
| + const std::string& src, |
| + const InstanceIDResponseCallback& callback) OVERRIDE; |
| + |
| + private: |
| + friend class GuestWebContentsObserver; |
| + |
| + void AddRenderProcessHostID(int render_process_host_id); |
| + |
| + static bool CanEmbedderAccessGuest(int embedder_render_process_id, |
| + GuestView* guest); |
| + |
| + // Counts RenderProcessHost IDs of GuestViews. |
| + std::multiset<int> render_process_host_id_set_; |
| + |
| + // Contains guests' WebContents, mapping from their instance ids. |
| + typedef std::map<int, content::WebContents*> GuestInstanceMap; |
| + GuestInstanceMap guest_web_contents_by_instance_id_; |
| + |
| + 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.
|
| + content::BrowserContext* context_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(GuestViewManager); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_GUESTVIEW_GUESTVIEW_MANAGER_H_ |