Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 12502017: signin: pull basic SigninManager functionality into new SigninManagerBase class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: megarebase Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
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
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
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 InstantServiceFactory::GetForProfile(profile); 875 InstantServiceFactory::GetForProfile(profile);
867 if (instant_service) { 876 if (instant_service) {
868 bool is_instant_process = instant_service->IsInstantProcess( 877 bool is_instant_process = instant_service->IsInstantProcess(
869 process_host->GetID()); 878 process_host->GetID());
870 bool should_be_in_instant_process = 879 bool should_be_in_instant_process =
871 chrome::ShouldAssignURLToInstantRenderer(site_url, profile); 880 chrome::ShouldAssignURLToInstantRenderer(site_url, profile);
872 if (is_instant_process || should_be_in_instant_process) 881 if (is_instant_process || should_be_in_instant_process)
873 return is_instant_process && should_be_in_instant_process; 882 return is_instant_process && should_be_in_instant_process;
874 } 883 }
875 884
885 #if !defined(OS_CHROMEOS)
876 SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile); 886 SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile);
877 if (signin_manager && signin_manager->IsSigninProcess(process_host->GetID())) 887 if (signin_manager && signin_manager->IsSigninProcess(process_host->GetID()))
878 return SigninManager::IsWebBasedSigninFlowURL(site_url); 888 return SigninManager::IsWebBasedSigninFlowURL(site_url);
889 #endif
879 890
880 ExtensionService* service = 891 ExtensionService* service =
881 extensions::ExtensionSystem::Get(profile)->extension_service(); 892 extensions::ExtensionSystem::Get(profile)->extension_service();
882 extensions::ProcessMap* process_map = service->process_map(); 893 extensions::ProcessMap* process_map = service->process_map();
883 894
884 // Don't allow the Task Manager to share a process with anything else. 895 // Don't allow the Task Manager to share a process with anything else.
885 // Otherwise it can affect the renderers it is observing. 896 // Otherwise it can affect the renderers it is observing.
886 // Note: we could create another RenderProcessHostPrivilege bucket for 897 // Note: we could create another RenderProcessHostPrivilege bucket for
887 // this to allow multiple chrome://tasks instances to share, but that's 898 // this to allow multiple chrome://tasks instances to share, but that's
888 // a very unlikely case without serious consequences. 899 // a very unlikely case without serious consequences.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 // Remember the ID of the Instant process to signal the renderer process 977 // Remember the ID of the Instant process to signal the renderer process
967 // on startup in |AppendExtraCommandLineSwitches| below. 978 // on startup in |AppendExtraCommandLineSwitches| below.
968 if (chrome::ShouldAssignURLToInstantRenderer( 979 if (chrome::ShouldAssignURLToInstantRenderer(
969 site_instance->GetSiteURL(), profile)) { 980 site_instance->GetSiteURL(), profile)) {
970 InstantService* instant_service = 981 InstantService* instant_service =
971 InstantServiceFactory::GetForProfile(profile); 982 InstantServiceFactory::GetForProfile(profile);
972 if (instant_service) 983 if (instant_service)
973 instant_service->AddInstantProcess(site_instance->GetProcess()->GetID()); 984 instant_service->AddInstantProcess(site_instance->GetProcess()->GetID());
974 } 985 }
975 986
987 #if !defined(OS_CHROMEOS)
976 // We only expect there to be one signin process as we use process-per-site 988 // We only expect there to be one signin process as we use process-per-site
977 // for signin URLs. The signin process will be cleared from SigninManager 989 // for signin URLs. The signin process will be cleared from SigninManager
978 // when the renderer is destroyed. 990 // when the renderer is destroyed.
979 if (SigninManager::IsWebBasedSigninFlowURL(site_instance->GetSiteURL())) { 991 if (SigninManager::IsWebBasedSigninFlowURL(site_instance->GetSiteURL())) {
980 SigninManager* signin_manager = 992 SigninManager* signin_manager =
981 SigninManagerFactory::GetForProfile(profile); 993 SigninManagerFactory::GetForProfile(profile);
982 if (signin_manager) 994 if (signin_manager)
983 signin_manager->SetSigninProcess(site_instance->GetProcess()->GetID()); 995 signin_manager->SetSigninProcess(site_instance->GetProcess()->GetID());
984 } 996 }
997 #endif
985 998
986 ExtensionService* service = 999 ExtensionService* service =
987 extensions::ExtensionSystem::Get(profile)->extension_service(); 1000 extensions::ExtensionSystem::Get(profile)->extension_service();
988 if (!service) 1001 if (!service)
989 return; 1002 return;
990 1003
991 const Extension* extension = 1004 const Extension* extension =
992 service->extensions()->GetExtensionOrAppByURL(ExtensionURLInfo( 1005 service->extensions()->GetExtensionOrAppByURL(ExtensionURLInfo(
993 site_instance->GetSiteURL())); 1006 site_instance->GetSiteURL()));
994 if (!extension) 1007 if (!extension)
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 1182
1170 if (!prefs->GetBoolean(prefs::kPrintPreviewDisabled)) 1183 if (!prefs->GetBoolean(prefs::kPrintPreviewDisabled))
1171 command_line->AppendSwitch(switches::kRendererPrintPreview); 1184 command_line->AppendSwitch(switches::kRendererPrintPreview);
1172 1185
1173 InstantService* instant_service = 1186 InstantService* instant_service =
1174 InstantServiceFactory::GetForProfile(profile); 1187 InstantServiceFactory::GetForProfile(profile);
1175 if (instant_service && 1188 if (instant_service &&
1176 instant_service->IsInstantProcess(process->GetID())) 1189 instant_service->IsInstantProcess(process->GetID()))
1177 command_line->AppendSwitch(switches::kInstantProcess); 1190 command_line->AppendSwitch(switches::kInstantProcess);
1178 1191
1192 #if !defined(OS_CHROMEOS)
1179 SigninManager* signin_manager = 1193 SigninManager* signin_manager =
1180 SigninManagerFactory::GetForProfile(profile); 1194 SigninManagerFactory::GetForProfile(profile);
1181 if (signin_manager && signin_manager->IsSigninProcess(process->GetID())) 1195 if (signin_manager && signin_manager->IsSigninProcess(process->GetID()))
1182 command_line->AppendSwitch(switches::kSigninProcess); 1196 command_line->AppendSwitch(switches::kSigninProcess);
1197 #endif
1183 } 1198 }
1184 1199
1185 if (content::IsThreadedCompositingEnabled()) 1200 if (content::IsThreadedCompositingEnabled())
1186 command_line->AppendSwitch(switches::kEnableThreadedCompositing); 1201 command_line->AppendSwitch(switches::kEnableThreadedCompositing);
1187 1202
1188 #if defined(ENABLE_MESSAGE_CENTER) 1203 #if defined(ENABLE_MESSAGE_CENTER)
1189 if (message_center::IsRichNotificationEnabled()) 1204 if (message_center::IsRichNotificationEnabled())
1190 command_line->AppendSwitch(switches::kDisableHTMLNotifications); 1205 command_line->AppendSwitch(switches::kDisableHTMLNotifications);
1191 #endif 1206 #endif
1192 1207
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
2196 #if defined(USE_NSS) 2211 #if defined(USE_NSS)
2197 crypto::CryptoModuleBlockingPasswordDelegate* 2212 crypto::CryptoModuleBlockingPasswordDelegate*
2198 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 2213 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
2199 const GURL& url) { 2214 const GURL& url) {
2200 return chrome::NewCryptoModuleBlockingDialogDelegate( 2215 return chrome::NewCryptoModuleBlockingDialogDelegate(
2201 chrome::kCryptoModulePasswordKeygen, url.host()); 2216 chrome::kCryptoModulePasswordKeygen, url.host());
2202 } 2217 }
2203 #endif 2218 #endif
2204 2219
2205 } // namespace chrome 2220 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/login_utils.cc » ('j') | chrome/browser/signin/signin_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698