Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 #include "content/public/browser/child_process_data.h" | 119 #include "content/public/browser/child_process_data.h" |
| 120 #include "content/public/browser/child_process_security_policy.h" | 120 #include "content/public/browser/child_process_security_policy.h" |
| 121 #include "content/public/browser/render_process_host.h" | 121 #include "content/public/browser/render_process_host.h" |
| 122 #include "content/public/browser/render_view_host.h" | 122 #include "content/public/browser/render_view_host.h" |
| 123 #include "content/public/browser/resource_context.h" | 123 #include "content/public/browser/resource_context.h" |
| 124 #include "content/public/browser/site_instance.h" | 124 #include "content/public/browser/site_instance.h" |
| 125 #include "content/public/browser/web_contents.h" | 125 #include "content/public/browser/web_contents.h" |
| 126 #include "content/public/browser/web_contents_view.h" | 126 #include "content/public/browser/web_contents_view.h" |
| 127 #include "content/public/common/child_process_host.h" | 127 #include "content/public/common/child_process_host.h" |
| 128 #include "content/public/common/content_descriptors.h" | 128 #include "content/public/common/content_descriptors.h" |
| 129 #include "content/public/common/url_utils.h" | |
| 129 #include "extensions/browser/view_type_utils.h" | 130 #include "extensions/browser/view_type_utils.h" |
| 130 #include "extensions/common/constants.h" | 131 #include "extensions/common/constants.h" |
| 131 #include "extensions/common/switches.h" | 132 #include "extensions/common/switches.h" |
| 132 #include "grit/generated_resources.h" | 133 #include "grit/generated_resources.h" |
| 133 #include "grit/ui_resources.h" | 134 #include "grit/ui_resources.h" |
| 134 #include "net/base/escape.h" | 135 #include "net/base/escape.h" |
| 135 #include "net/base/mime_util.h" | 136 #include "net/base/mime_util.h" |
| 136 #include "net/cookies/canonical_cookie.h" | 137 #include "net/cookies/canonical_cookie.h" |
| 137 #include "net/cookies/cookie_options.h" | 138 #include "net/cookies/cookie_options.h" |
| 138 #include "net/ssl/ssl_cert_request_info.h" | 139 #include "net/ssl/ssl_cert_request_info.h" |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 796 } else if (api_type == "webview") { | 797 } else if (api_type == "webview") { |
| 797 *guest_delegate = new WebViewGuest(guest_web_contents); | 798 *guest_delegate = new WebViewGuest(guest_web_contents); |
| 798 } else { | 799 } else { |
| 799 NOTREACHED(); | 800 NOTREACHED(); |
| 800 } | 801 } |
| 801 } | 802 } |
| 802 | 803 |
| 803 void ChromeContentBrowserClient::GuestWebContentsAttached( | 804 void ChromeContentBrowserClient::GuestWebContentsAttached( |
| 804 WebContents* guest_web_contents, | 805 WebContents* guest_web_contents, |
| 805 WebContents* embedder_web_contents, | 806 WebContents* embedder_web_contents, |
| 807 const GURL& embedder_frame_url, | |
| 806 const base::DictionaryValue& extra_params) { | 808 const base::DictionaryValue& extra_params) { |
| 807 Profile* profile = Profile::FromBrowserContext( | 809 Profile* profile = Profile::FromBrowserContext( |
| 808 embedder_web_contents->GetBrowserContext()); | 810 embedder_web_contents->GetBrowserContext()); |
| 809 ExtensionService* service = | 811 ExtensionService* service = |
| 810 extensions::ExtensionSystem::Get(profile)->extension_service(); | 812 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 811 if (!service) { | 813 if (!service) { |
| 812 NOTREACHED(); | 814 NOTREACHED(); |
| 813 return; | 815 return; |
| 814 } | 816 } |
| 815 const GURL& url = embedder_web_contents->GetSiteInstance()->GetSiteURL(); | 817 |
| 816 const Extension* extension = | 818 // 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.
| |
| 817 service->extensions()->GetExtensionOrAppByURL(url); | 819 const GURL& embedder_site_url = |
| 820 embedder_web_contents->GetSiteInstance()->GetSiteURL(); | |
| 821 const Extension* extension = service->extensions()->GetExtensionOrAppByURL( | |
| 822 content::HasWebUIScheme(embedder_site_url) ? | |
| 823 embedder_frame_url : embedder_site_url); | |
| 818 if (!extension) { | 824 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.
| |
| 819 // It's ok to return here, since we could be running a browser plugin | 825 // It's ok to return here, since we could be running a browser plugin |
| 820 // outside an extension, and don't need to attach a | 826 // outside an extension, and don't need to attach a |
| 821 // BrowserPluginGuestDelegate in that case; | 827 // BrowserPluginGuestDelegate in that case; |
| 822 // e.g. running with flag --enable-browser-plugin-for-all-view-types. | 828 // e.g. running with flag --enable-browser-plugin-for-all-view-types. |
| 823 return; | 829 return; |
| 824 } | 830 } |
| 825 | 831 |
| 826 GuestView* guest = GuestView::FromWebContents(guest_web_contents); | 832 GuestView* guest = GuestView::FromWebContents(guest_web_contents); |
| 827 if (!guest) { | 833 if (!guest) { |
| 828 NOTREACHED(); | 834 NOTREACHED(); |
| (...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2335 } | 2341 } |
| 2336 return NULL; | 2342 return NULL; |
| 2337 } | 2343 } |
| 2338 | 2344 |
| 2339 bool ChromeContentBrowserClient::SupportsBrowserPlugin( | 2345 bool ChromeContentBrowserClient::SupportsBrowserPlugin( |
| 2340 content::BrowserContext* browser_context, const GURL& site_url) { | 2346 content::BrowserContext* browser_context, const GURL& site_url) { |
| 2341 if (CommandLine::ForCurrentProcess()->HasSwitch( | 2347 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 2342 switches::kEnableBrowserPluginForAllViewTypes)) | 2348 switches::kEnableBrowserPluginForAllViewTypes)) |
| 2343 return true; | 2349 return true; |
| 2344 | 2350 |
| 2351 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.
| |
| 2352 return true; | |
| 2353 | |
| 2345 Profile* profile = Profile::FromBrowserContext(browser_context); | 2354 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 2346 ExtensionService* service = | 2355 ExtensionService* service = |
| 2347 extensions::ExtensionSystem::Get(profile)->extension_service(); | 2356 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 2348 if (!service) | 2357 if (!service) |
| 2349 return false; | 2358 return false; |
| 2350 | 2359 |
| 2351 const Extension* extension = | 2360 const Extension* extension = |
| 2352 service->extensions()->GetExtensionOrAppByURL(site_url); | 2361 service->extensions()->GetExtensionOrAppByURL(site_url); |
| 2353 if (!extension) | 2362 if (!extension) |
| 2354 return false; | 2363 return false; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2536 #if defined(USE_NSS) | 2545 #if defined(USE_NSS) |
| 2537 crypto::CryptoModuleBlockingPasswordDelegate* | 2546 crypto::CryptoModuleBlockingPasswordDelegate* |
| 2538 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 2547 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
| 2539 const GURL& url) { | 2548 const GURL& url) { |
| 2540 return chrome::NewCryptoModuleBlockingDialogDelegate( | 2549 return chrome::NewCryptoModuleBlockingDialogDelegate( |
| 2541 chrome::kCryptoModulePasswordKeygen, url.host()); | 2550 chrome::kCryptoModulePasswordKeygen, url.host()); |
| 2542 } | 2551 } |
| 2543 #endif | 2552 #endif |
| 2544 | 2553 |
| 2545 } // namespace chrome | 2554 } // namespace chrome |
| OLD | NEW |