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

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

Issue 12374007: signin: force web signin flow initiated visits to accounts.google.com to their own process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use extension-based scheme instead. Created 7 years, 9 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "chrome/browser/prerender/prerender_message_filter.h" 57 #include "chrome/browser/prerender/prerender_message_filter.h"
58 #include "chrome/browser/prerender/prerender_tracker.h" 58 #include "chrome/browser/prerender/prerender_tracker.h"
59 #include "chrome/browser/printing/printing_message_filter.h" 59 #include "chrome/browser/printing/printing_message_filter.h"
60 #include "chrome/browser/profiles/profile.h" 60 #include "chrome/browser/profiles/profile.h"
61 #include "chrome/browser/profiles/profile_io_data.h" 61 #include "chrome/browser/profiles/profile_io_data.h"
62 #include "chrome/browser/profiles/profile_manager.h" 62 #include "chrome/browser/profiles/profile_manager.h"
63 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" 63 #include "chrome/browser/renderer_host/chrome_render_message_filter.h"
64 #include "chrome/browser/renderer_host/chrome_render_view_host_observer.h" 64 #include "chrome/browser/renderer_host/chrome_render_view_host_observer.h"
65 #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory .h" 65 #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory .h"
66 #include "chrome/browser/search_engines/search_provider_install_state_message_fi lter.h" 66 #include "chrome/browser/search_engines/search_provider_install_state_message_fi lter.h"
67 #include "chrome/browser/signin/signin_manager.h"
68 #include "chrome/browser/signin/signin_manager_factory.h"
67 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" 69 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h"
68 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" 70 #include "chrome/browser/spellchecker/spellcheck_message_filter.h"
69 #include "chrome/browser/ssl/ssl_add_certificate.h" 71 #include "chrome/browser/ssl/ssl_add_certificate.h"
70 #include "chrome/browser/ssl/ssl_blocking_page.h" 72 #include "chrome/browser/ssl/ssl_blocking_page.h"
71 #include "chrome/browser/ssl/ssl_tab_helper.h" 73 #include "chrome/browser/ssl/ssl_tab_helper.h"
72 #include "chrome/browser/tab_contents/tab_util.h" 74 #include "chrome/browser/tab_contents/tab_util.h"
73 #include "chrome/browser/toolkit_extra_parts.h" 75 #include "chrome/browser/toolkit_extra_parts.h"
74 #include "chrome/browser/ui/chrome_select_file_policy.h" 76 #include "chrome/browser/ui/chrome_select_file_policy.h"
75 #include "chrome/browser/ui/search/search.h" 77 #include "chrome/browser/ui/search/search.h"
76 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" 78 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h"
77 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" 79 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
80 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
78 #include "chrome/browser/user_style_sheet_watcher.h" 81 #include "chrome/browser/user_style_sheet_watcher.h"
79 #include "chrome/browser/user_style_sheet_watcher_factory.h" 82 #include "chrome/browser/user_style_sheet_watcher_factory.h"
80 #include "chrome/browser/view_type_utils.h" 83 #include "chrome/browser/view_type_utils.h"
81 #include "chrome/common/child_process_logging.h" 84 #include "chrome/common/child_process_logging.h"
82 #include "chrome/common/chrome_constants.h" 85 #include "chrome/common/chrome_constants.h"
83 #include "chrome/common/chrome_paths.h" 86 #include "chrome/common/chrome_paths.h"
84 #include "chrome/common/chrome_switches.h" 87 #include "chrome/common/chrome_switches.h"
85 #include "chrome/common/extensions/extension.h" 88 #include "chrome/common/extensions/extension.h"
86 #include "chrome/common/extensions/extension_process_policy.h" 89 #include "chrome/common/extensions/extension_process_policy.h"
87 #include "chrome/common/extensions/extension_set.h" 90 #include "chrome/common/extensions/extension_set.h"
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 content::BrowserContext* browser_context, const GURL& url) { 691 content::BrowserContext* browser_context, const GURL& url) {
689 Profile* profile = Profile::FromBrowserContext(browser_context); 692 Profile* profile = Profile::FromBrowserContext(browser_context);
690 if (!profile) 693 if (!profile)
691 return url; 694 return url;
692 695
693 // If the input |url| should be assigned to the Instant renderer, make its 696 // If the input |url| should be assigned to the Instant renderer, make its
694 // effective URL distinct from other URLs on the search provider's domain. 697 // effective URL distinct from other URLs on the search provider's domain.
695 if (chrome::search::ShouldAssignURLToInstantRenderer(url, profile)) 698 if (chrome::search::ShouldAssignURLToInstantRenderer(url, profile))
696 return GetEffectiveURLForInstant(url, profile); 699 return GetEffectiveURLForInstant(url, profile);
697 700
701 // If the input |url| should be assigned to the Signin renderer, make its
702 // effective URL distinct from other URLs on the signin service's domain.
703 // Note that the signin renderer will be allowed to sign the user in to
704 // Chrome.
705 if (SyncPromoUI::IsWebBasedSigninFlowURL(url))
706 return GURL(SyncPromoUI::kChromeSigninEffectiveURL);
Charlie Reis 2013/03/06 00:14:54 This seems like it would cause problems, since you
tim (not reviewing) 2013/03/06 01:04:08 The happy case worked as is, although it does seem
707
698 // If the input |url| is part of an installed app, the effective URL is an 708 // If the input |url| is part of an installed app, the effective URL is an
699 // extension URL with the ID of that extension as the host. This has the 709 // extension URL with the ID of that extension as the host. This has the
700 // effect of grouping apps together in a common SiteInstance. 710 // effect of grouping apps together in a common SiteInstance.
701 ExtensionService* extension_service = 711 ExtensionService* extension_service =
702 extensions::ExtensionSystem::Get(profile)->extension_service(); 712 extensions::ExtensionSystem::Get(profile)->extension_service();
703 if (!extension_service) 713 if (!extension_service)
704 return url; 714 return url;
705 715
706 const Extension* extension = extension_service->extensions()-> 716 const Extension* extension = extension_service->extensions()->
707 GetHostedAppByURL(ExtensionURLInfo(url)); 717 GetHostedAppByURL(ExtensionURLInfo(url));
(...skipping 17 matching lines...) Expand all
725 // URLs for hosted apps (apart from bookmark apps) should have an extension 735 // URLs for hosted apps (apart from bookmark apps) should have an extension
726 // scheme by now. 736 // scheme by now.
727 737
728 Profile* profile = Profile::FromBrowserContext(browser_context); 738 Profile* profile = Profile::FromBrowserContext(browser_context);
729 if (!profile) 739 if (!profile)
730 return false; 740 return false;
731 741
732 if (chrome::search::ShouldAssignURLToInstantRenderer(effective_url, profile)) 742 if (chrome::search::ShouldAssignURLToInstantRenderer(effective_url, profile))
733 return true; 743 return true;
734 744
745 if (SyncPromoUI::IsWebBasedSigninFlowURL(effective_url))
746 return true;
747
735 if (!effective_url.SchemeIs(extensions::kExtensionScheme)) 748 if (!effective_url.SchemeIs(extensions::kExtensionScheme))
736 return false; 749 return false;
737 750
738 ExtensionService* extension_service = 751 ExtensionService* extension_service =
739 extensions::ExtensionSystem::Get(profile)->extension_service(); 752 extensions::ExtensionSystem::Get(profile)->extension_service();
740 if (!extension_service) 753 if (!extension_service)
741 return false; 754 return false;
742 755
743 const Extension* extension = extension_service->extensions()-> 756 const Extension* extension = extension_service->extensions()->
744 GetExtensionOrAppByURL(ExtensionURLInfo(effective_url)); 757 GetExtensionOrAppByURL(ExtensionURLInfo(effective_url));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 // share any host. 835 // share any host.
823 if (!profile) 836 if (!profile)
824 return true; 837 return true;
825 838
826 InstantService* instant_service = 839 InstantService* instant_service =
827 InstantServiceFactory::GetForProfile(profile); 840 InstantServiceFactory::GetForProfile(profile);
828 if (instant_service && 841 if (instant_service &&
829 instant_service->IsInstantProcess(process_host->GetID())) 842 instant_service->IsInstantProcess(process_host->GetID()))
830 return chrome::search::ShouldAssignURLToInstantRenderer(site_url, profile); 843 return chrome::search::ShouldAssignURLToInstantRenderer(site_url, profile);
831 844
845 SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile);
846 if (signin_manager && signin_manager->IsSigninProcess(process_host->GetID()))
847 return SyncPromoUI::IsWebBasedSigninFlowURL(site_url);
848
832 ExtensionService* service = 849 ExtensionService* service =
833 extensions::ExtensionSystem::Get(profile)->extension_service(); 850 extensions::ExtensionSystem::Get(profile)->extension_service();
834 extensions::ProcessMap* process_map = service->process_map(); 851 extensions::ProcessMap* process_map = service->process_map();
835 852
836 // Don't allow the Task Manager to share a process with anything else. 853 // Don't allow the Task Manager to share a process with anything else.
837 // Otherwise it can affect the renderers it is observing. 854 // Otherwise it can affect the renderers it is observing.
838 // Note: we could create another RenderProcessHostPrivilege bucket for 855 // Note: we could create another RenderProcessHostPrivilege bucket for
839 // this to allow multiple chrome://tasks instances to share, but that's 856 // this to allow multiple chrome://tasks instances to share, but that's
840 // a very unlikely case without serious consequences. 857 // a very unlikely case without serious consequences.
841 if (site_url.GetOrigin() == GURL(chrome::kChromeUITaskManagerURL).GetOrigin()) 858 if (site_url.GetOrigin() == GURL(chrome::kChromeUITaskManagerURL).GetOrigin())
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 // Remember the ID of the Instant process to signal the renderer process 935 // Remember the ID of the Instant process to signal the renderer process
919 // on startup in |AppendExtraCommandLineSwitches| below. 936 // on startup in |AppendExtraCommandLineSwitches| below.
920 if (chrome::search::ShouldAssignURLToInstantRenderer( 937 if (chrome::search::ShouldAssignURLToInstantRenderer(
921 site_instance->GetSiteURL(), profile)) { 938 site_instance->GetSiteURL(), profile)) {
922 InstantService* instant_service = 939 InstantService* instant_service =
923 InstantServiceFactory::GetForProfile(profile); 940 InstantServiceFactory::GetForProfile(profile);
924 if (instant_service) 941 if (instant_service)
925 instant_service->AddInstantProcess(site_instance->GetProcess()->GetID()); 942 instant_service->AddInstantProcess(site_instance->GetProcess()->GetID());
926 } 943 }
927 944
945 // We only expect there to be one signin process as we use process-per-site
946 // for signin URLs. The signin process will be cleared from SigninManager
947 // when the renderer is destroyed.
948 if (SyncPromoUI::IsWebBasedSigninFlowURL(site_instance->GetSiteURL())) {
949 SigninManager* signin_manager =
950 SigninManagerFactory::GetForProfile(profile);
951 if (signin_manager)
952 signin_manager->SetSigninProcess(site_instance->GetProcess()->GetID());
953 }
954
928 ExtensionService* service = 955 ExtensionService* service =
929 extensions::ExtensionSystem::Get(profile)->extension_service(); 956 extensions::ExtensionSystem::Get(profile)->extension_service();
930 if (!service) 957 if (!service)
931 return; 958 return;
932 959
933 const Extension* extension = 960 const Extension* extension =
934 service->extensions()->GetExtensionOrAppByURL(ExtensionURLInfo( 961 service->extensions()->GetExtensionOrAppByURL(ExtensionURLInfo(
935 site_instance->GetSiteURL())); 962 site_instance->GetSiteURL()));
936 if (!extension) 963 if (!extension)
937 return; 964 return;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 } 1131 }
1105 1132
1106 if (!prefs->GetBoolean(prefs::kPrintPreviewDisabled)) 1133 if (!prefs->GetBoolean(prefs::kPrintPreviewDisabled))
1107 command_line->AppendSwitch(switches::kRendererPrintPreview); 1134 command_line->AppendSwitch(switches::kRendererPrintPreview);
1108 1135
1109 InstantService* instant_service = 1136 InstantService* instant_service =
1110 InstantServiceFactory::GetForProfile(profile); 1137 InstantServiceFactory::GetForProfile(profile);
1111 if (instant_service && 1138 if (instant_service &&
1112 instant_service->IsInstantProcess(process->GetID())) 1139 instant_service->IsInstantProcess(process->GetID()))
1113 command_line->AppendSwitch(switches::kInstantProcess); 1140 command_line->AppendSwitch(switches::kInstantProcess);
1141
1142 SigninManager* signin_manager =
1143 SigninManagerFactory::GetForProfile(profile);
1144 if (signin_manager && signin_manager->IsSigninProcess(process->GetID()))
1145 command_line->AppendSwitch(switches::kSigninProcess);
1114 } 1146 }
1115 1147
1116 if (content::IsThreadedCompositingEnabled()) 1148 if (content::IsThreadedCompositingEnabled())
1117 command_line->AppendSwitch(switches::kEnableThreadedCompositing); 1149 command_line->AppendSwitch(switches::kEnableThreadedCompositing);
1118 1150
1119 // Please keep this in alphabetical order. 1151 // Please keep this in alphabetical order.
1120 static const char* const kSwitchNames[] = { 1152 static const char* const kSwitchNames[] = {
1121 switches::kAllowHTTPBackgroundPage, 1153 switches::kAllowHTTPBackgroundPage,
1122 switches::kAllowLegacyExtensionManifests, 1154 switches::kAllowLegacyExtensionManifests,
1123 switches::kAllowScriptingGallery, 1155 switches::kAllowScriptingGallery,
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
2095 io_thread_application_locale_ = locale; 2127 io_thread_application_locale_ = locale;
2096 } 2128 }
2097 2129
2098 void ChromeContentBrowserClient::SetApplicationLocaleOnIOThread( 2130 void ChromeContentBrowserClient::SetApplicationLocaleOnIOThread(
2099 const std::string& locale) { 2131 const std::string& locale) {
2100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 2132 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
2101 io_thread_application_locale_ = locale; 2133 io_thread_application_locale_ = locale;
2102 } 2134 }
2103 2135
2104 } // namespace chrome 2136 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/signin/signin_browsertest.cc » ('j') | chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698