Chromium Code Reviews| Index: chrome/browser/chrome_content_browser_client.cc |
| diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc |
| index 28382b921452de51c659ab88d84c5da821893bf2..d6848b8d412125dd15d7673418cc3ba97e5bf9ca 100644 |
| --- a/chrome/browser/chrome_content_browser_client.cc |
| +++ b/chrome/browser/chrome_content_browser_client.cc |
| @@ -126,6 +126,7 @@ |
| #include "content/public/browser/web_contents_view.h" |
| #include "content/public/common/child_process_host.h" |
| #include "content/public/common/content_descriptors.h" |
| +#include "content/public/common/url_utils.h" |
| #include "extensions/browser/view_type_utils.h" |
| #include "extensions/common/constants.h" |
| #include "extensions/common/switches.h" |
| @@ -803,6 +804,7 @@ void ChromeContentBrowserClient::GuestWebContentsCreated( |
| void ChromeContentBrowserClient::GuestWebContentsAttached( |
| WebContents* guest_web_contents, |
| WebContents* embedder_web_contents, |
| + const GURL& embedder_frame_url, |
| const base::DictionaryValue& extra_params) { |
| Profile* profile = Profile::FromBrowserContext( |
| embedder_web_contents->GetBrowserContext()); |
| @@ -812,9 +814,13 @@ void ChromeContentBrowserClient::GuestWebContentsAttached( |
| NOTREACHED(); |
| return; |
| } |
| - const GURL& url = embedder_web_contents->GetSiteInstance()->GetSiteURL(); |
| - const Extension* extension = |
| - service->extensions()->GetExtensionOrAppByURL(url); |
| + |
| + // Only trust |embedder_frame_url| reported by a WebUI renderer. |
|
Charlie Reis
2013/09/13 21:17:24
Let's be a little more explicit here. Something l
guohui
2013/09/16 22:27:02
Done.
|
| + const GURL& embedder_site_url = |
| + embedder_web_contents->GetSiteInstance()->GetSiteURL(); |
| + const Extension* extension = service->extensions()->GetExtensionOrAppByURL( |
| + content::HasWebUIScheme(embedder_site_url) ? |
| + embedder_frame_url : embedder_site_url); |
| if (!extension) { |
|
Charlie Reis
2013/09/13 21:17:24
Fady, would it make sense to add || !extension->is
guohui
2013/09/16 22:27:02
A webview (browser plugin) always has an isolated
Charlie Reis
2013/09/18 17:42:23
Ok. Fady and I talked about this and skipping thi
guohui
2013/09/19 13:48:41
Can we address this issue in a separate CL?
Charlie Reis
2013/09/19 17:21:22
Yes. As we discussed on https://codereview.chromi
guohui
2013/09/19 17:59:11
Done.
|
| // It's ok to return here, since we could be running a browser plugin |
| // outside an extension, and don't need to attach a |
| @@ -2342,6 +2348,9 @@ bool ChromeContentBrowserClient::SupportsBrowserPlugin( |
| switches::kEnableBrowserPluginForAllViewTypes)) |
| return true; |
| + if (content::HasWebUIScheme(site_url)) |
|
Charlie Reis
2013/09/13 21:17:24
Do we need all WebUI pages to be able to do this,
guohui
2013/09/16 22:27:02
As i replied to Fady, SupportsBrowserPlugin is cal
Charlie Reis
2013/09/18 17:42:23
Ok, let's skip the frame URL check.
guohui
2013/09/19 13:48:41
I prefer to allows it for all WebUI URLs if possib
Charlie Reis
2013/09/19 17:21:22
Ok. The whitelist in CL 23653012 should be suffic
guohui
2013/09/19 17:59:11
Done.
|
| + return true; |
| + |
| Profile* profile = Profile::FromBrowserContext(browser_context); |
| ExtensionService* service = |
| extensions::ExtensionSystem::Get(profile)->extension_service(); |