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

Unified Diff: chrome/browser/resources/gaia_auth/offline.js

Issue 10443024: Added chrome switch that lets tests override URL path, moved GAIA auth extension from CrOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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/gaia_auth/offline.js
diff --git a/chrome/browser/resources/gaia_auth/offline.js b/chrome/browser/resources/gaia_auth/offline.js
new file mode 100644
index 0000000000000000000000000000000000000000..8fe08f6333f22e3b29c2cb764ac63cbcd874d3b0
--- /dev/null
+++ b/chrome/browser/resources/gaia_auth/offline.js
@@ -0,0 +1,50 @@
+// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview Offline login implementation.
+ */
+
+function load() {
+ var params = getUrlSearchParams(location.search);
+
+ // Setup localized strings.
+ var signInTitle = $('sign-in-title');
+ var emailLabel = $('email-label');
+ var passwordLabel = $('password-label');
+ var submitButton = $('submit-button');
+ var errorSpan = $('errormsg-alert');
+
+ signInTitle.textContent = decodeURIComponent(params['stringSignIn']);
+ emailLabel.textContent = decodeURIComponent(params['stringEmail']);
+ passwordLabel.textContent = decodeURIComponent(params['stringPassword']);
+ submitButton.value = decodeURIComponent(params['stringSignIn']);
+ errorSpan.textContent = decodeURIComponent(params['stringError']);
+
+ // Setup actions.
+ var form = $('offline-login-form');
+ form.addEventListener('submit', function(e) {
+ var msg = {
+ 'method': 'offlineLogin',
+ 'email': form.email.value,
+ 'password': form.password.value
+ };
+ window.parent.postMessage(msg, 'chrome://oobe/');
+ e.preventDefault();
+ });
+
+ var email = params['email'];
+ if (email) {
+ // Email is present, which means that unsuccessful login attempt has been
+ // made. Try to mimic Gaia's behaviour.
+ form.email.value = email;
+ form.password.classList.add('form-error');
+ form.password.focus();
+ } else {
+ form.email.focus();
+ }
+ window.parent.postMessage({'method': 'loginUILoaded'}, 'chrome://oobe/');
+}
+
+document.addEventListener('DOMContentLoaded', load);

Powered by Google App Engine
This is Rietveld 408576698