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