| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 Polymer((function() { | 5 Polymer((function() { |
| 6 var DEFAULT_EMAIL_DOMAIN = '@gmail.com'; | 6 var DEFAULT_EMAIL_DOMAIN = '@gmail.com'; |
| 7 | 7 |
| 8 var TRANSITION_TYPE = { | 8 var TRANSITION_TYPE = {FORWARD: 0, BACKWARD: 1, NONE: 2}; |
| 9 FORWARD: 0, | |
| 10 BACKWARD: 1, | |
| 11 NONE: 2 | |
| 12 }; | |
| 13 | 9 |
| 14 return { | 10 return { |
| 15 is: 'offline-gaia', | 11 is: 'offline-gaia', |
| 16 | 12 |
| 17 properties: { | 13 properties: { |
| 18 disabled: { | 14 disabled: {type: Boolean, value: false}, |
| 19 type: Boolean, | |
| 20 value: false | |
| 21 }, | |
| 22 | 15 |
| 23 showEnterpriseMessage: { | 16 showEnterpriseMessage: {type: Boolean, value: false}, |
| 24 type: Boolean, | |
| 25 value: false | |
| 26 }, | |
| 27 | 17 |
| 28 domain: { | 18 domain: {type: String, observer: 'onDomainChanged_'}, |
| 29 type: String, | |
| 30 observer: 'onDomainChanged_' | |
| 31 }, | |
| 32 | 19 |
| 33 emailDomain: String | 20 emailDomain: String |
| 34 }, | 21 }, |
| 35 | 22 |
| 36 ready: function() { | 23 ready: function() { |
| 37 /** | 24 /** |
| 38 * Workaround for | 25 * Workaround for |
| 39 * https://github.com/PolymerElements/neon-animation/issues/32 | 26 * https://github.com/PolymerElements/neon-animation/issues/32 |
| 40 * TODO(dzhioev): Remove when fixed in Polymer. | 27 * TODO(dzhioev): Remove when fixed in Polymer. |
| 41 */ | 28 */ |
| 42 var pages = this.$.animatedPages; | 29 var pages = this.$.animatedPages; |
| 43 delete pages._squelchNextFinishEvent; | 30 delete pages._squelchNextFinishEvent; |
| 44 Object.defineProperty(pages, '_squelchNextFinishEvent', | 31 Object.defineProperty(pages, '_squelchNextFinishEvent', { |
| 45 { get: function() { return false; } }); | 32 get: function() { |
| 33 return false; |
| 34 } |
| 35 }); |
| 46 }, | 36 }, |
| 47 | 37 |
| 48 focus: function() { | 38 focus: function() { |
| 49 if (this.isEmailSectionActive_()) | 39 if (this.isEmailSectionActive_()) |
| 50 this.$.emailInput.focus(); | 40 this.$.emailInput.focus(); |
| 51 else | 41 else |
| 52 this.$.passwordInput.focus(); | 42 this.$.passwordInput.focus(); |
| 53 }, | 43 }, |
| 54 | 44 |
| 55 back: function() { | 45 back: function() { |
| 56 this.switchToEmailCard(true /* animated */); | 46 this.switchToEmailCard(true /* animated */); |
| 57 }, | 47 }, |
| 58 | 48 |
| 59 onDomainChanged_: function() { | 49 onDomainChanged_: function() { |
| 60 this.$.managedBy.textContent = | 50 this.$.managedBy.textContent = |
| 61 loadTimeData.getStringF('enterpriseInfoMessage', this.domain); | 51 loadTimeData.getStringF('enterpriseInfoMessage', this.domain); |
| 62 this.showEnterpriseMessage = !!this.domain.length; | 52 this.showEnterpriseMessage = !!this.domain.length; |
| 63 }, | 53 }, |
| 64 | 54 |
| 65 onAnimationFinish_: function() { | 55 onAnimationFinish_: function() { |
| 66 this.fire('backButton', !this.isEmailSectionActive_()); | 56 this.fire('backButton', !this.isEmailSectionActive_()); |
| 67 this.focus(); | 57 this.focus(); |
| 68 }, | 58 }, |
| 69 | 59 |
| 70 onForgotPasswordClicked_: function() { | 60 onForgotPasswordClicked_: function() { |
| 71 this.$.forgotPasswordDlg.fitInto = this; | 61 this.$.forgotPasswordDlg.fitInto = this; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 }, | 140 }, |
| 151 | 141 |
| 152 setUpPageTransitions_: function(transitionType) { | 142 setUpPageTransitions_: function(transitionType) { |
| 153 if (transitionType === TRANSITION_TYPE.NONE) { | 143 if (transitionType === TRANSITION_TYPE.NONE) { |
| 154 this.$.animatedPages.entryAnimation = ''; | 144 this.$.animatedPages.entryAnimation = ''; |
| 155 this.$.animatedPages.exitAnimation = ''; | 145 this.$.animatedPages.exitAnimation = ''; |
| 156 return; | 146 return; |
| 157 } | 147 } |
| 158 var isForward = transitionType === TRANSITION_TYPE.FORWARD; | 148 var isForward = transitionType === TRANSITION_TYPE.FORWARD; |
| 159 var isRTL = this.isRTL_(); | 149 var isRTL = this.isRTL_(); |
| 160 this.$.animatedPages.entryAnimation = | 150 this.$.animatedPages.entryAnimation = 'slide-from-' + |
| 161 'slide-from-' + (isForward === isRTL ? 'left' : 'right') + | 151 (isForward === isRTL ? 'left' : 'right') + '-animation'; |
| 162 '-animation'; | |
| 163 this.$.animatedPages.exitAnimation = | 152 this.$.animatedPages.exitAnimation = |
| 164 'slide-' + (isForward === isRTL ? 'right' : 'left') + '-animation'; | 153 'slide-' + (isForward === isRTL ? 'right' : 'left') + '-animation'; |
| 165 } | 154 } |
| 166 }; | 155 }; |
| 167 })()); | 156 })()); |
| OLD | NEW |