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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 #include "chrome/browser/printing/printing_message_filter.h" | 58 #include "chrome/browser/printing/printing_message_filter.h" |
59 #include "chrome/browser/profiles/profile.h" | 59 #include "chrome/browser/profiles/profile.h" |
60 #include "chrome/browser/profiles/profile_io_data.h" | 60 #include "chrome/browser/profiles/profile_io_data.h" |
61 #include "chrome/browser/profiles/profile_manager.h" | 61 #include "chrome/browser/profiles/profile_manager.h" |
62 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" | 62 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
63 #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory
.h" | 63 #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory
.h" |
64 #include "chrome/browser/search/instant_service.h" | 64 #include "chrome/browser/search/instant_service.h" |
65 #include "chrome/browser/search/instant_service_factory.h" | 65 #include "chrome/browser/search/instant_service_factory.h" |
66 #include "chrome/browser/search/search.h" | 66 #include "chrome/browser/search/search.h" |
67 #include "chrome/browser/search_engines/search_provider_install_state_message_fi
lter.h" | 67 #include "chrome/browser/search_engines/search_provider_install_state_message_fi
lter.h" |
68 #include "chrome/browser/signin/signin_manager.h" | |
69 #include "chrome/browser/signin/signin_manager_factory.h" | |
70 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" | 68 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" |
71 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" | 69 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" |
72 #include "chrome/browser/ssl/ssl_add_certificate.h" | 70 #include "chrome/browser/ssl/ssl_add_certificate.h" |
73 #include "chrome/browser/ssl/ssl_blocking_page.h" | 71 #include "chrome/browser/ssl/ssl_blocking_page.h" |
74 #include "chrome/browser/ssl/ssl_tab_helper.h" | 72 #include "chrome/browser/ssl/ssl_tab_helper.h" |
75 #include "chrome/browser/tab_contents/tab_util.h" | 73 #include "chrome/browser/tab_contents/tab_util.h" |
76 #include "chrome/browser/toolkit_extra_parts.h" | 74 #include "chrome/browser/toolkit_extra_parts.h" |
77 #include "chrome/browser/ui/chrome_select_file_policy.h" | 75 #include "chrome/browser/ui/chrome_select_file_policy.h" |
78 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" | 76 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" |
79 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 77 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 #endif | 158 #endif |
161 | 159 |
162 #if defined(OS_ANDROID) | 160 #if defined(OS_ANDROID) |
163 #include "ui/base/ui_base_paths.h" | 161 #include "ui/base/ui_base_paths.h" |
164 #endif | 162 #endif |
165 | 163 |
166 #if defined(USE_NSS) | 164 #if defined(USE_NSS) |
167 #include "chrome/browser/ui/crypto_module_password_dialog.h" | 165 #include "chrome/browser/ui/crypto_module_password_dialog.h" |
168 #endif | 166 #endif |
169 | 167 |
| 168 #if !defined(OS_CHROMEOS) |
| 169 #include "chrome/browser/signin/signin_manager.h" |
| 170 #include "chrome/browser/signin/signin_manager_factory.h" |
| 171 #endif |
| 172 |
170 using base::FileDescriptor; | 173 using base::FileDescriptor; |
171 using content::AccessTokenStore; | 174 using content::AccessTokenStore; |
172 using content::BrowserChildProcessHostIterator; | 175 using content::BrowserChildProcessHostIterator; |
173 using content::BrowserThread; | 176 using content::BrowserThread; |
174 using content::BrowserURLHandler; | 177 using content::BrowserURLHandler; |
175 using content::ChildProcessSecurityPolicy; | 178 using content::ChildProcessSecurityPolicy; |
176 using content::FileDescriptorInfo; | 179 using content::FileDescriptorInfo; |
177 using content::QuotaPermissionContext; | 180 using content::QuotaPermissionContext; |
178 using content::RenderViewHost; | 181 using content::RenderViewHost; |
179 using content::SiteInstance; | 182 using content::SiteInstance; |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 | 453 |
451 // Replace the scheme with "chrome-search:". | 454 // Replace the scheme with "chrome-search:". |
452 url_canon::Replacements<char> replacements; | 455 url_canon::Replacements<char> replacements; |
453 std::string search_scheme(chrome::kChromeSearchScheme); | 456 std::string search_scheme(chrome::kChromeSearchScheme); |
454 replacements.SetScheme(search_scheme.data(), | 457 replacements.SetScheme(search_scheme.data(), |
455 url_parse::Component(0, search_scheme.length())); | 458 url_parse::Component(0, search_scheme.length())); |
456 effective_url = effective_url.ReplaceComponents(replacements); | 459 effective_url = effective_url.ReplaceComponents(replacements); |
457 return effective_url; | 460 return effective_url; |
458 } | 461 } |
459 | 462 |
| 463 #if !defined(OS_CHROMEOS) |
460 GURL GetEffectiveURLForSignin(const GURL& url) { | 464 GURL GetEffectiveURLForSignin(const GURL& url) { |
461 CHECK(SigninManager::IsWebBasedSigninFlowURL(url)); | 465 CHECK(SigninManager::IsWebBasedSigninFlowURL(url)); |
462 | 466 |
463 GURL effective_url(SigninManager::kChromeSigninEffectiveSite); | 467 GURL effective_url(SigninManager::kChromeSigninEffectiveSite); |
464 // Copy the path because the argument to SetPathStr must outlive | 468 // Copy the path because the argument to SetPathStr must outlive |
465 // the Replacements object. | 469 // the Replacements object. |
466 const std::string path_copy(url.path()); | 470 const std::string path_copy(url.path()); |
467 GURL::Replacements replacements; | 471 GURL::Replacements replacements; |
468 replacements.SetPathStr(path_copy); | 472 replacements.SetPathStr(path_copy); |
469 effective_url = effective_url.ReplaceComponents(replacements); | 473 effective_url = effective_url.ReplaceComponents(replacements); |
470 return effective_url; | 474 return effective_url; |
471 } | 475 } |
| 476 #endif |
472 | 477 |
473 void SetApplicationLocaleOnIOThread(const std::string& locale) { | 478 void SetApplicationLocaleOnIOThread(const std::string& locale) { |
474 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 479 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
475 g_io_thread_application_locale.Get() = locale; | 480 g_io_thread_application_locale.Get() = locale; |
476 } | 481 } |
477 | 482 |
478 } // namespace | 483 } // namespace |
479 | 484 |
480 namespace chrome { | 485 namespace chrome { |
481 | 486 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 content::BrowserContext* browser_context, const GURL& url) { | 740 content::BrowserContext* browser_context, const GURL& url) { |
736 Profile* profile = Profile::FromBrowserContext(browser_context); | 741 Profile* profile = Profile::FromBrowserContext(browser_context); |
737 if (!profile) | 742 if (!profile) |
738 return url; | 743 return url; |
739 | 744 |
740 // If the input |url| should be assigned to the Instant renderer, make its | 745 // If the input |url| should be assigned to the Instant renderer, make its |
741 // effective URL distinct from other URLs on the search provider's domain. | 746 // effective URL distinct from other URLs on the search provider's domain. |
742 if (chrome::ShouldAssignURLToInstantRenderer(url, profile)) | 747 if (chrome::ShouldAssignURLToInstantRenderer(url, profile)) |
743 return GetEffectiveURLForInstant(url, profile); | 748 return GetEffectiveURLForInstant(url, profile); |
744 | 749 |
| 750 #if !defined(OS_CHROMEOS) |
745 // If the input |url| should be assigned to the Signin renderer, make its | 751 // If the input |url| should be assigned to the Signin renderer, make its |
746 // effective URL distinct from other URLs on the signin service's domain. | 752 // effective URL distinct from other URLs on the signin service's domain. |
747 // Note that the signin renderer will be allowed to sign the user in to | 753 // Note that the signin renderer will be allowed to sign the user in to |
748 // Chrome. | 754 // Chrome. |
749 if (SigninManager::IsWebBasedSigninFlowURL(url)) | 755 if (SigninManager::IsWebBasedSigninFlowURL(url)) |
750 return GetEffectiveURLForSignin(url); | 756 return GetEffectiveURLForSignin(url); |
| 757 #endif |
751 | 758 |
752 // If the input |url| is part of an installed app, the effective URL is an | 759 // If the input |url| is part of an installed app, the effective URL is an |
753 // extension URL with the ID of that extension as the host. This has the | 760 // extension URL with the ID of that extension as the host. This has the |
754 // effect of grouping apps together in a common SiteInstance. | 761 // effect of grouping apps together in a common SiteInstance. |
755 ExtensionService* extension_service = | 762 ExtensionService* extension_service = |
756 extensions::ExtensionSystem::Get(profile)->extension_service(); | 763 extensions::ExtensionSystem::Get(profile)->extension_service(); |
757 if (!extension_service) | 764 if (!extension_service) |
758 return url; | 765 return url; |
759 | 766 |
760 const Extension* extension = extension_service->extensions()-> | 767 const Extension* extension = extension_service->extensions()-> |
(...skipping 18 matching lines...) Expand all Loading... |
779 // URLs for hosted apps (apart from bookmark apps) should have an extension | 786 // URLs for hosted apps (apart from bookmark apps) should have an extension |
780 // scheme by now. | 787 // scheme by now. |
781 | 788 |
782 Profile* profile = Profile::FromBrowserContext(browser_context); | 789 Profile* profile = Profile::FromBrowserContext(browser_context); |
783 if (!profile) | 790 if (!profile) |
784 return false; | 791 return false; |
785 | 792 |
786 if (chrome::ShouldAssignURLToInstantRenderer(effective_url, profile)) | 793 if (chrome::ShouldAssignURLToInstantRenderer(effective_url, profile)) |
787 return true; | 794 return true; |
788 | 795 |
| 796 #if !defined(OS_CHROMEOS) |
789 if (SigninManager::IsWebBasedSigninFlowURL(effective_url)) | 797 if (SigninManager::IsWebBasedSigninFlowURL(effective_url)) |
790 return true; | 798 return true; |
| 799 #endif |
791 | 800 |
792 if (!effective_url.SchemeIs(extensions::kExtensionScheme)) | 801 if (!effective_url.SchemeIs(extensions::kExtensionScheme)) |
793 return false; | 802 return false; |
794 | 803 |
795 ExtensionService* extension_service = | 804 ExtensionService* extension_service = |
796 extensions::ExtensionSystem::Get(profile)->extension_service(); | 805 extensions::ExtensionSystem::Get(profile)->extension_service(); |
797 if (!extension_service) | 806 if (!extension_service) |
798 return false; | 807 return false; |
799 | 808 |
800 const Extension* extension = extension_service->extensions()-> | 809 const Extension* extension = extension_service->extensions()-> |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 InstantServiceFactory::GetForProfile(profile); | 873 InstantServiceFactory::GetForProfile(profile); |
865 if (instant_service) { | 874 if (instant_service) { |
866 bool is_instant_process = instant_service->IsInstantProcess( | 875 bool is_instant_process = instant_service->IsInstantProcess( |
867 process_host->GetID()); | 876 process_host->GetID()); |
868 bool should_be_in_instant_process = | 877 bool should_be_in_instant_process = |
869 chrome::ShouldAssignURLToInstantRenderer(site_url, profile); | 878 chrome::ShouldAssignURLToInstantRenderer(site_url, profile); |
870 if (is_instant_process || should_be_in_instant_process) | 879 if (is_instant_process || should_be_in_instant_process) |
871 return is_instant_process && should_be_in_instant_process; | 880 return is_instant_process && should_be_in_instant_process; |
872 } | 881 } |
873 | 882 |
| 883 #if !defined(OS_CHROMEOS) |
874 SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile); | 884 SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile); |
875 if (signin_manager && signin_manager->IsSigninProcess(process_host->GetID())) | 885 if (signin_manager && signin_manager->IsSigninProcess(process_host->GetID())) |
876 return SigninManager::IsWebBasedSigninFlowURL(site_url); | 886 return SigninManager::IsWebBasedSigninFlowURL(site_url); |
| 887 #endif |
877 | 888 |
878 ExtensionService* service = | 889 ExtensionService* service = |
879 extensions::ExtensionSystem::Get(profile)->extension_service(); | 890 extensions::ExtensionSystem::Get(profile)->extension_service(); |
880 extensions::ProcessMap* process_map = service->process_map(); | 891 extensions::ProcessMap* process_map = service->process_map(); |
881 | 892 |
882 // Don't allow the Task Manager to share a process with anything else. | 893 // Don't allow the Task Manager to share a process with anything else. |
883 // Otherwise it can affect the renderers it is observing. | 894 // Otherwise it can affect the renderers it is observing. |
884 // Note: we could create another RenderProcessHostPrivilege bucket for | 895 // Note: we could create another RenderProcessHostPrivilege bucket for |
885 // this to allow multiple chrome://tasks instances to share, but that's | 896 // this to allow multiple chrome://tasks instances to share, but that's |
886 // a very unlikely case without serious consequences. | 897 // a very unlikely case without serious consequences. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 // Remember the ID of the Instant process to signal the renderer process | 975 // Remember the ID of the Instant process to signal the renderer process |
965 // on startup in |AppendExtraCommandLineSwitches| below. | 976 // on startup in |AppendExtraCommandLineSwitches| below. |
966 if (chrome::ShouldAssignURLToInstantRenderer( | 977 if (chrome::ShouldAssignURLToInstantRenderer( |
967 site_instance->GetSiteURL(), profile)) { | 978 site_instance->GetSiteURL(), profile)) { |
968 InstantService* instant_service = | 979 InstantService* instant_service = |
969 InstantServiceFactory::GetForProfile(profile); | 980 InstantServiceFactory::GetForProfile(profile); |
970 if (instant_service) | 981 if (instant_service) |
971 instant_service->AddInstantProcess(site_instance->GetProcess()->GetID()); | 982 instant_service->AddInstantProcess(site_instance->GetProcess()->GetID()); |
972 } | 983 } |
973 | 984 |
| 985 #if !defined(OS_CHROMEOS) |
974 // We only expect there to be one signin process as we use process-per-site | 986 // We only expect there to be one signin process as we use process-per-site |
975 // for signin URLs. The signin process will be cleared from SigninManager | 987 // for signin URLs. The signin process will be cleared from SigninManager |
976 // when the renderer is destroyed. | 988 // when the renderer is destroyed. |
977 if (SigninManager::IsWebBasedSigninFlowURL(site_instance->GetSiteURL())) { | 989 if (SigninManager::IsWebBasedSigninFlowURL(site_instance->GetSiteURL())) { |
978 SigninManager* signin_manager = | 990 SigninManager* signin_manager = |
979 SigninManagerFactory::GetForProfile(profile); | 991 SigninManagerFactory::GetForProfile(profile); |
980 if (signin_manager) | 992 if (signin_manager) |
981 signin_manager->SetSigninProcess(site_instance->GetProcess()->GetID()); | 993 signin_manager->SetSigninProcess(site_instance->GetProcess()->GetID()); |
982 } | 994 } |
| 995 #endif |
983 | 996 |
984 ExtensionService* service = | 997 ExtensionService* service = |
985 extensions::ExtensionSystem::Get(profile)->extension_service(); | 998 extensions::ExtensionSystem::Get(profile)->extension_service(); |
986 if (!service) | 999 if (!service) |
987 return; | 1000 return; |
988 | 1001 |
989 const Extension* extension = | 1002 const Extension* extension = |
990 service->extensions()->GetExtensionOrAppByURL(ExtensionURLInfo( | 1003 service->extensions()->GetExtensionOrAppByURL(ExtensionURLInfo( |
991 site_instance->GetSiteURL())); | 1004 site_instance->GetSiteURL())); |
992 if (!extension) | 1005 if (!extension) |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 | 1180 |
1168 if (!prefs->GetBoolean(prefs::kPrintPreviewDisabled)) | 1181 if (!prefs->GetBoolean(prefs::kPrintPreviewDisabled)) |
1169 command_line->AppendSwitch(switches::kRendererPrintPreview); | 1182 command_line->AppendSwitch(switches::kRendererPrintPreview); |
1170 | 1183 |
1171 InstantService* instant_service = | 1184 InstantService* instant_service = |
1172 InstantServiceFactory::GetForProfile(profile); | 1185 InstantServiceFactory::GetForProfile(profile); |
1173 if (instant_service && | 1186 if (instant_service && |
1174 instant_service->IsInstantProcess(process->GetID())) | 1187 instant_service->IsInstantProcess(process->GetID())) |
1175 command_line->AppendSwitch(switches::kInstantProcess); | 1188 command_line->AppendSwitch(switches::kInstantProcess); |
1176 | 1189 |
| 1190 #if !defined(OS_CHROMEOS) |
1177 SigninManager* signin_manager = | 1191 SigninManager* signin_manager = |
1178 SigninManagerFactory::GetForProfile(profile); | 1192 SigninManagerFactory::GetForProfile(profile); |
1179 if (signin_manager && signin_manager->IsSigninProcess(process->GetID())) | 1193 if (signin_manager && signin_manager->IsSigninProcess(process->GetID())) |
1180 command_line->AppendSwitch(switches::kSigninProcess); | 1194 command_line->AppendSwitch(switches::kSigninProcess); |
| 1195 #endif |
1181 } | 1196 } |
1182 | 1197 |
1183 if (content::IsThreadedCompositingEnabled()) | 1198 if (content::IsThreadedCompositingEnabled()) |
1184 command_line->AppendSwitch(switches::kEnableThreadedCompositing); | 1199 command_line->AppendSwitch(switches::kEnableThreadedCompositing); |
1185 | 1200 |
1186 #if defined(ENABLE_MESSAGE_CENTER) | 1201 #if defined(ENABLE_MESSAGE_CENTER) |
1187 if (message_center::IsRichNotificationEnabled()) | 1202 if (message_center::IsRichNotificationEnabled()) |
1188 command_line->AppendSwitch(switches::kDisableHTMLNotifications); | 1203 command_line->AppendSwitch(switches::kDisableHTMLNotifications); |
1189 #endif | 1204 #endif |
1190 | 1205 |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2194 #if defined(USE_NSS) | 2209 #if defined(USE_NSS) |
2195 crypto::CryptoModuleBlockingPasswordDelegate* | 2210 crypto::CryptoModuleBlockingPasswordDelegate* |
2196 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 2211 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
2197 const GURL& url) { | 2212 const GURL& url) { |
2198 return chrome::NewCryptoModuleBlockingDialogDelegate( | 2213 return chrome::NewCryptoModuleBlockingDialogDelegate( |
2199 chrome::kCryptoModulePasswordKeygen, url.host()); | 2214 chrome::kCryptoModulePasswordKeygen, url.host()); |
2200 } | 2215 } |
2201 #endif | 2216 #endif |
2202 | 2217 |
2203 } // namespace chrome | 2218 } // namespace chrome |
OLD | NEW |