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

Unified Diff: chrome/browser/resources/settings/people_page/users_add_user_dialog.js

Issue 2617663002: WIP: run clang-format-js on lots of things (Closed)
Patch Set: merge Created 3 years, 11 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
Index: chrome/browser/resources/settings/people_page/users_add_user_dialog.js
diff --git a/chrome/browser/resources/settings/people_page/users_add_user_dialog.js b/chrome/browser/resources/settings/people_page/users_add_user_dialog.js
index b1383ee9516280b2881e0e9f6cc00562bc85b9ab..218cad2796436ccc2de1d7a65d6649a61728916e 100644
--- a/chrome/browser/resources/settings/people_page/users_add_user_dialog.js
+++ b/chrome/browser/resources/settings/people_page/users_add_user_dialog.js
@@ -9,77 +9,77 @@
*/
(function() {
-/**
- * Regular expression for adding a user where the string provided is just
- * the part before the "@".
- * Email alias only, assuming it's a gmail address.
- * e.g. 'john'
- * @const {!RegExp}
- */
-var NAME_ONLY_REGEX = new RegExp(
- '^\\s*([\\w\\.!#\\$%&\'\\*\\+-\\/=\\?\\^`\\{\\|\\}~]+)\\s*$');
+ /**
+ * Regular expression for adding a user where the string provided is just
+ * the part before the "@".
+ * Email alias only, assuming it's a gmail address.
+ * e.g. 'john'
+ * @const {!RegExp}
+ */
+ var NAME_ONLY_REGEX =
+ new RegExp('^\\s*([\\w\\.!#\\$%&\'\\*\\+-\\/=\\?\\^`\\{\\|\\}~]+)\\s*$');
-/**
- * Regular expression for adding a user where the string provided is a full
- * email address.
- * e.g. 'john@chromium.org'
- * @const {!RegExp}
- */
-var EMAIL_REGEX = new RegExp(
- '^\\s*([\\w\\.!#\\$%&\'\\*\\+-\\/=\\?\\^`\\{\\|\\}~]+)@' +
- '([A-Za-z0-9\-]{2,63}\\..+)\\s*$');
+ /**
+ * Regular expression for adding a user where the string provided is a full
+ * email address.
+ * e.g. 'john@chromium.org'
+ * @const {!RegExp}
+ */
+ var EMAIL_REGEX = new RegExp(
+ '^\\s*([\\w\\.!#\\$%&\'\\*\\+-\\/=\\?\\^`\\{\\|\\}~]+)@' +
+ '([A-Za-z0-9\-]{2,63}\\..+)\\s*$');
-Polymer({
- is: 'settings-users-add-user-dialog',
+ Polymer({
+ is: 'settings-users-add-user-dialog',
- open: function() {
- this.$.dialog.showModal();
- },
+ open: function() {
+ this.$.dialog.showModal();
+ },
- /** @private */
- onCancelTap_: function() {
- this.$.dialog.cancel();
- },
+ /** @private */
+ onCancelTap_: function() {
+ this.$.dialog.cancel();
+ },
- /**
+ /**
* Validates that the new user entered is valid.
* @private
* @return {boolean}
*/
- validate_: function() {
- var input = this.$.addUserInput.value;
- var valid = NAME_ONLY_REGEX.test(input) || EMAIL_REGEX.test(input);
+ validate_: function() {
+ var input = this.$.addUserInput.value;
+ var valid = NAME_ONLY_REGEX.test(input) || EMAIL_REGEX.test(input);
- this.$.add.disabled = !valid;
- this.$.addUserInput.invalid = !valid;
- return valid;
- },
+ this.$.add.disabled = !valid;
+ this.$.addUserInput.invalid = !valid;
+ return valid;
+ },
- /** @private */
- addUser_: function() {
- // May be submitted by the Enter key even if the input value is invalid.
- if (!this.validate_())
- return;
+ /** @private */
+ addUser_: function() {
+ // May be submitted by the Enter key even if the input value is invalid.
+ if (!this.validate_())
+ return;
- var input = this.$.addUserInput.value;
+ var input = this.$.addUserInput.value;
- var nameOnlyMatches = NAME_ONLY_REGEX.exec(input);
- var userEmail;
- if (nameOnlyMatches) {
- userEmail = nameOnlyMatches[1] + '@gmail.com';
- } else {
- var emailMatches = EMAIL_REGEX.exec(input);
- // Assuming the input validated, one of these two must match.
- assert(emailMatches);
- userEmail = emailMatches[1] + '@' + emailMatches[2];
- }
+ var nameOnlyMatches = NAME_ONLY_REGEX.exec(input);
+ var userEmail;
+ if (nameOnlyMatches) {
+ userEmail = nameOnlyMatches[1] + '@gmail.com';
+ } else {
+ var emailMatches = EMAIL_REGEX.exec(input);
+ // Assuming the input validated, one of these two must match.
+ assert(emailMatches);
+ userEmail = emailMatches[1] + '@' + emailMatches[2];
+ }
- chrome.usersPrivate.addWhitelistedUser(
- userEmail,
- /* callback */ function(success) {});
- this.$.addUserInput.value = '';
- this.$.dialog.close();
- },
-});
+ chrome.usersPrivate.addWhitelistedUser(
+ userEmail,
+ /* callback */ function(success) {});
+ this.$.addUserInput.value = '';
+ this.$.dialog.close();
+ },
+ });
})();

Powered by Google App Engine
This is Rietveld 408576698