| 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 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
| 16 #include "base/prefs/scoped_user_pref_update.h" | 16 #include "base/prefs/scoped_user_pref_update.h" |
| 17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/threading/sequenced_worker_pool.h" | 19 #include "base/threading/sequenced_worker_pool.h" |
| 20 #include "chrome/browser/browser_about_handler.h" | 20 #include "chrome/browser/browser_about_handler.h" |
| 21 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 22 #include "chrome/browser/browser_shutdown.h" | 22 #include "chrome/browser/browser_shutdown.h" |
| 23 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 23 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 24 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 24 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 25 #include "chrome/browser/character_encoding.h" | 25 #include "chrome/browser/character_encoding.h" |
| 26 #include "chrome/browser/chrome_content_browser_client_parts.h" |
| 26 #include "chrome/browser/chrome_net_benchmarking_message_filter.h" | 27 #include "chrome/browser/chrome_net_benchmarking_message_filter.h" |
| 27 #include "chrome/browser/chrome_quota_permission_context.h" | 28 #include "chrome/browser/chrome_quota_permission_context.h" |
| 28 #include "chrome/browser/content_settings/content_settings_utils.h" | 29 #include "chrome/browser/content_settings/content_settings_utils.h" |
| 29 #include "chrome/browser/content_settings/cookie_settings.h" | 30 #include "chrome/browser/content_settings/cookie_settings.h" |
| 30 #include "chrome/browser/content_settings/host_content_settings_map.h" | 31 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 31 #include "chrome/browser/content_settings/permission_request_id.h" | 32 #include "chrome/browser/content_settings/permission_request_id.h" |
| 32 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 33 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 33 #include "chrome/browser/defaults.h" | 34 #include "chrome/browser/defaults.h" |
| 34 #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h" | 35 #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h" |
| 35 #include "chrome/browser/download/download_prefs.h" | 36 #include "chrome/browser/download/download_prefs.h" |
| 36 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par
t.h" | |
| 37 #include "chrome/browser/font_family_cache.h" | 37 #include "chrome/browser/font_family_cache.h" |
| 38 #include "chrome/browser/geolocation/chrome_access_token_store.h" | 38 #include "chrome/browser/geolocation/chrome_access_token_store.h" |
| 39 #include "chrome/browser/geolocation/geolocation_permission_context.h" | 39 #include "chrome/browser/geolocation/geolocation_permission_context.h" |
| 40 #include "chrome/browser/geolocation/geolocation_permission_context_factory.h" | 40 #include "chrome/browser/geolocation/geolocation_permission_context_factory.h" |
| 41 #include "chrome/browser/media/cast_transport_host_filter.h" | 41 #include "chrome/browser/media/cast_transport_host_filter.h" |
| 42 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 42 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 43 #include "chrome/browser/media/midi_permission_context.h" | 43 #include "chrome/browser/media/midi_permission_context.h" |
| 44 #include "chrome/browser/media/midi_permission_context_factory.h" | 44 #include "chrome/browser/media/midi_permission_context_factory.h" |
| 45 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 45 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
| 46 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" | 46 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 210 |
| 211 #if !defined(DISABLE_NACL) | 211 #if !defined(DISABLE_NACL) |
| 212 #include "components/nacl/browser/nacl_browser.h" | 212 #include "components/nacl/browser/nacl_browser.h" |
| 213 #include "components/nacl/browser/nacl_host_message_filter.h" | 213 #include "components/nacl/browser/nacl_host_message_filter.h" |
| 214 #include "components/nacl/browser/nacl_process_host.h" | 214 #include "components/nacl/browser/nacl_process_host.h" |
| 215 #include "components/nacl/common/nacl_process_type.h" | 215 #include "components/nacl/common/nacl_process_type.h" |
| 216 #include "components/nacl/common/nacl_switches.h" | 216 #include "components/nacl/common/nacl_switches.h" |
| 217 #endif | 217 #endif |
| 218 | 218 |
| 219 #if defined(ENABLE_EXTENSIONS) | 219 #if defined(ENABLE_EXTENSIONS) |
| 220 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par
t.h" |
| 220 #include "chrome/browser/extensions/extension_service.h" | 221 #include "chrome/browser/extensions/extension_service.h" |
| 221 #include "chrome/browser/extensions/extension_util.h" | 222 #include "chrome/browser/extensions/extension_util.h" |
| 222 #include "chrome/browser/extensions/suggest_permission_util.h" | 223 #include "chrome/browser/extensions/suggest_permission_util.h" |
| 223 #include "chrome/browser/guest_view/guest_view_base.h" | 224 #include "chrome/browser/guest_view/guest_view_base.h" |
| 224 #include "chrome/browser/guest_view/guest_view_constants.h" | 225 #include "chrome/browser/guest_view/guest_view_constants.h" |
| 225 #include "chrome/browser/guest_view/guest_view_manager.h" | 226 #include "chrome/browser/guest_view/guest_view_manager.h" |
| 226 #include "chrome/browser/guest_view/web_view/web_view_guest.h" | 227 #include "chrome/browser/guest_view/web_view/web_view_guest.h" |
| 227 #include "chrome/browser/guest_view/web_view/web_view_permission_helper.h" | 228 #include "chrome/browser/guest_view/web_view/web_view_permission_helper.h" |
| 228 #include "chrome/browser/guest_view/web_view/web_view_renderer_state.h" | 229 #include "chrome/browser/guest_view/web_view/web_view_renderer_state.h" |
| 229 #include "extensions/common/manifest_handlers/background_info.h" | 230 #include "extensions/common/manifest_handlers/background_info.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 248 using content::BrowserURLHandler; | 249 using content::BrowserURLHandler; |
| 249 using content::ChildProcessSecurityPolicy; | 250 using content::ChildProcessSecurityPolicy; |
| 250 using content::QuotaPermissionContext; | 251 using content::QuotaPermissionContext; |
| 251 using content::RenderFrameHost; | 252 using content::RenderFrameHost; |
| 252 using content::RenderViewHost; | 253 using content::RenderViewHost; |
| 253 using content::ResourceType; | 254 using content::ResourceType; |
| 254 using content::SiteInstance; | 255 using content::SiteInstance; |
| 255 using content::WebContents; | 256 using content::WebContents; |
| 256 using content::WebPreferences; | 257 using content::WebPreferences; |
| 257 using extensions::APIPermission; | 258 using extensions::APIPermission; |
| 258 using extensions::ChromeContentBrowserClientExtensionsPart; | |
| 259 using extensions::Extension; | 259 using extensions::Extension; |
| 260 using extensions::InfoMap; | 260 using extensions::InfoMap; |
| 261 using extensions::Manifest; | 261 using extensions::Manifest; |
| 262 using message_center::NotifierId; | 262 using message_center::NotifierId; |
| 263 | 263 |
| 264 #if defined(OS_POSIX) | 264 #if defined(OS_POSIX) |
| 265 using content::FileDescriptorInfo; | 265 using content::FileDescriptorInfo; |
| 266 #endif | 266 #endif |
| 267 | 267 |
| 268 #if defined(ENABLE_EXTENSIONS) |
| 269 using extensions::ChromeContentBrowserClientExtensionsPart; |
| 270 #endif |
| 271 |
| 268 namespace { | 272 namespace { |
| 269 | 273 |
| 270 // Cached version of the locale so we can return the locale on the I/O | 274 // Cached version of the locale so we can return the locale on the I/O |
| 271 // thread. | 275 // thread. |
| 272 base::LazyInstance<std::string> g_io_thread_application_locale; | 276 base::LazyInstance<std::string> g_io_thread_application_locale; |
| 273 | 277 |
| 274 #if defined(ENABLE_PLUGINS) | 278 #if defined(ENABLE_PLUGINS) |
| 275 // TODO(teravest): Add renderer-side API-specific checking for these APIs so | 279 // TODO(teravest): Add renderer-side API-specific checking for these APIs so |
| 276 // that blanket permission isn't granted to all dev channel APIs for these. | 280 // that blanket permission isn't granted to all dev channel APIs for these. |
| 277 // http://crbug.com/386743 | 281 // http://crbug.com/386743 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); | 576 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); |
| 573 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) | 577 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) |
| 574 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); | 578 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); |
| 575 #endif | 579 #endif |
| 576 | 580 |
| 577 #if !defined(OS_ANDROID) | 581 #if !defined(OS_ANDROID) |
| 578 TtsExtensionEngine* tts_extension_engine = TtsExtensionEngine::GetInstance(); | 582 TtsExtensionEngine* tts_extension_engine = TtsExtensionEngine::GetInstance(); |
| 579 TtsController::GetInstance()->SetTtsEngineDelegate(tts_extension_engine); | 583 TtsController::GetInstance()->SetTtsEngineDelegate(tts_extension_engine); |
| 580 #endif | 584 #endif |
| 581 | 585 |
| 586 #if defined(ENABLE_EXTENSIONS) |
| 582 extra_parts_.push_back(new ChromeContentBrowserClientExtensionsPart); | 587 extra_parts_.push_back(new ChromeContentBrowserClientExtensionsPart); |
| 588 #endif |
| 583 } | 589 } |
| 584 | 590 |
| 585 ChromeContentBrowserClient::~ChromeContentBrowserClient() { | 591 ChromeContentBrowserClient::~ChromeContentBrowserClient() { |
| 586 for (int i = static_cast<int>(extra_parts_.size()) - 1; i >= 0; --i) | 592 for (int i = static_cast<int>(extra_parts_.size()) - 1; i >= 0; --i) |
| 587 delete extra_parts_[i]; | 593 delete extra_parts_[i]; |
| 588 extra_parts_.clear(); | 594 extra_parts_.clear(); |
| 589 } | 595 } |
| 590 | 596 |
| 591 // static | 597 // static |
| 592 void ChromeContentBrowserClient::RegisterProfilePrefs( | 598 void ChromeContentBrowserClient::RegisterProfilePrefs( |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 | 847 |
| 842 #if !defined(OS_CHROMEOS) | 848 #if !defined(OS_CHROMEOS) |
| 843 // If the input |url| should be assigned to the Signin renderer, make its | 849 // If the input |url| should be assigned to the Signin renderer, make its |
| 844 // effective URL distinct from other URLs on the signin service's domain. | 850 // effective URL distinct from other URLs on the signin service's domain. |
| 845 // Note that the signin renderer will be allowed to sign the user in to | 851 // Note that the signin renderer will be allowed to sign the user in to |
| 846 // Chrome. | 852 // Chrome. |
| 847 if (SigninManager::IsWebBasedSigninFlowURL(url)) | 853 if (SigninManager::IsWebBasedSigninFlowURL(url)) |
| 848 return GetEffectiveURLForSignin(url); | 854 return GetEffectiveURLForSignin(url); |
| 849 #endif | 855 #endif |
| 850 | 856 |
| 857 #if defined(ENABLE_EXTENSIONS) |
| 851 return ChromeContentBrowserClientExtensionsPart::GetEffectiveURL( | 858 return ChromeContentBrowserClientExtensionsPart::GetEffectiveURL( |
| 852 profile, url); | 859 profile, url); |
| 860 #else |
| 861 return url; |
| 862 #endif |
| 853 } | 863 } |
| 854 | 864 |
| 855 bool ChromeContentBrowserClient::ShouldUseProcessPerSite( | 865 bool ChromeContentBrowserClient::ShouldUseProcessPerSite( |
| 856 content::BrowserContext* browser_context, const GURL& effective_url) { | 866 content::BrowserContext* browser_context, const GURL& effective_url) { |
| 857 // Non-extension, non-Instant URLs should generally use | 867 // Non-extension, non-Instant URLs should generally use |
| 858 // process-per-site-instance. Because we expect to use the effective URL, | 868 // process-per-site-instance. Because we expect to use the effective URL, |
| 859 // URLs for hosted apps (apart from bookmark apps) should have an extension | 869 // URLs for hosted apps (apart from bookmark apps) should have an extension |
| 860 // scheme by now. | 870 // scheme by now. |
| 861 | 871 |
| 862 Profile* profile = Profile::FromBrowserContext(browser_context); | 872 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 863 if (!profile) | 873 if (!profile) |
| 864 return false; | 874 return false; |
| 865 | 875 |
| 866 if (chrome::ShouldUseProcessPerSiteForInstantURL(effective_url, profile)) | 876 if (chrome::ShouldUseProcessPerSiteForInstantURL(effective_url, profile)) |
| 867 return true; | 877 return true; |
| 868 | 878 |
| 869 #if !defined(OS_CHROMEOS) | 879 #if !defined(OS_CHROMEOS) |
| 870 if (SigninManager::IsWebBasedSigninFlowURL(effective_url)) | 880 if (SigninManager::IsWebBasedSigninFlowURL(effective_url)) |
| 871 return true; | 881 return true; |
| 872 #endif | 882 #endif |
| 873 | 883 |
| 884 #if defined(ENABLE_EXTENSIONS) |
| 874 return ChromeContentBrowserClientExtensionsPart::ShouldUseProcessPerSite( | 885 return ChromeContentBrowserClientExtensionsPart::ShouldUseProcessPerSite( |
| 875 profile, effective_url); | 886 profile, effective_url); |
| 887 #else |
| 888 return false; |
| 889 #endif |
| 876 } | 890 } |
| 877 | 891 |
| 878 // These are treated as WebUI schemes but do not get WebUI bindings. Also, | 892 // These are treated as WebUI schemes but do not get WebUI bindings. Also, |
| 879 // view-source is allowed for these schemes. | 893 // view-source is allowed for these schemes. |
| 880 void ChromeContentBrowserClient::GetAdditionalWebUISchemes( | 894 void ChromeContentBrowserClient::GetAdditionalWebUISchemes( |
| 881 std::vector<std::string>* additional_schemes) { | 895 std::vector<std::string>* additional_schemes) { |
| 882 additional_schemes->push_back(chrome::kChromeSearchScheme); | 896 additional_schemes->push_back(chrome::kChromeSearchScheme); |
| 883 additional_schemes->push_back(dom_distiller::kDomDistillerScheme); | 897 additional_schemes->push_back(dom_distiller::kDomDistillerScheme); |
| 884 } | 898 } |
| 885 | 899 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 request_interceptors.Pass()); | 932 request_interceptors.Pass()); |
| 919 } | 933 } |
| 920 | 934 |
| 921 bool ChromeContentBrowserClient::IsHandledURL(const GURL& url) { | 935 bool ChromeContentBrowserClient::IsHandledURL(const GURL& url) { |
| 922 return ProfileIOData::IsHandledURL(url); | 936 return ProfileIOData::IsHandledURL(url); |
| 923 } | 937 } |
| 924 | 938 |
| 925 bool ChromeContentBrowserClient::CanCommitURL( | 939 bool ChromeContentBrowserClient::CanCommitURL( |
| 926 content::RenderProcessHost* process_host, | 940 content::RenderProcessHost* process_host, |
| 927 const GURL& url) { | 941 const GURL& url) { |
| 942 #if defined(ENABLE_EXTENSIONS) |
| 928 return ChromeContentBrowserClientExtensionsPart::CanCommitURL( | 943 return ChromeContentBrowserClientExtensionsPart::CanCommitURL( |
| 929 process_host, url); | 944 process_host, url); |
| 945 #else |
| 946 return true; |
| 947 #endif |
| 930 } | 948 } |
| 931 | 949 |
| 932 bool ChromeContentBrowserClient::ShouldAllowOpenURL( | 950 bool ChromeContentBrowserClient::ShouldAllowOpenURL( |
| 933 content::SiteInstance* site_instance, const GURL& url) { | 951 content::SiteInstance* site_instance, const GURL& url) { |
| 934 GURL from_url = site_instance->GetSiteURL(); | 952 GURL from_url = site_instance->GetSiteURL(); |
| 935 | 953 |
| 954 #if defined(ENABLE_EXTENSIONS) |
| 936 bool result; | 955 bool result; |
| 937 if (ChromeContentBrowserClientExtensionsPart::ShouldAllowOpenURL( | 956 if (ChromeContentBrowserClientExtensionsPart::ShouldAllowOpenURL( |
| 938 site_instance, from_url, url, &result)) | 957 site_instance, from_url, url, &result)) |
| 939 return result; | 958 return result; |
| 959 #endif |
| 940 | 960 |
| 941 // Do not allow chrome://chrome-signin navigate to other chrome:// URLs, since | 961 // Do not allow chrome://chrome-signin navigate to other chrome:// URLs, since |
| 942 // the signin page may host untrusted web content. | 962 // the signin page may host untrusted web content. |
| 943 if (from_url.GetOrigin().spec() == chrome::kChromeUIChromeSigninURL && | 963 if (from_url.GetOrigin().spec() == chrome::kChromeUIChromeSigninURL && |
| 944 url.SchemeIs(content::kChromeUIScheme) && | 964 url.SchemeIs(content::kChromeUIScheme) && |
| 945 url.host() != chrome::kChromeUIChromeSigninHost) { | 965 url.host() != chrome::kChromeUIChromeSigninHost) { |
| 946 VLOG(1) << "Blocked navigation to " << url.spec() << " from " | 966 VLOG(1) << "Blocked navigation to " << url.spec() << " from " |
| 947 << chrome::kChromeUIChromeSigninURL; | 967 << chrome::kChromeUIChromeSigninURL; |
| 948 return false; | 968 return false; |
| 949 } | 969 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 974 return is_instant_process && should_be_in_instant_process; | 994 return is_instant_process && should_be_in_instant_process; |
| 975 } | 995 } |
| 976 | 996 |
| 977 #if !defined(OS_CHROMEOS) | 997 #if !defined(OS_CHROMEOS) |
| 978 SigninClient* signin_client = | 998 SigninClient* signin_client = |
| 979 ChromeSigninClientFactory::GetForProfile(profile); | 999 ChromeSigninClientFactory::GetForProfile(profile); |
| 980 if (signin_client && signin_client->IsSigninProcess(process_host->GetID())) | 1000 if (signin_client && signin_client->IsSigninProcess(process_host->GetID())) |
| 981 return SigninManager::IsWebBasedSigninFlowURL(site_url); | 1001 return SigninManager::IsWebBasedSigninFlowURL(site_url); |
| 982 #endif | 1002 #endif |
| 983 | 1003 |
| 1004 #if defined(ENABLE_EXTENSIONS) |
| 984 return ChromeContentBrowserClientExtensionsPart::IsSuitableHost( | 1005 return ChromeContentBrowserClientExtensionsPart::IsSuitableHost( |
| 985 profile, process_host, site_url); | 1006 profile, process_host, site_url); |
| 1007 #else |
| 1008 return true; |
| 1009 #endif |
| 986 } | 1010 } |
| 987 | 1011 |
| 988 bool ChromeContentBrowserClient::MayReuseHost( | 1012 bool ChromeContentBrowserClient::MayReuseHost( |
| 989 content::RenderProcessHost* process_host) { | 1013 content::RenderProcessHost* process_host) { |
| 990 // If there is currently a prerender in progress for the host provided, | 1014 // If there is currently a prerender in progress for the host provided, |
| 991 // it may not be shared. We require prerenders to be by themselves in a | 1015 // it may not be shared. We require prerenders to be by themselves in a |
| 992 // separate process, so that we can monitor their resource usage, and so that | 1016 // separate process, so that we can monitor their resource usage, and so that |
| 993 // we can track the cookies that they change. | 1017 // we can track the cookies that they change. |
| 994 Profile* profile = Profile::FromBrowserContext( | 1018 Profile* profile = Profile::FromBrowserContext( |
| 995 process_host->GetBrowserContext()); | 1019 process_host->GetBrowserContext()); |
| 996 prerender::PrerenderManager* prerender_manager = | 1020 prerender::PrerenderManager* prerender_manager = |
| 997 prerender::PrerenderManagerFactory::GetForProfile(profile); | 1021 prerender::PrerenderManagerFactory::GetForProfile(profile); |
| 998 if (prerender_manager && | 1022 if (prerender_manager && |
| 999 !prerender_manager->MayReuseProcessHost(process_host)) { | 1023 !prerender_manager->MayReuseProcessHost(process_host)) { |
| 1000 return false; | 1024 return false; |
| 1001 } | 1025 } |
| 1002 | 1026 |
| 1003 return true; | 1027 return true; |
| 1004 } | 1028 } |
| 1005 | 1029 |
| 1006 bool ChromeContentBrowserClient::ShouldTryToUseExistingProcessHost( | 1030 bool ChromeContentBrowserClient::ShouldTryToUseExistingProcessHost( |
| 1007 content::BrowserContext* browser_context, const GURL& url) { | 1031 content::BrowserContext* browser_context, const GURL& url) { |
| 1008 // It has to be a valid URL for us to check for an extension. | 1032 // It has to be a valid URL for us to check for an extension. |
| 1009 if (!url.is_valid()) | 1033 if (!url.is_valid()) |
| 1010 return false; | 1034 return false; |
| 1011 | 1035 |
| 1036 #if defined(ENABLE_EXTENSIONS) |
| 1012 Profile* profile = Profile::FromBrowserContext(browser_context); | 1037 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 1013 return ChromeContentBrowserClientExtensionsPart:: | 1038 return ChromeContentBrowserClientExtensionsPart:: |
| 1014 ShouldTryToUseExistingProcessHost( | 1039 ShouldTryToUseExistingProcessHost( |
| 1015 profile, url); | 1040 profile, url); |
| 1041 #else |
| 1042 return false; |
| 1043 #endif |
| 1016 } | 1044 } |
| 1017 | 1045 |
| 1018 void ChromeContentBrowserClient::SiteInstanceGotProcess( | 1046 void ChromeContentBrowserClient::SiteInstanceGotProcess( |
| 1019 SiteInstance* site_instance) { | 1047 SiteInstance* site_instance) { |
| 1020 CHECK(site_instance->HasProcess()); | 1048 CHECK(site_instance->HasProcess()); |
| 1021 | 1049 |
| 1022 Profile* profile = Profile::FromBrowserContext( | 1050 Profile* profile = Profile::FromBrowserContext( |
| 1023 site_instance->GetBrowserContext()); | 1051 site_instance->GetBrowserContext()); |
| 1024 if (!profile) | 1052 if (!profile) |
| 1025 return; | 1053 return; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1036 | 1064 |
| 1037 #if !defined(OS_CHROMEOS) | 1065 #if !defined(OS_CHROMEOS) |
| 1038 // We only expect there to be one signin process as we use process-per-site | 1066 // We only expect there to be one signin process as we use process-per-site |
| 1039 // for signin URLs. The signin process will be cleared from SigninManager | 1067 // for signin URLs. The signin process will be cleared from SigninManager |
| 1040 // when the renderer is destroyed. | 1068 // when the renderer is destroyed. |
| 1041 if (SigninManager::IsWebBasedSigninFlowURL(site_instance->GetSiteURL())) { | 1069 if (SigninManager::IsWebBasedSigninFlowURL(site_instance->GetSiteURL())) { |
| 1042 SigninClient* signin_client = | 1070 SigninClient* signin_client = |
| 1043 ChromeSigninClientFactory::GetForProfile(profile); | 1071 ChromeSigninClientFactory::GetForProfile(profile); |
| 1044 if (signin_client) | 1072 if (signin_client) |
| 1045 signin_client->SetSigninProcess(site_instance->GetProcess()->GetID()); | 1073 signin_client->SetSigninProcess(site_instance->GetProcess()->GetID()); |
| 1074 #if defined(ENABLE_EXTENSIONS) |
| 1046 ChromeContentBrowserClientExtensionsPart::SetSigninProcess(site_instance); | 1075 ChromeContentBrowserClientExtensionsPart::SetSigninProcess(site_instance); |
| 1076 #endif |
| 1047 } | 1077 } |
| 1048 #endif | 1078 #endif |
| 1049 | 1079 |
| 1050 for (size_t i = 0; i < extra_parts_.size(); ++i) | 1080 for (size_t i = 0; i < extra_parts_.size(); ++i) |
| 1051 extra_parts_[i]->SiteInstanceGotProcess(site_instance); | 1081 extra_parts_[i]->SiteInstanceGotProcess(site_instance); |
| 1052 } | 1082 } |
| 1053 | 1083 |
| 1054 void ChromeContentBrowserClient::SiteInstanceDeleting( | 1084 void ChromeContentBrowserClient::SiteInstanceDeleting( |
| 1055 SiteInstance* site_instance) { | 1085 SiteInstance* site_instance) { |
| 1056 if (!site_instance->HasProcess()) | 1086 if (!site_instance->HasProcess()) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1071 SiteInstance* site_instance, | 1101 SiteInstance* site_instance, |
| 1072 int worker_process_id) { | 1102 int worker_process_id) { |
| 1073 for (size_t i = 0; i < extra_parts_.size(); ++i) | 1103 for (size_t i = 0; i < extra_parts_.size(); ++i) |
| 1074 extra_parts_[i]->WorkerProcessTerminated(site_instance, worker_process_id); | 1104 extra_parts_[i]->WorkerProcessTerminated(site_instance, worker_process_id); |
| 1075 } | 1105 } |
| 1076 | 1106 |
| 1077 bool ChromeContentBrowserClient::ShouldSwapBrowsingInstancesForNavigation( | 1107 bool ChromeContentBrowserClient::ShouldSwapBrowsingInstancesForNavigation( |
| 1078 SiteInstance* site_instance, | 1108 SiteInstance* site_instance, |
| 1079 const GURL& current_url, | 1109 const GURL& current_url, |
| 1080 const GURL& new_url) { | 1110 const GURL& new_url) { |
| 1111 #if defined(ENABLE_EXTENSIONS) |
| 1081 return ChromeContentBrowserClientExtensionsPart:: | 1112 return ChromeContentBrowserClientExtensionsPart:: |
| 1082 ShouldSwapBrowsingInstancesForNavigation( | 1113 ShouldSwapBrowsingInstancesForNavigation( |
| 1083 site_instance, current_url, new_url); | 1114 site_instance, current_url, new_url); |
| 1115 #else |
| 1116 return false; |
| 1117 #endif |
| 1084 } | 1118 } |
| 1085 | 1119 |
| 1086 bool ChromeContentBrowserClient::ShouldSwapProcessesForRedirect( | 1120 bool ChromeContentBrowserClient::ShouldSwapProcessesForRedirect( |
| 1087 content::ResourceContext* resource_context, const GURL& current_url, | 1121 content::ResourceContext* resource_context, const GURL& current_url, |
| 1088 const GURL& new_url) { | 1122 const GURL& new_url) { |
| 1089 #if defined(ENABLE_EXTENSIONS) | 1123 #if defined(ENABLE_EXTENSIONS) |
| 1090 return ChromeContentBrowserClientExtensionsPart:: | 1124 return ChromeContentBrowserClientExtensionsPart:: |
| 1091 ShouldSwapProcessesForRedirect(resource_context, current_url, new_url); | 1125 ShouldSwapProcessesForRedirect(resource_context, current_url, new_url); |
| 1092 #else | 1126 #else |
| 1093 return false; | 1127 return false; |
| (...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2586 switches::kDisableWebRtcEncryption, | 2620 switches::kDisableWebRtcEncryption, |
| 2587 }; | 2621 }; |
| 2588 to_command_line->CopySwitchesFrom(from_command_line, | 2622 to_command_line->CopySwitchesFrom(from_command_line, |
| 2589 kWebRtcDevSwitchNames, | 2623 kWebRtcDevSwitchNames, |
| 2590 arraysize(kWebRtcDevSwitchNames)); | 2624 arraysize(kWebRtcDevSwitchNames)); |
| 2591 } | 2625 } |
| 2592 } | 2626 } |
| 2593 #endif // defined(ENABLE_WEBRTC) | 2627 #endif // defined(ENABLE_WEBRTC) |
| 2594 | 2628 |
| 2595 } // namespace chrome | 2629 } // namespace chrome |
| OLD | NEW |