summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/resources/options/options_page.js26
-rw-r--r--chrome/browser/resources/options/sync_setup_overlay.css1
-rw-r--r--chrome/browser/resources/options/sync_setup_overlay.html6
-rw-r--r--chrome/browser/resources/options/sync_setup_overlay.js33
4 files changed, 52 insertions, 14 deletions
diff --git a/chrome/browser/resources/options/options_page.js b/chrome/browser/resources/options/options_page.js
index 4d431fa..e0ea76f 100644
--- a/chrome/browser/resources/options/options_page.js
+++ b/chrome/browser/resources/options/options_page.js
@@ -220,6 +220,15 @@ cr.define('options', function() {
};
/**
+ * @return {boolean} True if the visible overlay should be closed.
+ * @private
+ */
+ OptionsPage.shouldCloseOverlay_ = function() {
+ var overlay = this.getVisibleOverlay_();
+ return overlay && overlay.shouldClose();
+ };
+
+ /**
* Returns the currently visible overlay, or null if no page is visible.
* @return {OptionPage} The visible overlay.
*/
@@ -711,10 +720,12 @@ cr.define('options', function() {
OptionsPage.keyDownEventHandler_ = function(event) {
// Close the top overlay or sub-page on esc.
if (event.keyCode == 27) { // Esc
- if (this.isOverlayVisible_())
- this.closeOverlay();
- else
+ if (this.isOverlayVisible_()) {
+ if (this.shouldCloseOverlay_())
+ this.closeOverlay();
+ } else {
this.closeTopSubPage_();
+ }
}
};
@@ -967,6 +978,15 @@ cr.define('options', function() {
canShowPage: function() {
return true;
},
+
+ /**
+ * Whether an overlay should be closed. Used by overlay implementation to
+ * handle special closing behaviors.
+ * @return {boolean} True if the overlay should be closed.
+ */
+ shouldClose: function() {
+ return true;
+ },
};
// Export
diff --git a/chrome/browser/resources/options/sync_setup_overlay.css b/chrome/browser/resources/options/sync_setup_overlay.css
index 03f0702..a4e444e 100644
--- a/chrome/browser/resources/options/sync_setup_overlay.css
+++ b/chrome/browser/resources/options/sync_setup_overlay.css
@@ -132,7 +132,6 @@
.overlay-warning {
position: absolute;
- display: none;
left: 25px;
right: 25px;
top: 100px;
diff --git a/chrome/browser/resources/options/sync_setup_overlay.html b/chrome/browser/resources/options/sync_setup_overlay.html
index 17bb08a..4c7fe56 100644
--- a/chrome/browser/resources/options/sync_setup_overlay.html
+++ b/chrome/browser/resources/options/sync_setup_overlay.html
@@ -328,7 +328,7 @@
<span>.</span>
</div>
<div class="sync-custom-passphrase-input">
- <input id="passphrase" type="password"
+ <input id="custom-passphrase" type="password"
i18n-values="placeholder:passphraseLabel">
</div>
<div class="sync-custom-passphrase-input">
@@ -378,12 +378,12 @@
<span id="sync-passphrase-warning" i18n-content="passphraseRecover">
</span> <a href="http://google.com/dashboard" target="_blank"
i18n-content="cleardatalink"></a>
- <div class="overlay-warning" id="cancel-warning-box">
+ <div class="overlay-warning" id="cancel-warning-box" hidden>
<div id="cancel-warning-header" i18n-content="cancelWarningHeader">
</div>
<div id="cancel-warning" i18n-content="cancelWarning"></div>
- <input id="cancel-no-button" type="submit" i18n-values="value:no">
<input id="cancel-yes-button" type="submit" i18n-values="value:yes">
+ <input id="cancel-no-button" type="submit" i18n-values="value:no">
</div>
</form>
</div>
diff --git a/chrome/browser/resources/options/sync_setup_overlay.js b/chrome/browser/resources/options/sync_setup_overlay.js
index 0d81038..b8af2e4 100644
--- a/chrome/browser/resources/options/sync_setup_overlay.js
+++ b/chrome/browser/resources/options/sync_setup_overlay.js
@@ -111,9 +111,10 @@ cr.define('options', function() {
},
showCancelWarning_: function() {
- $('cancel-warning-box').style.display = "block";
+ $('cancel-warning-box').hidden = false;
$('passphrase-ok').disabled = true;
$('passphrase-cancel').disabled = true;
+ $('cancel-no-button').focus();
},
sendPassphraseAndClose_: function() {
@@ -205,14 +206,14 @@ cr.define('options', function() {
if (this.getRadioCheckedValue_() != "explicit" || f.option[0].disabled)
return true;
- if (f.passphrase.value.length == 0) {
+ var customPassphrase = $('customPassphrase');
+ if (customPassphrase.value.length == 0) {
emptyError.style.display = "block";
return false;
}
var confirmPassphrase = $('confirm-passphrase');
- var passphrase = $('passphrase');
- if (confirmPassphrase.value != passphrase.value) {
+ if (confirmPassphrase.value != customPassphrase.value) {
mismatchError.style.display = "block";
return false;
}
@@ -221,7 +222,7 @@ cr.define('options', function() {
},
hideCancelWarning_: function() {
- $('cancel-warning-box').style.display = "none";
+ $('cancel-warning-box').hidden = true;
$('passphrase-ok').disabled = false;
$('passphrase-cancel').disabled = false;
},
@@ -242,6 +243,7 @@ cr.define('options', function() {
var syncAll =
document.getElementById('sync-select-datatypes').selectedIndex == 0;
+ var customPassphrase = $('custom-passphrase');
// These values need to be kept in sync with where they are read in
// SyncSetupFlow::GetDataTypeChoiceData().
@@ -257,7 +259,7 @@ cr.define('options', function() {
"syncApps": syncAll || f.appsCheckbox.checked,
"syncSessions": syncAll || f.sessionsCheckbox.checked,
"usePassphrase": (this.getRadioCheckedValue_() == 'explicit'),
- "passphrase": f.passphrase.value
+ "passphrase": customPassphrase.value
});
chrome.send("Configure", [result]);
},
@@ -370,6 +372,8 @@ cr.define('options', function() {
if (syncEverything == false || syncAllDataTypes == false ||
this.usePassphrase_) {
this.showCustomizePage_(syncAllDataTypes);
+ } else {
+ this.showSyncEverythingPage_();
}
}
},
@@ -453,7 +457,7 @@ cr.define('options', function() {
$('incorrectPassphrase').style.display = "block";
}
- $('passphrase-ok').focus();
+ $('passphrase').focus();
},
setElementDisplay_: function(id, display) {
@@ -633,6 +637,21 @@ cr.define('options', function() {
showSuccessAndSettingUp_: function() {
$('sign-in').value = localStrings.getString('settingup');
},
+
+ /** @inheritDoc */
+ shouldClose: function() {
+ if (!$('cancel-warning-box').hidden) {
+ chrome.send('PassphraseCancel', ['']);
+ return true;
+ } else if (!$('sync-setup-passphrase').classList.contains('hidden')) {
+ // The Passphrase page is showing, and the use has pressed escape.
+ // Activate the cancel logic in this case.
+ this.showCancelWarning_();
+ return false;
+ }
+
+ return true;
+ },
};
SyncSetupOverlay.showSyncSetupPage = function(page, args) {