summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoger Tawa <rogerta@google.com>2015-09-30 16:48:52 -0400
committerRoger Tawa <rogerta@google.com>2015-09-30 20:50:00 +0000
commit5ae356a46d02b01ccd85437c1b2c0f94f70a60fc (patch)
treef1d3f1798269b7b89565f6c336e181a6c178d22f
parent2c430426d09b0010898bebe5a5f784d328c42dd5 (diff)
downloadchromium_src-5ae356a46d02b01ccd85437c1b2c0f94f70a60fc.zip
chromium_src-5ae356a46d02b01ccd85437c1b2c0f94f70a60fc.tar.gz
chromium_src-5ae356a46d02b01ccd85437c1b2c0f94f70a60fc.tar.bz2
[Merge M46] Make sure links in the profile unlock reauth don't break out of popup.
BUG=528847 TBR=achuith@chromium.org Review URL: https://codereview.chromium.org/1365813003 Cr-Commit-Position: refs/heads/master@{#351159} (cherry picked from commit 0a4d440d08d7c58b3bfda53810f659083ad72edc) Review URL: https://codereview.chromium.org/1376323002 . Cr-Commit-Position: refs/branch-heads/2490@{#448} Cr-Branched-From: 7790a3535f2a81a03685eca31a32cf69ae0c114f-refs/heads/master@{#344925}
-rw-r--r--chrome/browser/resources/gaia_auth_host/authenticator.js8
-rw-r--r--chrome/browser/ui/webui/signin/inline_login_handler_impl.cc13
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 99a0728..4f65b4c 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 83ee8f9..1b3308c 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
@@ -598,6 +603,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();
const GURL& current_url = contents->GetURL();
std::string is_constrained;
@@ -658,7 +669,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();