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 23 matching lines...) Expand all Loading... |
34 #include "chrome/browser/download/download_prefs.h" | 34 #include "chrome/browser/download/download_prefs.h" |
35 #include "chrome/browser/extensions/api/web_request/web_request_api.h" | 35 #include "chrome/browser/extensions/api/web_request/web_request_api.h" |
36 #include "chrome/browser/extensions/browser_permissions_policy_delegate.h" | 36 #include "chrome/browser/extensions/browser_permissions_policy_delegate.h" |
37 #include "chrome/browser/extensions/extension_service.h" | 37 #include "chrome/browser/extensions/extension_service.h" |
38 #include "chrome/browser/extensions/extension_util.h" | 38 #include "chrome/browser/extensions/extension_util.h" |
39 #include "chrome/browser/extensions/extension_web_ui.h" | 39 #include "chrome/browser/extensions/extension_web_ui.h" |
40 #include "chrome/browser/extensions/extension_webkit_preferences.h" | 40 #include "chrome/browser/extensions/extension_webkit_preferences.h" |
41 #include "chrome/browser/extensions/suggest_permission_util.h" | 41 #include "chrome/browser/extensions/suggest_permission_util.h" |
42 #include "chrome/browser/geolocation/chrome_access_token_store.h" | 42 #include "chrome/browser/geolocation/chrome_access_token_store.h" |
43 #include "chrome/browser/google/google_util.h" | 43 #include "chrome/browser/google/google_util.h" |
44 #include "chrome/browser/guest_view/ad_view/ad_view_guest.h" | 44 #include "chrome/browser/guestview/adview/adview_guest.h" |
45 #include "chrome/browser/guest_view/guest_view_base.h" | 45 #include "chrome/browser/guestview/guestview.h" |
46 #include "chrome/browser/guest_view/guest_view_constants.h" | 46 #include "chrome/browser/guestview/guestview_constants.h" |
47 #include "chrome/browser/guest_view/web_view/web_view_guest.h" | 47 #include "chrome/browser/guestview/webview/webview_guest.h" |
48 #include "chrome/browser/media/cast_transport_host_filter.h" | 48 #include "chrome/browser/media/cast_transport_host_filter.h" |
49 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 49 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
50 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 50 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
51 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" | 51 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
52 #include "chrome/browser/net/chrome_net_log.h" | 52 #include "chrome/browser/net/chrome_net_log.h" |
53 #include "chrome/browser/notifications/desktop_notification_service.h" | 53 #include "chrome/browser/notifications/desktop_notification_service.h" |
54 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 54 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
55 #include "chrome/browser/platform_util.h" | 55 #include "chrome/browser/platform_util.h" |
56 #include "chrome/browser/plugins/plugin_info_message_filter.h" | 56 #include "chrome/browser/plugins/plugin_info_message_filter.h" |
57 #include "chrome/browser/prerender/prerender_final_status.h" | 57 #include "chrome/browser/prerender/prerender_final_status.h" |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 bool can_be_default, | 764 bool can_be_default, |
765 std::string* partition_domain, | 765 std::string* partition_domain, |
766 std::string* partition_name, | 766 std::string* partition_name, |
767 bool* in_memory) { | 767 bool* in_memory) { |
768 // Default to the browser-wide storage partition and override based on |site| | 768 // Default to the browser-wide storage partition and override based on |site| |
769 // below. | 769 // below. |
770 partition_domain->clear(); | 770 partition_domain->clear(); |
771 partition_name->clear(); | 771 partition_name->clear(); |
772 *in_memory = false; | 772 *in_memory = false; |
773 | 773 |
774 bool success = GuestViewBase::GetGuestPartitionConfigForSite( | 774 bool success = GuestView::GetGuestPartitionConfigForSite( |
775 site, partition_domain, partition_name, in_memory); | 775 site, partition_domain, partition_name, in_memory); |
776 | 776 |
777 if (!success && site.SchemeIs(extensions::kExtensionScheme)) { | 777 if (!success && site.SchemeIs(extensions::kExtensionScheme)) { |
778 // If |can_be_default| is false, the caller is stating that the |site| | 778 // If |can_be_default| is false, the caller is stating that the |site| |
779 // should be parsed as if it had isolated storage. In particular it is | 779 // should be parsed as if it had isolated storage. In particular it is |
780 // important to NOT check ExtensionService for the is_storage_isolated() | 780 // important to NOT check ExtensionService for the is_storage_isolated() |
781 // attribute because this code path is run during Extension uninstall | 781 // attribute because this code path is run during Extension uninstall |
782 // to do cleanup after the Extension has already been unloaded from the | 782 // to do cleanup after the Extension has already been unloaded from the |
783 // ExtensionService. | 783 // ExtensionService. |
784 bool is_isolated = !can_be_default; | 784 bool is_isolated = !can_be_default; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 | 830 |
831 Profile* profile = Profile::FromBrowserContext( | 831 Profile* profile = Profile::FromBrowserContext( |
832 guest_web_contents->GetBrowserContext()); | 832 guest_web_contents->GetBrowserContext()); |
833 ExtensionService* service = | 833 ExtensionService* service = |
834 extensions::ExtensionSystem::Get(profile)->extension_service(); | 834 extensions::ExtensionSystem::Get(profile)->extension_service(); |
835 if (!service) { | 835 if (!service) { |
836 NOTREACHED(); | 836 NOTREACHED(); |
837 return; | 837 return; |
838 } | 838 } |
839 | 839 |
840 /// TODO(fsamuel): In the future, certain types of GuestViewBases won't | 840 /// TODO(fsamuel): In the future, certain types of GuestViews won't require |
841 // require extension bindings. At that point, we should clear |extension_id| | 841 // extension bindings. At that point, we should clear |extension_id| instead |
842 // instead of exiting early. | 842 // of exiting early. |
843 if (!extension_id.empty() && | 843 if (!service->GetExtensionById(extension_id, false) && |
844 !service->GetExtensionById(extension_id, false) && | |
845 !CommandLine::ForCurrentProcess()->HasSwitch( | 844 !CommandLine::ForCurrentProcess()->HasSwitch( |
846 switches::kEnableBrowserPluginForAllViewTypes)) { | 845 switches::kEnableBrowserPluginForAllViewTypes)) { |
847 NOTREACHED(); | 846 NOTREACHED(); |
848 return; | 847 return; |
849 } | 848 } |
850 | 849 |
851 if (opener_web_contents) { | 850 if (opener_web_contents) { |
852 GuestViewBase* guest = GuestViewBase::FromWebContents(opener_web_contents); | 851 GuestView* guest = GuestView::FromWebContents(opener_web_contents); |
853 if (!guest) { | 852 if (!guest) { |
854 NOTREACHED(); | 853 NOTREACHED(); |
855 return; | 854 return; |
856 } | 855 } |
857 | 856 |
858 // Create a new GuestViewBase of the same type as the opener. | 857 // Create a new GuestView of the same type as the opener. |
859 *guest_delegate = GuestViewBase::Create( | 858 *guest_delegate = |
860 guest_web_contents, extension_id, guest->GetViewType()); | 859 GuestView::Create(guest_web_contents, |
| 860 extension_id, |
| 861 guest->GetViewType()); |
861 return; | 862 return; |
862 } | 863 } |
863 | 864 |
864 if (!extra_params) { | 865 if (!extra_params) { |
865 NOTREACHED(); | 866 NOTREACHED(); |
866 return; | 867 return; |
867 } | 868 } |
868 std::string api_type; | 869 std::string api_type; |
869 extra_params->GetString(guestview::kParameterApi, &api_type); | 870 extra_params->GetString(guestview::kParameterApi, &api_type); |
870 | 871 |
871 if (api_type.empty()) | 872 if (api_type.empty()) |
872 return; | 873 return; |
873 | 874 |
874 *guest_delegate = | 875 *guest_delegate = |
875 GuestViewBase::Create(guest_web_contents, extension_id, api_type); | 876 GuestView::Create(guest_web_contents, |
| 877 extension_id, |
| 878 GuestView::GetViewTypeFromString(api_type)); |
876 } | 879 } |
877 | 880 |
878 void ChromeContentBrowserClient::GuestWebContentsAttached( | 881 void ChromeContentBrowserClient::GuestWebContentsAttached( |
879 WebContents* guest_web_contents, | 882 WebContents* guest_web_contents, |
880 WebContents* embedder_web_contents, | 883 WebContents* embedder_web_contents, |
881 const base::DictionaryValue& extra_params) { | 884 const base::DictionaryValue& extra_params) { |
882 GuestViewBase* guest = GuestViewBase::FromWebContents(guest_web_contents); | 885 |
| 886 GuestView* guest = GuestView::FromWebContents(guest_web_contents); |
883 if (!guest) { | 887 if (!guest) { |
884 // It's ok to return here, since we could be running a browser plugin | 888 // It's ok to return here, since we could be running a browser plugin |
885 // outside an extension, and don't need to attach a | 889 // outside an extension, and don't need to attach a |
886 // BrowserPluginGuestDelegate in that case; | 890 // BrowserPluginGuestDelegate in that case; |
887 // e.g. running with flag --enable-browser-plugin-for-all-view-types. | 891 // e.g. running with flag --enable-browser-plugin-for-all-view-types. |
888 return; | 892 return; |
889 } | 893 } |
890 guest->Attach(embedder_web_contents, extra_params); | 894 guest->Attach(embedder_web_contents, extra_params); |
891 } | 895 } |
892 | 896 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 if (switches::IsNewProfileManagement()) | 941 if (switches::IsNewProfileManagement()) |
938 host->AddFilter(new PrincipalsMessageFilter(id)); | 942 host->AddFilter(new PrincipalsMessageFilter(id)); |
939 | 943 |
940 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( | 944 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( |
941 profile->IsOffTheRecord())); | 945 profile->IsOffTheRecord())); |
942 | 946 |
943 SendExtensionWebRequestStatusToHost(host); | 947 SendExtensionWebRequestStatusToHost(host); |
944 | 948 |
945 RendererContentSettingRules rules; | 949 RendererContentSettingRules rules; |
946 if (host->IsGuest()) { | 950 if (host->IsGuest()) { |
947 GuestViewBase::GetDefaultContentSettingRules(&rules, | 951 GuestView::GetDefaultContentSettingRules(&rules, profile->IsOffTheRecord()); |
948 profile->IsOffTheRecord()); | |
949 } else { | 952 } else { |
950 GetRendererContentSettingRules( | 953 GetRendererContentSettingRules( |
951 profile->GetHostContentSettingsMap(), &rules); | 954 profile->GetHostContentSettingsMap(), &rules); |
952 } | 955 } |
953 host->Send(new ChromeViewMsg_SetContentSettingRules(rules)); | 956 host->Send(new ChromeViewMsg_SetContentSettingRules(rules)); |
954 } | 957 } |
955 | 958 |
956 GURL ChromeContentBrowserClient::GetEffectiveURL( | 959 GURL ChromeContentBrowserClient::GetEffectiveURL( |
957 content::BrowserContext* browser_context, const GURL& url) { | 960 content::BrowserContext* browser_context, const GURL& url) { |
958 Profile* profile = Profile::FromBrowserContext(browser_context); | 961 Profile* profile = Profile::FromBrowserContext(browser_context); |
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2665 switches::kDisableWebRtcEncryption, | 2668 switches::kDisableWebRtcEncryption, |
2666 }; | 2669 }; |
2667 to_command_line->CopySwitchesFrom(from_command_line, | 2670 to_command_line->CopySwitchesFrom(from_command_line, |
2668 kWebRtcDevSwitchNames, | 2671 kWebRtcDevSwitchNames, |
2669 arraysize(kWebRtcDevSwitchNames)); | 2672 arraysize(kWebRtcDevSwitchNames)); |
2670 } | 2673 } |
2671 } | 2674 } |
2672 #endif // defined(ENABLE_WEBRTC) | 2675 #endif // defined(ENABLE_WEBRTC) |
2673 | 2676 |
2674 } // namespace chrome | 2677 } // namespace chrome |
OLD | NEW |