Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: chrome/browser/guest_view/guest_view_manager.h

Issue 258373002: Towards moving guest management to chrome: Introduce GuestViewManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with ToT Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_GUEST_VIEW_GUEST_VIEW_MANAGER_H_
6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_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 GuestViewBase;
17 class GuestWebContentsObserver;
18 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'
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 GuestViewBase* guest);
60
61 // Counts RenderProcessHost IDs of GuestViewBases.
62 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.
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 current_instance_id_;
69 content::BrowserContext* context_;
70
71 DISALLOW_COPY_AND_ASSIGN(GuestViewManager);
72 };
73
74 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698