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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 818 // safe to continue. | 818 // safe to continue. |
| 819 CHECK(can_be_default || !partition_domain->empty()); | 819 CHECK(can_be_default || !partition_domain->empty()); |
| 820 } | 820 } |
| 821 | 821 |
| 822 content::WebContentsViewDelegate* | 822 content::WebContentsViewDelegate* |
| 823 ChromeContentBrowserClient::GetWebContentsViewDelegate( | 823 ChromeContentBrowserClient::GetWebContentsViewDelegate( |
| 824 content::WebContents* web_contents) { | 824 content::WebContents* web_contents) { |
| 825 return chrome::CreateWebContentsViewDelegate(web_contents); | 825 return chrome::CreateWebContentsViewDelegate(web_contents); |
| 826 } | 826 } |
| 827 | 827 |
| 828 void ChromeContentBrowserClient::GuestWebContentsCreated( | |
|
lazyboy
2014/06/17 23:46:45
After GuestWebContentsAttached() gets/got removed,
Fady Samuel
2014/06/18 21:08:33
We still refer to GuestView* and WebViewGuest in t
| |
| 829 int guest_instance_id, | |
| 830 SiteInstance* guest_site_instance, | |
| 831 WebContents* guest_web_contents, | |
| 832 WebContents* opener_web_contents, | |
| 833 content::BrowserPluginGuestDelegate** guest_delegate, | |
| 834 scoped_ptr<base::DictionaryValue> extra_params) { | |
| 835 #if defined(ENABLE_EXTENSIONS) | |
| 836 if (!guest_site_instance) { | |
| 837 NOTREACHED(); | |
| 838 return; | |
| 839 } | |
| 840 GURL guest_site_url = guest_site_instance->GetSiteURL(); | |
| 841 const std::string& extension_id = guest_site_url.host(); | |
| 842 | |
| 843 Profile* profile = Profile::FromBrowserContext( | |
| 844 guest_web_contents->GetBrowserContext()); | |
| 845 ExtensionService* service = | |
| 846 extensions::ExtensionSystem::Get(profile)->extension_service(); | |
| 847 if (!service) { | |
| 848 NOTREACHED(); | |
| 849 return; | |
| 850 } | |
| 851 | |
| 852 /// TODO(fsamuel): In the future, certain types of GuestViewBases won't | |
| 853 // require extension bindings. At that point, we should clear |extension_id| | |
| 854 // instead of exiting early. | |
| 855 if (!extension_id.empty() && | |
| 856 !service->GetExtensionById(extension_id, false)) { | |
| 857 NOTREACHED(); | |
| 858 return; | |
| 859 } | |
| 860 | |
| 861 if (opener_web_contents) { | |
| 862 GuestViewBase* guest = GuestViewBase::FromWebContents(opener_web_contents); | |
| 863 DCHECK(guest); | |
| 864 | |
| 865 // Create a new GuestViewBase of the same type as the opener. | |
| 866 *guest_delegate = GuestViewBase::Create( | |
| 867 guest_instance_id, | |
| 868 guest_web_contents, | |
| 869 extension_id, | |
| 870 guest->GetViewType()); | |
| 871 return; | |
| 872 } | |
| 873 | |
| 874 if (!extra_params) { | |
| 875 NOTREACHED(); | |
| 876 return; | |
| 877 } | |
| 878 std::string api_type; | |
| 879 extra_params->GetString(guestview::kParameterApi, &api_type); | |
| 880 | |
| 881 if (api_type.empty()) | |
| 882 return; | |
| 883 | |
| 884 *guest_delegate = | |
| 885 GuestViewBase::Create(guest_instance_id, | |
| 886 guest_web_contents, | |
| 887 extension_id, | |
| 888 api_type); | |
| 889 #else | |
| 890 NOTREACHED(); | |
| 891 #endif // defined(ENABLE_EXTENSIONS) | |
| 892 } | |
| 893 | |
| 894 void ChromeContentBrowserClient::RenderProcessWillLaunch( | 828 void ChromeContentBrowserClient::RenderProcessWillLaunch( |
| 895 content::RenderProcessHost* host) { | 829 content::RenderProcessHost* host) { |
| 896 int id = host->GetID(); | 830 int id = host->GetID(); |
| 897 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 831 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
| 898 net::URLRequestContextGetter* context = | 832 net::URLRequestContextGetter* context = |
| 899 profile->GetRequestContextForRenderProcess(id); | 833 profile->GetRequestContextForRenderProcess(id); |
| 900 | 834 |
| 901 host->AddFilter(new ChromeRenderMessageFilter(id, profile)); | 835 host->AddFilter(new ChromeRenderMessageFilter(id, profile)); |
| 902 #if defined(ENABLE_EXTENSIONS) | 836 #if defined(ENABLE_EXTENSIONS) |
| 903 host->AddFilter(new ChromeExtensionMessageFilter(id, profile)); | 837 host->AddFilter(new ChromeExtensionMessageFilter(id, profile)); |
| (...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2829 switches::kDisableWebRtcEncryption, | 2763 switches::kDisableWebRtcEncryption, |
| 2830 }; | 2764 }; |
| 2831 to_command_line->CopySwitchesFrom(from_command_line, | 2765 to_command_line->CopySwitchesFrom(from_command_line, |
| 2832 kWebRtcDevSwitchNames, | 2766 kWebRtcDevSwitchNames, |
| 2833 arraysize(kWebRtcDevSwitchNames)); | 2767 arraysize(kWebRtcDevSwitchNames)); |
| 2834 } | 2768 } |
| 2835 } | 2769 } |
| 2836 #endif // defined(ENABLE_WEBRTC) | 2770 #endif // defined(ENABLE_WEBRTC) |
| 2837 | 2771 |
| 2838 } // namespace chrome | 2772 } // namespace chrome |
| OLD | NEW |