Chromium Code Reviews| Index: chrome/browser/guest_view/guest_view_manager.h |
| diff --git a/chrome/browser/guest_view/guest_view_manager.h b/chrome/browser/guest_view/guest_view_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..94e86b74053369abe997f50b5af47c82b1c11323 |
| --- /dev/null |
| +++ b/chrome/browser/guest_view/guest_view_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_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ |
| +#define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_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 GuestViewBase; |
| +class GuestWebContentsObserver; |
| +class GURL; |
|
lazyboy
2014/05/01 20:06:59
nit: sort
Fady Samuel
2014/05/01 21:05:28
It is sorted, isn't it?
lazyboy
2014/05/01 22:38:45
Oh, I meant 'U'<'u'
|
| + |
| +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, |
| + GuestViewBase* guest); |
| + |
| + // Counts RenderProcessHost IDs of GuestViewBases. |
| + std::multiset<int> render_process_host_id_set_; |
|
lazyboy
2014/05/01 20:06:59
I'd just call it render_process_host_id_multiset_,
Fady Samuel
2014/05/01 21:05:28
Done.
|
| + |
| + // Contains guests' WebContents, mapping from their instance ids. |
| + typedef std::map<int, content::WebContents*> GuestInstanceMap; |
| + GuestInstanceMap guest_web_contents_by_instance_id_; |
| + |
| + int current_instance_id_; |
| + content::BrowserContext* context_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(GuestViewManager); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ |