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

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

Issue 264943006: BrowserPlugin: Simplify content/public API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@guestview_manager_v1
Patch Set: Fixed nit 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
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
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 // Returns the guest WebContents associated with the given |guest_instance_id|
33 // if the provided |embedder_render_process_id| is allowed to access it.
34 // If the embedder is not allowed access, the embedder will be killed, and
35 // this method will return NULL. If no WebContents exists with the given
36 // instance ID, then NULL will also be returned.
37 content::WebContents* GetGuestByInstanceIDSafely(
38 int guest_instance_id,
39 int embedder_render_process_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(
61 int guest_instance_id,
62 int embedder_render_process_id);
63
64 bool CanEmbedderAccessInstanceIDMaybeKill(
65 int embedder_render_process_id,
66 int guest_instance_id);
67
68 bool CanEmbedderAccessInstanceID(int embedder_render_process_id,
69 int guest_instance_id);
70
55 static bool CanEmbedderAccessGuest(int embedder_render_process_id, 71 static bool CanEmbedderAccessGuest(int embedder_render_process_id,
56 GuestViewBase* guest); 72 GuestViewBase* guest);
57 73
58 // Counts RenderProcessHost IDs of GuestViewBases. 74 // Counts RenderProcessHost IDs of GuestViewBases.
59 std::multiset<int> render_process_host_id_multiset_; 75 std::multiset<int> render_process_host_id_multiset_;
60 76
61 // Contains guests' WebContents, mapping from their instance ids. 77 // Contains guests' WebContents, mapping from their instance ids.
62 typedef std::map<int, content::WebContents*> GuestInstanceMap; 78 typedef std::map<int, content::WebContents*> GuestInstanceMap;
63 GuestInstanceMap guest_web_contents_by_instance_id_; 79 GuestInstanceMap guest_web_contents_by_instance_id_;
64 80
65 int current_instance_id_; 81 int current_instance_id_;
66 content::BrowserContext* context_; 82 content::BrowserContext* context_;
67 83
68 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); 84 DISALLOW_COPY_AND_ASSIGN(GuestViewManager);
69 }; 85 };
70 86
71 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ 87 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698