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

Unified 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: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/signin/signin_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 1a47b406d80c72c66491c8ae0043b31e5ffb4396..d7bca4e28036dc234e1f0294bc5163c5b7ea8927 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -63,6 +63,8 @@
#include "chrome/browser/renderer_host/chrome_render_view_host_observer.h"
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
#include "chrome/browser/search_engines/search_provider_install_state_message_filter.h"
+#include "chrome/browser/signin/signin_manager.h"
+#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h"
#include "chrome/browser/spellchecker/spellcheck_message_filter.h"
#include "chrome/browser/ssl/ssl_add_certificate.h"
@@ -74,6 +76,7 @@
#include "chrome/browser/ui/search/search.h"
#include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h"
#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
+#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
#include "chrome/browser/user_style_sheet_watcher.h"
#include "chrome/browser/user_style_sheet_watcher_factory.h"
#include "chrome/browser/view_type_utils.h"
@@ -439,6 +442,16 @@ GURL GetEffectiveURLForInstant(const GURL& url, Profile* profile) {
return effective_url;
}
+GURL GetEffectiveURLForSignin(const GURL& url) {
+ CHECK(SigninManager::IsWebBasedSigninFlowURL(url));
+
+ GURL effective_url(SigninManager::kChromeSigninEffectiveSite);
+ GURL::Replacements replacements;
+ replacements.SetPathStr(url.path());
+ effective_url = effective_url.ReplaceComponents(replacements);
+ return effective_url;
+}
+
} // namespace
namespace chrome {
@@ -696,6 +709,13 @@ GURL ChromeContentBrowserClient::GetEffectiveURL(
if (chrome::search::ShouldAssignURLToInstantRenderer(url, profile))
return GetEffectiveURLForInstant(url, profile);
+ // If the input |url| should be assigned to the Signin renderer, make its
+ // effective URL distinct from other URLs on the signin service's domain.
+ // Note that the signin renderer will be allowed to sign the user in to
+ // Chrome.
+ if (SigninManager::IsWebBasedSigninFlowURL(url))
+ return GetEffectiveURLForSignin(url);
+
// If the input |url| is part of an installed app, the effective URL is an
// extension URL with the ID of that extension as the host. This has the
// effect of grouping apps together in a common SiteInstance.
@@ -733,6 +753,9 @@ bool ChromeContentBrowserClient::ShouldUseProcessPerSite(
if (chrome::search::ShouldAssignURLToInstantRenderer(effective_url, profile))
return true;
+ if (SigninManager::IsWebBasedSigninFlowURL(effective_url))
+ return true;
+
if (!effective_url.SchemeIs(extensions::kExtensionScheme))
return false;
@@ -830,6 +853,10 @@ bool ChromeContentBrowserClient::IsSuitableHost(
instant_service->IsInstantProcess(process_host->GetID()))
return chrome::search::ShouldAssignURLToInstantRenderer(site_url, profile);
+ SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile);
+ if (signin_manager && signin_manager->IsSigninProcess(process_host->GetID()))
+ return SigninManager::IsWebBasedSigninFlowURL(site_url);
+
ExtensionService* service =
extensions::ExtensionSystem::Get(profile)->extension_service();
extensions::ProcessMap* process_map = service->process_map();
@@ -926,6 +953,16 @@ void ChromeContentBrowserClient::SiteInstanceGotProcess(
instant_service->AddInstantProcess(site_instance->GetProcess()->GetID());
}
+ // We only expect there to be one signin process as we use process-per-site
+ // for signin URLs. The signin process will be cleared from SigninManager
+ // when the renderer is destroyed.
+ if (SigninManager::IsWebBasedSigninFlowURL(site_instance->GetSiteURL())) {
+ SigninManager* signin_manager =
+ SigninManagerFactory::GetForProfile(profile);
+ if (signin_manager)
+ signin_manager->SetSigninProcess(site_instance->GetProcess()->GetID());
+ }
+
ExtensionService* service =
extensions::ExtensionSystem::Get(profile)->extension_service();
if (!service)
@@ -1112,6 +1149,11 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
if (instant_service &&
instant_service->IsInstantProcess(process->GetID()))
command_line->AppendSwitch(switches::kInstantProcess);
+
+ SigninManager* signin_manager =
+ SigninManagerFactory::GetForProfile(profile);
+ if (signin_manager && signin_manager->IsSigninProcess(process->GetID()))
+ command_line->AppendSwitch(switches::kSigninProcess);
}
if (content::IsThreadedCompositingEnabled())
« no previous file with comments | « no previous file | chrome/browser/signin/signin_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698