diff options
author | d.halman@gmail.com <d.halman@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-22 06:14:18 +0000 |
---|---|---|
committer | d.halman@gmail.com <d.halman@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-22 06:14:18 +0000 |
commit | 0b36507c63d3a524a1cdad7f1585c16327684b10 (patch) | |
tree | e12d734e14a12cf020e398cc17bc550be512b0a5 /extensions/browser/extension_web_contents_observer.h | |
parent | 002da7b2877ebd64d6ae62d98bf2a196c0a98eae (diff) | |
download | chromium_src-0b36507c63d3a524a1cdad7f1585c16327684b10.zip chromium_src-0b36507c63d3a524a1cdad7f1585c16327684b10.tar.gz chromium_src-0b36507c63d3a524a1cdad7f1585c16327684b10.tar.bz2 |
Ensure extensions.getViews(type: "tab") contains tab created by window.open
A tab's ViewType is set by RenderViewCreated. It turns out window.open does not
trigger a call to ExtensionWebContentsObserver::RenderViewCreated like
tabs.create does. This is the reason ViewType is not set for window.open.
The constructor is called for both cases, and I found that sending the same message:
render_view_host->Send(new ExtensionMsg_NotifyRenderViewType(
render_view_host->GetRoutingID(),
GetViewType(web_contents())));
from the constructor (copy pasted from RenderViewCreated) ensures the view's type is
set from the web contents whether or not the view was rendered. This passes the
test extension posted in the bug description.
However, this may be a simple cover up for the real issue of RenderViewCreated
not being called in the window.open case. I am not extremely familiar with the
way this object is supposed to be treated, so I'll defer to reviewers on the
proper fix.
BUG=341459
Review URL: https://codereview.chromium.org/200513007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258794 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions/browser/extension_web_contents_observer.h')
-rw-r--r-- | extensions/browser/extension_web_contents_observer.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/extensions/browser/extension_web_contents_observer.h b/extensions/browser/extension_web_contents_observer.h index a366e43..5cb797b 100644 --- a/extensions/browser/extension_web_contents_observer.h +++ b/extensions/browser/extension_web_contents_observer.h @@ -45,6 +45,9 @@ class ExtensionWebContentsObserver : public content::WebContentsObserver { // NULL if the render view host is not for a valid extension. const Extension* GetExtension(content::RenderViewHost* render_view_host); + // Updates ViewType for RenderViewHost based on GetViewType(web_contents()). + void NotifyRenderViewType(content::RenderViewHost* render_view_host); + // Returns the extension or app ID associated with a render view host. Returns // the empty string if the render view host is not for a valid extension. static std::string GetExtensionId(content::RenderViewHost* render_view_host); |