diff options
author | rogerta <rogerta@chromium.org> | 2015-09-28 14:18:31 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-28 21:21:05 +0000 |
commit | 0a4d440d08d7c58b3bfda53810f659083ad72edc (patch) | |
tree | db5d055a896fc2002265527d10766b3e9a8c3abb | |
parent | 5e788688d577c0c8c287f42275c0a4f5df291874 (diff) | |
download | chromium_src-0a4d440d08d7c58b3bfda53810f659083ad72edc.zip chromium_src-0a4d440d08d7c58b3bfda53810f659083ad72edc.tar.gz chromium_src-0a4d440d08d7c58b3bfda53810f659083ad72edc.tar.bz2 |
Make sure links in the profile unlock reauth don't break out of popup.
BUG=528847
Review URL: https://codereview.chromium.org/1365813003
Cr-Commit-Position: refs/heads/master@{#351159}
-rw-r--r-- | chrome/browser/resources/gaia_auth_host/authenticator.js | 8 | ||||
-rw-r--r-- | chrome/browser/ui/webui/signin/inline_login_handler_impl.cc | 13 |
2 files changed, 19 insertions, 2 deletions
diff --git a/chrome/browser/resources/gaia_auth_host/authenticator.js b/chrome/browser/resources/gaia_auth_host/authenticator.js index 43739f5..6462740 100644 --- a/chrome/browser/resources/gaia_auth_host/authenticator.js +++ b/chrome/browser/resources/gaia_auth_host/authenticator.js @@ -208,6 +208,7 @@ cr.define('cr.login', function() { this.gapsCookie_ = data.gapsCookie; this.gapsCookieSent_ = false; this.newGapsCookie_ = null; + this.dontResizeNonEmbeddedPages = data.dontResizeNonEmbeddedPages; this.initialFrameUrl_ = this.constructInitialFrameUrl_(data); this.reloadUrl_ = data.frameUrl || this.initialFrameUrl_; @@ -315,7 +316,12 @@ cr.define('cr.login', function() { } } } - if (!isEmbeddedPage) { + + // In some cases, non-embedded pages should not be resized. For + // example, on desktop when reauthenticating for purposes of unlocking + // a profile, resizing would cause a browser window to open in the + // system profile, which is not allowed. + if (!isEmbeddedPage && !this.dontResizeNonEmbeddedPages) { this.dispatchEvent(new CustomEvent('resize', {detail: currentUrl})); return; } diff --git a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc index 7d53c8d..5a7b0bb 100644 --- a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc +++ b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc @@ -69,6 +69,11 @@ void LogHistogramValue(int action) { signin_metrics::HISTOGRAM_MAX); } +// Returns true if |profile| is a system profile or created from one. +bool IsSystemProfile(Profile* profile) { + return profile->GetOriginalProfile()->IsSystemProfile(); +} + void RedirectToNtpOrAppsPage(content::WebContents* contents, signin_metrics::Source source) { // Do nothing if a navigation is pending, since this call can be triggered @@ -599,6 +604,12 @@ bool InlineLoginHandlerImpl::CanOffer(Profile* profile, void InlineLoginHandlerImpl::SetExtraInitParams(base::DictionaryValue& params) { params.SetString("service", "chromiumsync"); + // If this was called from the user manager to reauthenticate the profile, + // make sure the webui is aware. + Profile* profile = Profile::FromWebUI(web_ui()); + if (IsSystemProfile(profile)) + params.SetBoolean("dontResizeNonEmbeddedPages", true); + content::WebContents* contents = web_ui()->GetWebContents(); content::WebContentsObserver::Observe(contents); LogHistogramValue(signin_metrics::HISTOGRAM_SHOWN); @@ -655,7 +666,7 @@ void InlineLoginHandlerImpl::CompleteLogin(const base::ListValue* args) { // find the right profile to reauthenticate. Otherwise the profile can be // taken from web_ui(). Profile* profile = Profile::FromWebUI(web_ui()); - if (profile->GetOriginalProfile()->IsSystemProfile()) { + if (IsSystemProfile(profile)) { // Switch to the profile and finish the login. Don't pass a handler pointer // since it will be destroyed before the callback runs. ProfileManager* manager = g_browser_process->profile_manager(); |