Chromium Code Reviews| 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 865e80809455196ef5d46738757ad5ef2029a31d..e59abac87d1c22bdd142fa5924bb78e85eb4d9c7 100644 |
| --- a/chrome/browser/guest_view/guest_view_base.h |
| +++ b/chrome/browser/guest_view/guest_view_base.h |
| @@ -12,6 +12,7 @@ |
| #include "content/public/browser/browser_plugin_guest_delegate.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/browser/web_contents_delegate.h" |
| +#include "content/public/browser/web_contents_observer.h" |
| struct RendererContentSettingRules; |
| @@ -20,7 +21,8 @@ struct RendererContentSettingRules; |
| // WebContents and an embedder WebContents. It receives events issued from |
| // the guest and relays them to the embedder. |
|
lazyboy
2014/05/29 19:13:58
Add comment about this becoming a WCObserver.
Fady Samuel
2014/05/29 21:21:12
This almost seems like an implementation detail. I
|
| class GuestViewBase : public content::BrowserPluginGuestDelegate, |
| - public content::WebContentsDelegate { |
| + public content::WebContentsDelegate, |
| + public content::WebContentsObserver { |
| public: |
| class Event { |
| public: |
| @@ -74,6 +76,8 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate, |
| virtual const char* GetViewType() const = 0; |
| + virtual void EmbedderDestroyed() {} |
|
lazyboy
2014/05/29 19:13:58
Add documentation.
Fady Samuel
2014/05/29 21:21:12
Done.
|
| + |
| bool IsViewType(const char* const view_type) const { |
| return !strcmp(GetViewType(), view_type); |
| } |
| @@ -89,7 +93,7 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate, |
| // Returns the guest WebContents. |
| content::WebContents* guest_web_contents() const { |
| - return guest_web_contents_; |
| + return web_contents(); |
| } |
| // Returns the extra parameters associated with this GuestView passed |
| @@ -127,6 +131,9 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate, |
| void SetOpener(GuestViewBase* opener); |
| + // WebContentsObserver implementation. |
| + virtual void WebContentsDestroyed() OVERRIDE; |
| + |
| // WebContentsDelegate implementation. |
| virtual bool ShouldFocusPageAfterCrash() OVERRIDE; |
| virtual bool PreHandleGestureEvent( |
| @@ -147,9 +154,9 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate, |
| void DispatchEvent(Event* event); |
| private: |
| + class EmbedderWebContentsObserver; |
|
lazyboy
2014/05/29 19:13:58
nit: newline after this line.
Fady Samuel
2014/05/29 21:21:12
Done.
|
| void SendQueuedEvents(); |
| - content::WebContents* const guest_web_contents_; |
| content::WebContents* embedder_web_contents_; |
| const std::string embedder_extension_id_; |
| int embedder_render_process_id_; |
| @@ -176,6 +183,8 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate, |
| // are passed along to new guests that are created from this guest. |
| scoped_ptr<base::DictionaryValue> extra_params_; |
| + scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; |
| + |
| // This is used to ensure pending tasks will not fire after this object is |
| // destroyed. |
| base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; |