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

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: guest site instance fixed 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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
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();
816 const Extension* extension = 817 const Extension* extension =
817 service->extensions()->GetExtensionOrAppByURL(url); 818 service->extensions()->GetExtensionOrAppByURL(embedder_frame_url);
818 if (!extension) { 819 if (!extension) {
819 // It's ok to return here, since we could be running a browser plugin 820 // 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 821 // outside an extension, and don't need to attach a
821 // BrowserPluginGuestDelegate in that case; 822 // BrowserPluginGuestDelegate in that case;
822 // e.g. running with flag --enable-browser-plugin-for-all-view-types. 823 // e.g. running with flag --enable-browser-plugin-for-all-view-types.
823 return; 824 return;
824 } 825 }
825 826
826 GuestView* guest = GuestView::FromWebContents(guest_web_contents); 827 GuestView* guest = GuestView::FromWebContents(guest_web_contents);
827 if (!guest) { 828 if (!guest) {
(...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after
2335 } 2336 }
2336 return NULL; 2337 return NULL;
2337 } 2338 }
2338 2339
2339 bool ChromeContentBrowserClient::SupportsBrowserPlugin( 2340 bool ChromeContentBrowserClient::SupportsBrowserPlugin(
2340 content::BrowserContext* browser_context, const GURL& site_url) { 2341 content::BrowserContext* browser_context, const GURL& site_url) {
2341 if (CommandLine::ForCurrentProcess()->HasSwitch( 2342 if (CommandLine::ForCurrentProcess()->HasSwitch(
2342 switches::kEnableBrowserPluginForAllViewTypes)) 2343 switches::kEnableBrowserPluginForAllViewTypes))
2343 return true; 2344 return true;
2344 2345
2346 if (content::HasWebUIScheme(site_url))
2347 return true;
2348
2345 Profile* profile = Profile::FromBrowserContext(browser_context); 2349 Profile* profile = Profile::FromBrowserContext(browser_context);
2346 ExtensionService* service = 2350 ExtensionService* service =
2347 extensions::ExtensionSystem::Get(profile)->extension_service(); 2351 extensions::ExtensionSystem::Get(profile)->extension_service();
2348 if (!service) 2352 if (!service)
2349 return false; 2353 return false;
2350 2354
2351 const Extension* extension = 2355 const Extension* extension =
2352 service->extensions()->GetExtensionOrAppByURL(site_url); 2356 service->extensions()->GetExtensionOrAppByURL(site_url);
2353 if (!extension) 2357 if (!extension)
2354 return false; 2358 return false;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2536 #if defined(USE_NSS) 2540 #if defined(USE_NSS)
2537 crypto::CryptoModuleBlockingPasswordDelegate* 2541 crypto::CryptoModuleBlockingPasswordDelegate*
2538 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 2542 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
2539 const GURL& url) { 2543 const GURL& url) {
2540 return chrome::NewCryptoModuleBlockingDialogDelegate( 2544 return chrome::NewCryptoModuleBlockingDialogDelegate(
2541 chrome::kCryptoModulePasswordKeygen, url.host()); 2545 chrome::kCryptoModulePasswordKeygen, url.host());
2542 } 2546 }
2543 #endif 2547 #endif
2544 2548
2545 } // namespace chrome 2549 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698