| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 cr.define('mobile', function() { | 5 cr.define('mobile', function() { |
| 6 | 6 |
| 7 function SimUnlock() { | 7 function SimUnlock() { |
| 8 } | 8 } |
| 9 | 9 |
| 10 cr.addSingletonGetter(SimUnlock); | 10 cr.addSingletonGetter(SimUnlock); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 changeState_: function(simInfo) { | 30 changeState_: function(simInfo) { |
| 31 var newState = simInfo.state; | 31 var newState = simInfo.state; |
| 32 var error = simInfo.error; | 32 var error = simInfo.error; |
| 33 var tries = simInfo.tries; | 33 var tries = simInfo.tries; |
| 34 this.hideAll_(); | 34 this.hideAll_(); |
| 35 switch(newState) { | 35 switch(newState) { |
| 36 case SimUnlock.SIM_UNLOCK_LOADING: | 36 case SimUnlock.SIM_UNLOCK_LOADING: |
| 37 break; | 37 break; |
| 38 case SimUnlock.SIM_ABSENT_NOT_LOCKED: | 38 case SimUnlock.SIM_ABSENT_NOT_LOCKED: |
| 39 // TODO(nkostylev): Update status info, probably close dialog. | 39 SimUnlock.close(); |
| 40 break; | 40 break; |
| 41 case SimUnlock.SIM_LOCKED_PIN: | 41 case SimUnlock.SIM_LOCKED_PIN: |
| 42 $('pin-input').value = ''; | 42 $('pin-input').value = ''; |
| 43 SimUnlock.enablePinDialog(true); | 43 SimUnlock.enablePinDialog(true); |
| 44 var pinMessage; | 44 var pinMessage; |
| 45 if (error == SimUnlock.ERROR_OK) { | 45 if (error == SimUnlock.ERROR_OK) { |
| 46 pinMessage = SimUnlock.localStrings_.getString('enterPinMessage'); | 46 pinMessage = SimUnlock.localStrings_.getString('enterPinMessage'); |
| 47 $('pin-error-msg').classList.remove('error'); | 47 $('pin-error-msg').classList.remove('error'); |
| 48 } | 48 } |
| 49 if (error == SimUnlock.ERROR_PIN) { | 49 if (error == SimUnlock.ERROR_PIN) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 $('locked-puk-no-tries-overlay').hidden = true; | 88 $('locked-puk-no-tries-overlay').hidden = true; |
| 89 $('sim-disabled-overlay').hidden = true; | 89 $('sim-disabled-overlay').hidden = true; |
| 90 }, | 90 }, |
| 91 | 91 |
| 92 updateSimStatus_: function(simInfo) { | 92 updateSimStatus_: function(simInfo) { |
| 93 this.changeState_(simInfo); | 93 this.changeState_(simInfo); |
| 94 }, | 94 }, |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 SimUnlock.close = function() { | 97 SimUnlock.close = function() { |
| 98 // TODO(nkostylev): Close dialog. | 98 window.close(); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 SimUnlock.initialize = function() { | 101 SimUnlock.initialize = function() { |
| 102 this.initialized_ = true; | 102 this.initialized_ = true; |
| 103 $('enter-pin-confirm').addEventListener('click', function(event) { | 103 $('enter-pin-confirm').addEventListener('click', function(event) { |
| 104 SimUnlock.enablePinDialog(false); | 104 SimUnlock.enablePinDialog(false); |
| 105 chrome.send('enterPinCode', [$('pin-input').value]); | 105 chrome.send('enterPinCode', [$('pin-input').value]); |
| 106 }); | 106 }); |
| 107 $('enter-pin-dismiss').addEventListener('click', function(event) { | 107 $('enter-pin-dismiss').addEventListener('click', function(event) { |
| 108 SimUnlock.close(); | 108 SimUnlock.close(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 SimUnlock.simStateChanged = function(simInfo) { | 144 SimUnlock.simStateChanged = function(simInfo) { |
| 145 SimUnlock.getInstance().updateSimStatus_(simInfo); | 145 SimUnlock.getInstance().updateSimStatus_(simInfo); |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 // Export | 148 // Export |
| 149 return { | 149 return { |
| 150 SimUnlock: SimUnlock | 150 SimUnlock: SimUnlock |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 }); | 153 }); |
| OLD | NEW |