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

Unified Diff: chrome/browser/guest_view/guest_view_base.h

Issue 258373002: Towards moving guest management to chrome: Introduce GuestViewManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Android build 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/guest_view/guest_view.h ('k') | chrome/browser/guest_view/guest_view_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/guest_view/guest_view_base.h
diff --git a/chrome/browser/guest_view/guest_view_base.h b/chrome/browser/guest_view/guest_view_base.h
index 76ea724d5194dca28902f45f73d8d843a8814183..3fe02f404a0aaa9240ac58b98bb3351bf8fbee6c 100644
--- a/chrome/browser/guest_view/guest_view_base.h
+++ b/chrome/browser/guest_view/guest_view_base.h
@@ -39,15 +39,16 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate {
// Returns a *ViewGuest if this GuestView is of the given view type.
template <typename T>
T* As() {
- if (!strcmp(GetViewType(), T::Type)) {
+ if (IsViewType(T::Type))
return static_cast<T*>(this);
- }
+
return NULL;
}
static GuestViewBase* Create(content::WebContents* guest_web_contents,
const std::string& embedder_extension_id,
- const std::string& view_type);
+ const std::string& view_type,
+ const base::WeakPtr<GuestViewBase>& opener);
static GuestViewBase* FromWebContents(content::WebContents* web_contents);
@@ -71,6 +72,12 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate {
virtual const char* GetViewType() const = 0;
+ bool IsViewType(const char* const view_type) const {
+ return !strcmp(GetViewType(), view_type);
+ }
+
+ base::WeakPtr<GuestViewBase> AsWeakPtr();
+
virtual void Attach(content::WebContents* embedder_web_contents,
const base::DictionaryValue& args);
@@ -106,9 +113,14 @@ class GuestViewBase : 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:
GuestViewBase(content::WebContents* guest_web_contents,
- const std::string& embedder_extension_id);
+ const std::string& embedder_extension_id,
+ const base::WeakPtr<GuestViewBase>& opener);
virtual ~GuestViewBase();
// Dispatches an event |event_name| to the embedder with the |event| fields.
@@ -133,6 +145,9 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate {
// the guest is attached to a particular embedder.
std::deque<linked_ptr<Event> > pending_events_;
+ // The opener guest view.
+ base::WeakPtr<GuestViewBase> opener_;
+
// This is used to ensure pending tasks will not fire after this object is
// destroyed.
base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_;
« no previous file with comments | « chrome/browser/guest_view/guest_view.h ('k') | chrome/browser/guest_view/guest_view_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698