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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 23530029: Support webview tag when the container extension is embedded in a webUI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 extra_params->GetString(guestview::kParameterApi, &api_type); 784 extra_params->GetString(guestview::kParameterApi, &api_type);
784 785
785 *guest_delegate = 786 *guest_delegate =
786 GuestView::Create(guest_web_contents, 787 GuestView::Create(guest_web_contents,
787 GuestView::GetViewTypeFromString(api_type)); 788 GuestView::GetViewTypeFromString(api_type));
788 } 789 }
789 790
790 void ChromeContentBrowserClient::GuestWebContentsAttached( 791 void ChromeContentBrowserClient::GuestWebContentsAttached(
791 WebContents* guest_web_contents, 792 WebContents* guest_web_contents,
792 WebContents* embedder_web_contents, 793 WebContents* embedder_web_contents,
794 const GURL& embedder_frame_url,
793 const base::DictionaryValue& extra_params) { 795 const base::DictionaryValue& extra_params) {
794 Profile* profile = Profile::FromBrowserContext( 796 Profile* profile = Profile::FromBrowserContext(
795 embedder_web_contents->GetBrowserContext()); 797 embedder_web_contents->GetBrowserContext());
796 ExtensionService* service = 798 ExtensionService* service =
797 extensions::ExtensionSystem::Get(profile)->extension_service(); 799 extensions::ExtensionSystem::Get(profile)->extension_service();
798 if (!service) { 800 if (!service) {
799 NOTREACHED(); 801 NOTREACHED();
800 return; 802 return;
801 } 803 }
802 const GURL& url = embedder_web_contents->GetSiteInstance()->GetSiteURL(); 804
803 const Extension* extension = 805 // We usually require BrowserPlugins to be hosted by a storage isolated
804 service->extensions()->GetExtensionOrAppByURL(url); 806 // extension. We treat WebUI pages as a special case if they host the
807 // BrowserPlugin in a component extension iframe. In that case, we use the
808 // iframe's URL to determine the extension.
809 const GURL& embedder_site_url =
810 embedder_web_contents->GetSiteInstance()->GetSiteURL();
811 const Extension* extension = service->extensions()->GetExtensionOrAppByURL(
812 content::HasWebUIScheme(embedder_site_url) ?
813 embedder_frame_url : embedder_site_url);
805 if (!extension) { 814 if (!extension) {
806 // It's ok to return here, since we could be running a browser plugin 815 // It's ok to return here, since we could be running a browser plugin
807 // outside an extension, and don't need to attach a 816 // outside an extension, and don't need to attach a
808 // BrowserPluginGuestDelegate in that case; 817 // BrowserPluginGuestDelegate in that case;
809 // e.g. running with flag --enable-browser-plugin-for-all-view-types. 818 // e.g. running with flag --enable-browser-plugin-for-all-view-types.
810 return; 819 return;
811 } 820 }
812 821
813 GuestView* guest = GuestView::FromWebContents(guest_web_contents); 822 GuestView* guest = GuestView::FromWebContents(guest_web_contents);
814 if (!guest) { 823 if (!guest) {
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 } 2334 }
2326 return NULL; 2335 return NULL;
2327 } 2336 }
2328 2337
2329 bool ChromeContentBrowserClient::SupportsBrowserPlugin( 2338 bool ChromeContentBrowserClient::SupportsBrowserPlugin(
2330 content::BrowserContext* browser_context, const GURL& site_url) { 2339 content::BrowserContext* browser_context, const GURL& site_url) {
2331 if (CommandLine::ForCurrentProcess()->HasSwitch( 2340 if (CommandLine::ForCurrentProcess()->HasSwitch(
2332 switches::kEnableBrowserPluginForAllViewTypes)) 2341 switches::kEnableBrowserPluginForAllViewTypes))
2333 return true; 2342 return true;
2334 2343
2344 if (content::HasWebUIScheme(site_url))
2345 return true;
2346
2335 Profile* profile = Profile::FromBrowserContext(browser_context); 2347 Profile* profile = Profile::FromBrowserContext(browser_context);
2336 ExtensionService* service = 2348 ExtensionService* service =
2337 extensions::ExtensionSystem::Get(profile)->extension_service(); 2349 extensions::ExtensionSystem::Get(profile)->extension_service();
2338 if (!service) 2350 if (!service)
2339 return false; 2351 return false;
2340 2352
2341 const Extension* extension = 2353 const Extension* extension =
2342 service->extensions()->GetExtensionOrAppByURL(site_url); 2354 service->extensions()->GetExtensionOrAppByURL(site_url);
2343 if (!extension) 2355 if (!extension)
2344 return false; 2356 return false;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 #if defined(USE_NSS) 2538 #if defined(USE_NSS)
2527 crypto::CryptoModuleBlockingPasswordDelegate* 2539 crypto::CryptoModuleBlockingPasswordDelegate*
2528 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 2540 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
2529 const GURL& url) { 2541 const GURL& url) {
2530 return chrome::NewCryptoModuleBlockingDialogDelegate( 2542 return chrome::NewCryptoModuleBlockingDialogDelegate(
2531 chrome::kCryptoModulePasswordKeygen, url.host()); 2543 chrome::kCryptoModulePasswordKeygen, url.host());
2532 } 2544 }
2533 #endif 2545 #endif
2534 2546
2535 } // namespace chrome 2547 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | chrome/renderer/chrome_content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698