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

Side by Side Diff: chrome/browser/resources/chromeos/login/screen_gaia_signin.js

Issue 1983433002: Add timeout for SAML webcam logins (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@saml-ui
Patch Set: cancel timer if login is aborted Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 Oobe signin screen implementation. 6 * @fileoverview Oobe signin screen implementation.
7 */ 7 */
8 8
9 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { 9 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() {
10 // GAIA animation guard timer. Started when GAIA page is loaded 10 // GAIA animation guard timer. Started when GAIA page is loaded
11 // (Authenticator 'ready' event) and is intended to guard against edge cases 11 // (Authenticator 'ready' event) and is intended to guard against edge cases
12 // when 'showView' message is not generated/received. 12 // when 'showView' message is not generated/received.
13 /** @const */ var GAIA_ANIMATION_GUARD_MILLISEC = 300; 13 /** @const */ var GAIA_ANIMATION_GUARD_MILLISEC = 300;
14 14
15 // Maximum Gaia loading time in seconds. 15 // Maximum Gaia loading time in seconds.
16 /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60; 16 /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60;
17 17
18 // The help topic regarding user not being in the whitelist. 18 // The help topic regarding user not being in the whitelist.
19 /** @const */ var HELP_CANT_ACCESS_ACCOUNT = 188036; 19 /** @const */ var HELP_CANT_ACCESS_ACCOUNT = 188036;
20 20
21 // Amount of time the user has to be idle for before showing the online login 21 // Amount of time the user has to be idle for before showing the online login
22 // page. 22 // page.
23 /** @const */ var IDLE_TIME_UNTIL_EXIT_OFFLINE_IN_MILLISECONDS = 180 * 1000; 23 /** @const */ var IDLE_TIME_UNTIL_EXIT_OFFLINE_IN_MILLISECONDS = 180 * 1000;
24 24
25 // Approximate amount of time between checks to see if we should go to the 25 // Approximate amount of time between checks to see if we should go to the
26 // online login page when we're in the offline login page and the device is 26 // online login page when we're in the offline login page and the device is
27 // online. 27 // online.
28 /** @const */ var IDLE_TIME_CHECK_FREQUENCY = 5 * 1000; 28 /** @const */ var IDLE_TIME_CHECK_FREQUENCY = 5 * 1000;
29 29
30 // Amount of time allowed for video based SAML logins, to prevent a site
31 // from keeping the camera on indefinitely. This is a hard deadline and
32 // it will not be extended by user activity.
33 /** @const */ var MAX_VIDEO_LOGIN_TIME_SEC = 60;
achuithb 2016/05/17 21:49:32 Just make this in millisec: var VIDEO_LOGIN_TIMEOU
Kevin Cernekee 2016/05/17 21:56:10 Done.
34
30 /** 35 /**
31 * The modes this screen can be in. 36 * The modes this screen can be in.
32 * @enum {integer} 37 * @enum {integer}
33 */ 38 */
34 var ScreenMode = { 39 var ScreenMode = {
35 DEFAULT: 0, // Default GAIA login flow. 40 DEFAULT: 0, // Default GAIA login flow.
36 OFFLINE: 1, // GAIA offline login. 41 OFFLINE: 1, // GAIA offline login.
37 SAML_INTERSTITIAL: 2 // Interstitial page before SAML redirection. 42 SAML_INTERSTITIAL: 2 // Interstitial page before SAML redirection.
38 }; 43 };
39 44
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 80
76 /** 81 /**
77 * Timer id of a guard timer that is fired in case 'showView' message 82 * Timer id of a guard timer that is fired in case 'showView' message
78 * is not received from GAIA. 83 * is not received from GAIA.
79 * @type {number} 84 * @type {number}
80 * @private 85 * @private
81 */ 86 */
82 loadAnimationGuardTimer_: undefined, 87 loadAnimationGuardTimer_: undefined,
83 88
84 /** 89 /**
90 * Timer id of the video login timer.
91 * @type {number}
92 * @private
93 */
94 videoTimer_: undefined,
95
96 /**
85 * Whether we've processed 'showView' message - either from GAIA or from 97 * Whether we've processed 'showView' message - either from GAIA or from
86 * guard timer. 98 * guard timer.
87 * @type {boolean} 99 * @type {boolean}
88 * @private 100 * @private
89 */ 101 */
90 showViewProcessed_: false, 102 showViewProcessed_: false,
91 103
92 /** 104 /**
93 * Whether we've processed 'authCompleted' message. 105 * Whether we've processed 'authCompleted' message.
94 * @type {boolean} 106 * @type {boolean}
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 */ 640 */
629 onAuthDomainChange_: function() { 641 onAuthDomainChange_: function() {
630 this.updateSamlNotice_(); 642 this.updateSamlNotice_();
631 }, 643 },
632 644
633 /** 645 /**
634 * Invoked when the videoEnabled property is changed on the GAIA host. 646 * Invoked when the videoEnabled property is changed on the GAIA host.
635 */ 647 */
636 onVideoEnabledChange_: function() { 648 onVideoEnabledChange_: function() {
637 this.updateSamlNotice_(); 649 this.updateSamlNotice_();
650 if (this.gaiaAuthHost_.videoEnabled && this.videoTimer_ === undefined) {
651 this.videoTimer_ = setTimeout(this.cancel.bind(this),
652 MAX_VIDEO_LOGIN_TIME_SEC * 1000);
653 }
638 }, 654 },
639 655
640 /** 656 /**
641 * Invoked when the authFlow property is changed on the GAIA host. 657 * Invoked when the authFlow property is changed on the GAIA host.
642 */ 658 */
643 onAuthFlowChange_: function() { 659 onAuthFlowChange_: function() {
644 var isSAML = this.isSAML(); 660 var isSAML = this.isSAML();
645 661
646 this.classList.toggle('full-width', isSAML); 662 this.classList.toggle('full-width', isSAML);
647 $('saml-notice-container').hidden = !isSAML; 663 $('saml-notice-container').hidden = !isSAML;
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 } 960 }
945 }, 961 },
946 962
947 /** 963 /**
948 * Called when user canceled signin. 964 * Called when user canceled signin.
949 */ 965 */
950 cancel: function() { 966 cancel: function() {
951 if (!this.navigation_.refreshVisible && !this.navigation_.closeVisible) 967 if (!this.navigation_.refreshVisible && !this.navigation_.closeVisible)
952 return; 968 return;
953 969
970 if (this.videoTimer_ !== undefined) {
971 clearTimeout(this.videoTimer_);
972 this.videoTimer_ = undefined;
973 }
974
954 if (this.closable) 975 if (this.closable)
955 Oobe.showUserPods(); 976 Oobe.showUserPods();
956 else 977 else
957 Oobe.resetSigninUI(true); 978 Oobe.resetSigninUI(true);
958 }, 979 },
959 980
960 /** 981 /**
961 * Handler for webview error handling. 982 * Handler for webview error handling.
962 * @param {!Object} data Additional information about error event like: 983 * @param {!Object} data Additional information about error event like:
963 * {string} error Error code such as "ERR_INTERNET_DISCONNECTED". 984 * {string} error Error code such as "ERR_INTERNET_DISCONNECTED".
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 this.classList.toggle('whitelist-error', show); 1031 this.classList.toggle('whitelist-error', show);
1011 this.loading = !show; 1032 this.loading = !show;
1012 1033
1013 if (!show) 1034 if (!show)
1014 Oobe.showSigninUI(); 1035 Oobe.showSigninUI();
1015 1036
1016 this.updateControlsState(); 1037 this.updateControlsState();
1017 } 1038 }
1018 }; 1039 };
1019 }); 1040 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698