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

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: comment Created 7 years, 10 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_manager.h » ('j') | chrome/browser/signin/signin_manager.cc » ('J')
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 afcf8c1c7a1196326c5db736242f2d0bf6935a17..5cc8003187e2e8dbec479ca760412c871c4908f9 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -64,6 +64,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"
@@ -75,6 +77,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"
@@ -438,6 +441,21 @@ GURL GetEffectiveURLForInstant(const GURL& url, Profile* profile) {
return effective_url;
}
+GURL GetEffectiveURLForSignin(const GURL& url) {
+ CHECK(SyncPromoUI::IsWebBasedSigninFlowURL(url));
+ if (url.SchemeIs(chrome::kChromeSigninScheme))
+ return url;
+
+ GURL effective_url(url);
+ // Replace the scheme with "chrome-signin:".
+ url_canon::Replacements<char> replacements;
+ std::string signin_scheme(chrome::kChromeSigninScheme);
+ replacements.SetScheme(signin_scheme.data(),
+ url_parse::Component(0, signin_scheme.length()));
+ effective_url = effective_url.ReplaceComponents(replacements);
+ return effective_url;
+}
+
} // namespace
namespace chrome {
@@ -695,6 +713,9 @@ GURL ChromeContentBrowserClient::GetEffectiveURL(
if (chrome::search::ShouldAssignURLToInstantRenderer(url, profile))
return GetEffectiveURLForInstant(url, profile);
+ if (SyncPromoUI::IsWebBasedSigninFlowURL(url))
Charlie Reis 2013/02/28 19:19:46 Please add a comment similar to the one for Instan
tim (not reviewing) 2013/03/01 01:53:57 Done.
+ 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.
@@ -732,6 +753,9 @@ bool ChromeContentBrowserClient::ShouldUseProcessPerSite(
if (chrome::search::ShouldAssignURLToInstantRenderer(effective_url, profile))
return true;
+ if (SyncPromoUI::IsWebBasedSigninFlowURL(effective_url))
+ return true;
+
if (!effective_url.SchemeIs(extensions::kExtensionScheme))
return false;
@@ -829,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 SyncPromoUI::IsWebBasedSigninFlowURL(site_url);
+
ExtensionService* service =
extensions::ExtensionSystem::Get(profile)->extension_service();
extensions::ProcessMap* process_map = service->process_map();
@@ -925,6 +953,13 @@ void ChromeContentBrowserClient::SiteInstanceGotProcess(
instant_service->AddInstantProcess(site_instance->GetProcess()->GetID());
}
+ if (SyncPromoUI::IsWebBasedSigninFlowURL(site_instance->GetSiteURL())) {
Charlie Reis 2013/02/28 19:19:46 Can you add a comment here saying that we only exp
tim (not reviewing) 2013/03/01 01:53:57 Done.
+ 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)
« no previous file with comments | « no previous file | chrome/browser/signin/signin_manager.h » ('j') | chrome/browser/signin/signin_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698