| OLD | NEW |
| 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 * This view displays information on ChromeOS specific features. | 6 * This view displays information on ChromeOS specific features. |
| 7 */ | 7 */ |
| 8 var CrosView = (function() { | 8 var CrosView = (function() { |
| 9 'use strict'; | 9 'use strict'; |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 /** | 26 /** |
| 27 * Send file contents and passcode to C++ cros network library. | 27 * Send file contents and passcode to C++ cros network library. |
| 28 * | 28 * |
| 29 * @private | 29 * @private |
| 30 */ | 30 */ |
| 31 function importONCFile_() { | 31 function importONCFile_() { |
| 32 clearParseStatus_(); | 32 clearParseStatus_(); |
| 33 if (fileContent) | 33 if (fileContent) |
| 34 g_browser.importONCFile(fileContent, passcode); | 34 g_browser.importONCFile(fileContent, passcode); |
| 35 else | 35 else |
| 36 setParseStatus_('ONC file parse failed: cannot read file'); | 36 setParseStatus_('ONC file parse failed: cannot read file', false); |
| 37 clearFileInput_(); | 37 clearFileInput_(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * Set the passcode var, and trigger onc import. | 41 * Set the passcode var, and trigger onc import. |
| 42 * | 42 * |
| 43 * @param {string} value The passcode value. | 43 * @param {string} value The passcode value. |
| 44 * @private | 44 * @private |
| 45 */ | 45 */ |
| 46 function setPasscode_(value) { | 46 function setPasscode_(value) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } else { | 83 } else { |
| 84 importONCFile_(); | 84 importONCFile_(); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 /** | 88 /** |
| 89 * Clear ONC file parse status. Clears and hides the parse status div. | 89 * Clear ONC file parse status. Clears and hides the parse status div. |
| 90 * | 90 * |
| 91 * @private | 91 * @private |
| 92 */ | 92 */ |
| 93 function clearParseStatus_(error) { | 93 function clearParseStatus_() { |
| 94 var parseStatus = $(CrosView.PARSE_STATUS_ID); | 94 var parseStatus = $(CrosView.PARSE_STATUS_ID); |
| 95 parseStatus.hidden = true; | 95 parseStatus.hidden = true; |
| 96 parseStatus.textContent = ''; | 96 parseStatus.textContent = ''; |
| 97 } | 97 } |
| 98 | 98 |
| 99 /** | 99 /** |
| 100 * Set ONC file parse status. | 100 * Set ONC file parse status. |
| 101 * | 101 * |
| 102 * @private | 102 * @private |
| 103 */ | 103 */ |
| 104 function setParseStatus_(error) { | 104 function setParseStatus_(message, success) { |
| 105 var parseStatus = $(CrosView.PARSE_STATUS_ID); | 105 var parseStatus = $(CrosView.PARSE_STATUS_ID); |
| 106 parseStatus.hidden = false; | 106 parseStatus.hidden = false; |
| 107 parseStatus.textContent = error ? | 107 |
| 108 'ONC file parse failed: ' + error : 'ONC file successfully parsed'; | 108 if (success) { |
| 109 if (message) { |
| 110 message = 'ONC file parsed and imported, however with warnings:\n' + |
| 111 message; |
| 112 } else { |
| 113 message = 'ONC file parsed and imported.'; |
| 114 } |
| 115 } else { |
| 116 message = 'ONC file parse failed:\n' + message; |
| 117 } |
| 118 |
| 119 parseStatus.innerHTML = message.replace(/\n/g, '<br>'); |
| 109 reset_(); | 120 reset_(); |
| 110 } | 121 } |
| 111 | 122 |
| 112 /** | 123 /** |
| 113 * Set storing debug logs status. | 124 * Set storing debug logs status. |
| 114 * | 125 * |
| 115 * @private | 126 * @private |
| 116 */ | 127 */ |
| 117 function setStoreDebugLogsStatus_(status) { | 128 function setStoreDebugLogsStatus_(status) { |
| 118 $(CrosView.STORE_DEBUG_LOGS_STATUS_ID).innerText = status; | 129 $(CrosView.STORE_DEBUG_LOGS_STATUS_ID).innerText = status; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // Inherit from DivView. | 248 // Inherit from DivView. |
| 238 __proto__: DivView.prototype, | 249 __proto__: DivView.prototype, |
| 239 | 250 |
| 240 onONCFileParse: setParseStatus_, | 251 onONCFileParse: setParseStatus_, |
| 241 onStoreDebugLogs: setStoreDebugLogsStatus_, | 252 onStoreDebugLogs: setStoreDebugLogsStatus_, |
| 242 onSetNetworkDebugMode: setNetworkDebugModeStatus_, | 253 onSetNetworkDebugMode: setNetworkDebugModeStatus_, |
| 243 }; | 254 }; |
| 244 | 255 |
| 245 return CrosView; | 256 return CrosView; |
| 246 })(); | 257 })(); |
| OLD | NEW |