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

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

Issue 336283002: Remove GuestWebContentsCreated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simplify_creation
Patch Set: Merge with ToT Created 6 years, 6 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
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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 // safe to continue. 831 // safe to continue.
832 CHECK(can_be_default || !partition_domain->empty()); 832 CHECK(can_be_default || !partition_domain->empty());
833 } 833 }
834 834
835 content::WebContentsViewDelegate* 835 content::WebContentsViewDelegate*
836 ChromeContentBrowserClient::GetWebContentsViewDelegate( 836 ChromeContentBrowserClient::GetWebContentsViewDelegate(
837 content::WebContents* web_contents) { 837 content::WebContents* web_contents) {
838 return chrome::CreateWebContentsViewDelegate(web_contents); 838 return chrome::CreateWebContentsViewDelegate(web_contents);
839 } 839 }
840 840
841 void ChromeContentBrowserClient::GuestWebContentsCreated(
842 int guest_instance_id,
843 SiteInstance* guest_site_instance,
844 WebContents* guest_web_contents,
845 WebContents* opener_web_contents,
846 content::BrowserPluginGuestDelegate** guest_delegate,
847 scoped_ptr<base::DictionaryValue> extra_params) {
848 #if defined(ENABLE_EXTENSIONS)
849 if (!guest_site_instance) {
850 NOTREACHED();
851 return;
852 }
853 GURL guest_site_url = guest_site_instance->GetSiteURL();
854 const std::string& extension_id = guest_site_url.host();
855
856 Profile* profile = Profile::FromBrowserContext(
857 guest_web_contents->GetBrowserContext());
858 ExtensionService* service =
859 extensions::ExtensionSystem::Get(profile)->extension_service();
860 if (!service) {
861 NOTREACHED();
862 return;
863 }
864
865 /// TODO(fsamuel): In the future, certain types of GuestViewBases won't
866 // require extension bindings. At that point, we should clear |extension_id|
867 // instead of exiting early.
868 if (!extension_id.empty() &&
869 !service->GetExtensionById(extension_id, false)) {
870 NOTREACHED();
871 return;
872 }
873
874 if (opener_web_contents) {
875 GuestViewBase* guest = GuestViewBase::FromWebContents(opener_web_contents);
876 DCHECK(guest);
877
878 // Create a new GuestViewBase of the same type as the opener.
879 *guest_delegate = GuestViewBase::Create(
880 guest_instance_id,
881 guest_web_contents,
882 extension_id,
883 guest->GetViewType());
884 return;
885 }
886
887 if (!extra_params) {
888 NOTREACHED();
889 return;
890 }
891 std::string api_type;
892 extra_params->GetString(guestview::kParameterApi, &api_type);
893
894 if (api_type.empty())
895 return;
896
897 *guest_delegate =
898 GuestViewBase::Create(guest_instance_id,
899 guest_web_contents,
900 extension_id,
901 api_type);
902 #else
903 NOTREACHED();
904 #endif // defined(ENABLE_EXTENSIONS)
905 }
906
907 void ChromeContentBrowserClient::RenderProcessWillLaunch( 841 void ChromeContentBrowserClient::RenderProcessWillLaunch(
908 content::RenderProcessHost* host) { 842 content::RenderProcessHost* host) {
909 int id = host->GetID(); 843 int id = host->GetID();
910 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); 844 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
911 net::URLRequestContextGetter* context = 845 net::URLRequestContextGetter* context =
912 profile->GetRequestContextForRenderProcess(id); 846 profile->GetRequestContextForRenderProcess(id);
913 847
914 host->AddFilter(new ChromeRenderMessageFilter(id, profile)); 848 host->AddFilter(new ChromeRenderMessageFilter(id, profile));
915 #if defined(ENABLE_EXTENSIONS) 849 #if defined(ENABLE_EXTENSIONS)
916 host->AddFilter(new ChromeExtensionMessageFilter(id, profile)); 850 host->AddFilter(new ChromeExtensionMessageFilter(id, profile));
(...skipping 1952 matching lines...) Expand 10 before | Expand all | Expand 10 after
2869 switches::kDisableWebRtcEncryption, 2803 switches::kDisableWebRtcEncryption,
2870 }; 2804 };
2871 to_command_line->CopySwitchesFrom(from_command_line, 2805 to_command_line->CopySwitchesFrom(from_command_line,
2872 kWebRtcDevSwitchNames, 2806 kWebRtcDevSwitchNames,
2873 arraysize(kWebRtcDevSwitchNames)); 2807 arraysize(kWebRtcDevSwitchNames));
2874 } 2808 }
2875 } 2809 }
2876 #endif // defined(ENABLE_WEBRTC) 2810 #endif // defined(ENABLE_WEBRTC)
2877 2811
2878 } // namespace chrome 2812 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | chrome/browser/extensions/api/guest_view/guest_view_internal_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698