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

Unified Diff: chrome/browser/guestview/guestview.h

Issue 258373002: Towards moving guest management to chrome: Introduce GuestViewManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed browser_tests + cleanup Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/guestview/guestview.h
diff --git a/chrome/browser/guestview/guestview.h b/chrome/browser/guestview/guestview.h
index 70dda8fa9997b407b37280f0cf1724c99cbac214..a8c2d5fcb11a9b8bec7bca3bac9fc4eaa8ed5cf6 100644
--- a/chrome/browser/guestview/guestview.h
+++ b/chrome/browser/guestview/guestview.h
@@ -46,7 +46,8 @@ class GuestView : public content::BrowserPluginGuestDelegate {
static GuestView* Create(content::WebContents* guest_web_contents,
const std::string& embedder_extension_id,
- Type view_type);
+ Type view_type,
+ const base::WeakPtr<GuestView>& opener);
static GuestView* FromWebContents(content::WebContents* web_contents);
@@ -82,6 +83,8 @@ class GuestView : public content::BrowserPluginGuestDelegate {
virtual Type GetViewType() const;
+ base::WeakPtr<GuestView> AsWeakPtr();
+
// Returns a WebViewGuest if this GuestView belongs to a <webview>.
virtual WebViewGuest* AsWebView() = 0;
@@ -113,9 +116,14 @@ class GuestView : public content::BrowserPluginGuestDelegate {
// Returns the embedder's process ID.
int embedder_render_process_id() const { return embedder_render_process_id_; }
+ // BrowserPluginGuestDelegate implementation.
+ virtual content::WebContents* GetOpener() const OVERRIDE;
+ virtual void SetOpener(content::WebContents* opener) OVERRIDE;
+
protected:
GuestView(content::WebContents* guest_web_contents,
- const std::string& embedder_extension_id);
+ const std::string& embedder_extension_id,
+ const base::WeakPtr<GuestView>& opener);
virtual ~GuestView();
// Dispatches an event |event_name| to the embedder with the |event| fields.
@@ -140,6 +148,9 @@ class GuestView : public content::BrowserPluginGuestDelegate {
// the guest is attached to a particular embedder.
std::deque<linked_ptr<Event> > pending_events_;
+ // Returns a WeakPtr to this GuestView.
+ base::WeakPtr<GuestView> opener_;
+
// This is used to ensure pending tasks will not fire after this object is
// destroyed.
base::WeakPtrFactory<GuestView> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698