| 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/guestview/adview/adview_guest.h" | 44 #include "chrome/browser/guest_view/ad_view/ad_view_guest.h" |
| 45 #include "chrome/browser/guestview/guestview.h" | 45 #include "chrome/browser/guest_view/guest_view_base.h" |
| 46 #include "chrome/browser/guestview/guestview_constants.h" | 46 #include "chrome/browser/guest_view/guest_view_constants.h" |
| 47 #include "chrome/browser/guestview/webview/webview_guest.h" | 47 #include "chrome/browser/guest_view/web_view/web_view_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 = GuestView::GetGuestPartitionConfigForSite( | 773 bool success = GuestViewBase::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 GuestViews won't require | 839 /// TODO(fsamuel): In the future, certain types of GuestViewBases won't |
| 840 // extension bindings. At that point, we should clear |extension_id| instead | 840 // require extension bindings. At that point, we should clear |extension_id| |
| 841 // of exiting early. | 841 // instead of exiting early. |
| 842 if (!service->GetExtensionById(extension_id, false) && | 842 if (!extension_id.empty() && |
| 843 !service->GetExtensionById(extension_id, false) && |
| 843 !CommandLine::ForCurrentProcess()->HasSwitch( | 844 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 844 switches::kEnableBrowserPluginForAllViewTypes)) { | 845 switches::kEnableBrowserPluginForAllViewTypes)) { |
| 845 NOTREACHED(); | 846 NOTREACHED(); |
| 846 return; | 847 return; |
| 847 } | 848 } |
| 848 | 849 |
| 849 if (opener_web_contents) { | 850 if (opener_web_contents) { |
| 850 GuestView* guest = GuestView::FromWebContents(opener_web_contents); | 851 GuestViewBase* guest = GuestViewBase::FromWebContents(opener_web_contents); |
| 851 if (!guest) { | 852 if (!guest) { |
| 852 NOTREACHED(); | 853 NOTREACHED(); |
| 853 return; | 854 return; |
| 854 } | 855 } |
| 855 | 856 |
| 856 // Create a new GuestView of the same type as the opener. | 857 // Create a new GuestViewBase of the same type as the opener. |
| 857 *guest_delegate = | 858 *guest_delegate = GuestViewBase::Create( |
| 858 GuestView::Create(guest_web_contents, | 859 guest_web_contents, extension_id, guest->GetViewType()); |
| 859 extension_id, | |
| 860 guest->GetViewType()); | |
| 861 return; | 860 return; |
| 862 } | 861 } |
| 863 | 862 |
| 864 if (!extra_params) { | 863 if (!extra_params) { |
| 865 NOTREACHED(); | 864 NOTREACHED(); |
| 866 return; | 865 return; |
| 867 } | 866 } |
| 868 std::string api_type; | 867 std::string api_type; |
| 869 extra_params->GetString(guestview::kParameterApi, &api_type); | 868 extra_params->GetString(guestview::kParameterApi, &api_type); |
| 870 | 869 |
| 871 if (api_type.empty()) | 870 if (api_type.empty()) |
| 872 return; | 871 return; |
| 873 | 872 |
| 874 *guest_delegate = | 873 *guest_delegate = |
| 875 GuestView::Create(guest_web_contents, | 874 GuestViewBase::Create(guest_web_contents, extension_id, api_type); |
| 876 extension_id, | |
| 877 GuestView::GetViewTypeFromString(api_type)); | |
| 878 } | 875 } |
| 879 | 876 |
| 880 void ChromeContentBrowserClient::GuestWebContentsAttached( | 877 void ChromeContentBrowserClient::GuestWebContentsAttached( |
| 881 WebContents* guest_web_contents, | 878 WebContents* guest_web_contents, |
| 882 WebContents* embedder_web_contents, | 879 WebContents* embedder_web_contents, |
| 883 const base::DictionaryValue& extra_params) { | 880 const base::DictionaryValue& extra_params) { |
| 884 | 881 GuestViewBase* guest = GuestViewBase::FromWebContents(guest_web_contents); |
| 885 GuestView* guest = GuestView::FromWebContents(guest_web_contents); | |
| 886 if (!guest) { | 882 if (!guest) { |
| 887 // It's ok to return here, since we could be running a browser plugin | 883 // It's ok to return here, since we could be running a browser plugin |
| 888 // outside an extension, and don't need to attach a | 884 // outside an extension, and don't need to attach a |
| 889 // BrowserPluginGuestDelegate in that case; | 885 // BrowserPluginGuestDelegate in that case; |
| 890 // e.g. running with flag --enable-browser-plugin-for-all-view-types. | 886 // e.g. running with flag --enable-browser-plugin-for-all-view-types. |
| 891 return; | 887 return; |
| 892 } | 888 } |
| 893 guest->Attach(embedder_web_contents, extra_params); | 889 guest->Attach(embedder_web_contents, extra_params); |
| 894 } | 890 } |
| 895 | 891 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 if (switches::IsNewProfileManagement()) | 936 if (switches::IsNewProfileManagement()) |
| 941 host->AddFilter(new PrincipalsMessageFilter(id)); | 937 host->AddFilter(new PrincipalsMessageFilter(id)); |
| 942 | 938 |
| 943 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( | 939 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( |
| 944 profile->IsOffTheRecord())); | 940 profile->IsOffTheRecord())); |
| 945 | 941 |
| 946 SendExtensionWebRequestStatusToHost(host); | 942 SendExtensionWebRequestStatusToHost(host); |
| 947 | 943 |
| 948 RendererContentSettingRules rules; | 944 RendererContentSettingRules rules; |
| 949 if (host->IsGuest()) { | 945 if (host->IsGuest()) { |
| 950 GuestView::GetDefaultContentSettingRules(&rules, profile->IsOffTheRecord()); | 946 GuestViewBase::GetDefaultContentSettingRules(&rules, |
| 947 profile->IsOffTheRecord()); |
| 951 } else { | 948 } else { |
| 952 GetRendererContentSettingRules( | 949 GetRendererContentSettingRules( |
| 953 profile->GetHostContentSettingsMap(), &rules); | 950 profile->GetHostContentSettingsMap(), &rules); |
| 954 } | 951 } |
| 955 host->Send(new ChromeViewMsg_SetContentSettingRules(rules)); | 952 host->Send(new ChromeViewMsg_SetContentSettingRules(rules)); |
| 956 } | 953 } |
| 957 | 954 |
| 958 GURL ChromeContentBrowserClient::GetEffectiveURL( | 955 GURL ChromeContentBrowserClient::GetEffectiveURL( |
| 959 content::BrowserContext* browser_context, const GURL& url) { | 956 content::BrowserContext* browser_context, const GURL& url) { |
| 960 Profile* profile = Profile::FromBrowserContext(browser_context); | 957 Profile* profile = Profile::FromBrowserContext(browser_context); |
| (...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2666 switches::kDisableWebRtcEncryption, | 2663 switches::kDisableWebRtcEncryption, |
| 2667 }; | 2664 }; |
| 2668 to_command_line->CopySwitchesFrom(from_command_line, | 2665 to_command_line->CopySwitchesFrom(from_command_line, |
| 2669 kWebRtcDevSwitchNames, | 2666 kWebRtcDevSwitchNames, |
| 2670 arraysize(kWebRtcDevSwitchNames)); | 2667 arraysize(kWebRtcDevSwitchNames)); |
| 2671 } | 2668 } |
| 2672 } | 2669 } |
| 2673 #endif // defined(ENABLE_WEBRTC) | 2670 #endif // defined(ENABLE_WEBRTC) |
| 2674 | 2671 |
| 2675 } // namespace chrome | 2672 } // namespace chrome |
| OLD | NEW |