OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 Account picker screen implementation. | 6 * @fileoverview Account picker screen implementation. |
7 */ | 7 */ |
8 | 8 |
9 login.createScreen('AccountPickerScreen', 'account-picker', function() { | 9 login.createScreen('AccountPickerScreen', 'account-picker', function() { |
10 /** | 10 /** |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 onAfterShow: function(data) { | 109 onAfterShow: function(data) { |
110 $('pod-row').handleAfterShow(); | 110 $('pod-row').handleAfterShow(); |
111 }, | 111 }, |
112 | 112 |
113 /** | 113 /** |
114 * Event handler that is invoked just before the frame is shown. | 114 * Event handler that is invoked just before the frame is shown. |
115 * @param {string} data Screen init payload. | 115 * @param {string} data Screen init payload. |
116 */ | 116 */ |
117 onBeforeShow: function(data) { | 117 onBeforeShow: function(data) { |
118 this.showing_ = true; | 118 this.showing_ = true; |
| 119 |
| 120 this.ownerDocument.addEventListener('click', |
| 121 this.handleOwnerDocClick_.bind(this)); |
| 122 |
119 chrome.send('loginUIStateChanged', ['account-picker', true]); | 123 chrome.send('loginUIStateChanged', ['account-picker', true]); |
120 $('login-header-bar').signinUIState = SIGNIN_UI_STATE.ACCOUNT_PICKER; | 124 $('login-header-bar').signinUIState = SIGNIN_UI_STATE.ACCOUNT_PICKER; |
121 // Header bar should be always visible on Account Picker screen. | 125 // Header bar should be always visible on Account Picker screen. |
122 Oobe.getInstance().headerHidden = false; | 126 Oobe.getInstance().headerHidden = false; |
123 chrome.send('hideCaptivePortal'); | 127 chrome.send('hideCaptivePortal'); |
124 var podRow = $('pod-row'); | 128 var podRow = $('pod-row'); |
125 podRow.handleBeforeShow(); | 129 podRow.handleBeforeShow(); |
126 | 130 |
127 // In case of the preselected pod onShow will be called once pod | 131 // In case of the preselected pod onShow will be called once pod |
128 // receives focus. | 132 // receives focus. |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 * @param {LOCK_SCREEN_APPS_STATE} state The current lock screen apps state. | 477 * @param {LOCK_SCREEN_APPS_STATE} state The current lock screen apps state. |
474 */ | 478 */ |
475 setLockScreenAppsState: function(state) { | 479 setLockScreenAppsState: function(state) { |
476 if (Oobe.getInstance().displayType != DISPLAY_TYPE.LOCK || | 480 if (Oobe.getInstance().displayType != DISPLAY_TYPE.LOCK || |
477 state == this.lockScreenAppsState_) { | 481 state == this.lockScreenAppsState_) { |
478 return; | 482 return; |
479 } | 483 } |
480 | 484 |
481 this.lockScreenAppsState_ = state; | 485 this.lockScreenAppsState_ = state; |
482 $('login-header-bar').lockScreenAppsState = state; | 486 $('login-header-bar').lockScreenAppsState = state; |
483 // When an lock screen app window is in background - i.e. visible behind | |
484 // the lock screen UI - dim the lock screen background, so it's more | |
485 // noticeable that the app widow in background is not actionable. | |
486 $('background').classList.toggle( | |
487 'dimmed-background', state == LOCK_SCREEN_APPS_STATE.BACKGROUND); | |
488 }, | 487 }, |
489 | 488 |
490 /** | 489 /** |
491 * Handles clicks on the document which displays the account picker UI. | 490 * Handles clicks on the document which displays the account picker UI. |
492 * If the click event target is outer container - i.e. background portion of | 491 * If the click event target is outer container - i.e. background portion of |
493 * UI with no other UI elements, and lock screen apps are in background, a | 492 * UI with no other UI elements, and lock screen apps are in background, a |
494 * request is issued to chrome to move lock screen apps to foreground. | 493 * request is issued to chrome to move lock screen apps to foreground. |
495 * @param {Event} event The click event. | 494 * @param {Event} event The click event. |
496 */ | 495 */ |
497 handleOwnerDocClick_: function(event) { | 496 handleOwnerDocClick_: function(event) { |
498 if (this.lockScreenAppsState_ != LOCK_SCREEN_APPS_STATE.BACKGROUND || | 497 if (this.lockScreenAppsState_ != LOCK_SCREEN_APPS_STATE.BACKGROUND || |
499 event.target != $('outer-container')) { | 498 (event.target != $('account-picker') && |
| 499 event.target != $('version'))) { |
500 return; | 500 return; |
501 } | 501 } |
502 chrome.send('setLockScreenAppsState', | 502 chrome.send('setLockScreenAppsState', |
503 [LOCK_SCREEN_APPS_STATE.FOREGROUND]); | 503 [LOCK_SCREEN_APPS_STATE.FOREGROUND]); |
504 | 504 |
505 event.preventDefault(); | 505 event.preventDefault(); |
506 event.stopPropagation(); | 506 event.stopPropagation(); |
507 }, | 507 }, |
508 }; | 508 }; |
509 }); | 509 }); |
OLD | NEW |