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

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

Issue 171533014: Revert of Implement inline signin with iframe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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/inline_injected.js
diff --git a/chrome/browser/resources/gaia_auth/inline_injected.js b/chrome/browser/resources/gaia_auth/inline_injected.js
new file mode 100644
index 0000000000000000000000000000000000000000..b0b847381605721df5b9cdd51002df55a5a6a6bd
--- /dev/null
+++ b/chrome/browser/resources/gaia_auth/inline_injected.js
@@ -0,0 +1,46 @@
+// Copyright 2013 The Chromium 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 Code injected into Gaia sign in page for inline sign in flow.
+ * On load stop, it receives a message from the embedder extension with a
+ * JavaScript reference to the embedder window. Then upon submit of the sign
+ * in form, it posts the username and password to the embedder window.
+ * Prototype Only.
+ */
+
+(function() {
+ var extWindow;
+
+ var $ = function(id) { return document.getElementById(id); };
+ var gaiaLoginForm = $('gaia_loginform');
+
+ var onMessage = function(e) {
+ extWindow = e.source;
+ };
+ window.addEventListener('message', onMessage);
+
+ var onLoginSubmit = function(e) {
+ if (!extWindow) {
+ console.log('ERROR: no initial message received from the gaia ext');
+ e.preventDefault();
+ return;
+ }
+
+ var checkboxElement = $('advanced-box');
+ var chooseWhatToSync = checkboxElement && checkboxElement.checked;
+ var msg = {method: 'attemptLogin',
+ email: gaiaLoginForm['Email'].value,
+ password: gaiaLoginForm['Passwd'].value,
+ attemptToken: new Date().getTime(),
+ chooseWhatToSync: chooseWhatToSync};
+
+ extWindow.postMessage(msg, 'chrome://chrome-signin');
+ console.log('Credentials sent');
+
+ return;
+ };
+ // Overrides the submit handler for the gaia login form.
+ gaiaLoginForm.onsubmit = onLoginSubmit;
+})();
« no previous file with comments | « chrome/browser/resources/gaia_auth/desktop_injected.js ('k') | chrome/browser/resources/gaia_auth/inline_main.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698