OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Inline login UI. | 6 * @fileoverview Inline login UI. |
7 */ | 7 */ |
8 | 8 |
9 cr.define('inline.login', function() { | 9 cr.define('inline.login', function() { |
10 'use strict'; | 10 'use strict'; |
11 | 11 |
12 /** | 12 /** |
13 * The auth extension host instance. | 13 * The auth extension host instance. |
14 * @type {cr.login.GaiaAuthHost} | 14 * @type {cr.login.GaiaAuthHost} |
15 */ | 15 */ |
16 var authExtHost; | 16 var authExtHost; |
17 | 17 |
18 /** | 18 /** |
19 * Whether the auth ready event has been fired, for testing purpose. | 19 * Whether the auth ready event has been fired, for testing purpose. |
20 */ | 20 */ |
21 var authReadyFired; | 21 var authReadyFired; |
22 | 22 |
| 23 /** |
| 24 * Whether the login UI is loaded for signing in primary account. |
| 25 */ |
| 26 var isLoginPrimaryAccount; |
| 27 |
23 function onResize(e) { | 28 function onResize(e) { |
24 chrome.send('switchToFullTab', [e.detail]); | 29 chrome.send('switchToFullTab', [e.detail]); |
25 } | 30 } |
26 | 31 |
27 function onAuthReady(e) { | 32 function onAuthReady(e) { |
28 $('contents').classList.toggle('loading', false); | 33 $('contents').classList.toggle('loading', false); |
29 authReadyFired = true; | 34 authReadyFired = true; |
30 chrome.send('metricsHandler:recordAction', ['Signin_SigninPage_Shown']); | 35 if (isLoginPrimaryAccount) |
| 36 chrome.send('metricsHandler:recordAction', ['Signin_SigninPage_Shown']); |
31 } | 37 } |
32 | 38 |
33 function onDropLink(e) { | 39 function onDropLink(e) { |
34 // Navigate to the dropped link. | 40 // Navigate to the dropped link. |
35 window.location.href = e.detail; | 41 window.location.href = e.detail; |
36 } | 42 } |
37 | 43 |
38 function onNewWindow(e) { | 44 function onNewWindow(e) { |
39 window.open(e.detail.targetUrl, '_blank'); | 45 window.open(e.detail.targetUrl, '_blank'); |
40 e.detail.window.discard(); | 46 e.detail.window.discard(); |
(...skipping 26 matching lines...) Expand all Loading... |
67 * Loads auth extension. | 73 * Loads auth extension. |
68 * @param {Object} data Parameters for auth extension. | 74 * @param {Object} data Parameters for auth extension. |
69 */ | 75 */ |
70 function loadAuthExtension(data) { | 76 function loadAuthExtension(data) { |
71 // TODO(rogerta): in when using webview, the |completeLogin| argument | 77 // TODO(rogerta): in when using webview, the |completeLogin| argument |
72 // is ignored. See addEventListener() call above. | 78 // is ignored. See addEventListener() call above. |
73 authExtHost.load(data.authMode, data, completeLogin); | 79 authExtHost.load(data.authMode, data, completeLogin); |
74 $('contents').classList.toggle('loading', | 80 $('contents').classList.toggle('loading', |
75 data.authMode != cr.login.GaiaAuthHost.AuthMode.DESKTOP || | 81 data.authMode != cr.login.GaiaAuthHost.AuthMode.DESKTOP || |
76 data.constrained == '1'); | 82 data.constrained == '1'); |
| 83 isLoginPrimaryAccount = data.isLoginPrimaryAccount; |
77 } | 84 } |
78 | 85 |
79 /** | 86 /** |
80 * Closes the inline login dialog. | 87 * Closes the inline login dialog. |
81 */ | 88 */ |
82 function closeDialog() { | 89 function closeDialog() { |
83 chrome.send('dialogClose', ['']); | 90 chrome.send('dialogClose', ['']); |
84 } | 91 } |
85 | 92 |
86 /** | 93 /** |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 initialize: initialize, | 140 initialize: initialize, |
134 isAuthReady: isAuthReady, | 141 isAuthReady: isAuthReady, |
135 loadAuthExtension: loadAuthExtension, | 142 loadAuthExtension: loadAuthExtension, |
136 navigationButtonClicked: navigationButtonClicked, | 143 navigationButtonClicked: navigationButtonClicked, |
137 showBackButton: showBackButton, | 144 showBackButton: showBackButton, |
138 showCloseButton: showCloseButton | 145 showCloseButton: showCloseButton |
139 }; | 146 }; |
140 }); | 147 }); |
141 | 148 |
142 document.addEventListener('DOMContentLoaded', inline.login.initialize); | 149 document.addEventListener('DOMContentLoaded', inline.login.initialize); |
OLD | NEW |