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 /** | 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 |
11 var fileContent; | 11 var fileContent; |
12 var passcode = ''; | 12 var passcode = ''; |
13 | 13 |
14 /** | 14 /** |
15 * Send file contents and passcode to C++ cros network library. | 15 * Send file contents and passcode to C++ cros network library. |
16 * | 16 * |
17 * @private | 17 * @private |
18 */ | 18 */ |
19 function importONCFile_() { | 19 function importONCFile_() { |
20 if (fileContent) | 20 if (fileContent) |
21 g_browser.importONCFile(fileContent, passcode); | 21 g_browser.importONCFile(fileContent, passcode); |
22 else | 22 else |
23 setParseStatus_(false); | 23 setParseStatus_("ONC file parse failed: cannot read file"); |
mmenke
2011/12/14 22:42:41
nit: Javascript should use single quotes, as it's
Charlie Lee
2011/12/14 22:52:02
Done.
| |
24 } | 24 } |
25 | 25 |
26 /** | 26 /** |
27 * Set the passcode var, and trigger onc import. | 27 * Set the passcode var, and trigger onc import. |
28 * | 28 * |
29 * @private | 29 * @private |
30 * @param {string} passcode | 30 * @param {string} passcode |
31 */ | 31 */ |
32 function setPasscode_(value) { | 32 function setPasscode_(value) { |
33 passcode = value; | 33 passcode = value; |
(...skipping 28 matching lines...) Expand all Loading... | |
62 } else { | 62 } else { |
63 promptForPasscode_(); | 63 promptForPasscode_(); |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 /** | 67 /** |
68 * Set ONC file parse status. | 68 * Set ONC file parse status. |
69 * | 69 * |
70 * @private | 70 * @private |
71 */ | 71 */ |
72 function setParseStatus_(success) { | 72 function setParseStatus_(error) { |
73 var parseStatus = $(CrosView.PARSE_STATUS_ID); | 73 var parseStatus = $(CrosView.PARSE_STATUS_ID); |
74 parseStatus.hidden = false; | 74 parseStatus.hidden = false; |
75 parseStatus.textContent = success ? | 75 parseStatus.textContent = error ? |
76 "ONC file successfully parsed" : "ONC file parse failed"; | 76 "ONC file parse failed: " + error : "ONC file successfully parsed"; |
77 reset_(); | 77 reset_(); |
78 } | 78 } |
79 | 79 |
80 /** | 80 /** |
81 * Add event listeners for the file selection and passcode input fields. | 81 * Add event listeners for the file selection and passcode input fields. |
82 * | 82 * |
83 * @private | 83 * @private |
84 */ | 84 */ |
85 function addEventListeners_() { | 85 function addEventListeners_() { |
86 $(CrosView.IMPORT_ONC_ID).addEventListener('change', function(event) { | 86 $(CrosView.IMPORT_ONC_ID).addEventListener('change', function(event) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 | 136 |
137 CrosView.prototype = { | 137 CrosView.prototype = { |
138 // Inherit from DivView. | 138 // Inherit from DivView. |
139 __proto__: DivView.prototype, | 139 __proto__: DivView.prototype, |
140 | 140 |
141 onONCFileParse: setParseStatus_, | 141 onONCFileParse: setParseStatus_, |
142 }; | 142 }; |
143 | 143 |
144 return CrosView; | 144 return CrosView; |
145 })(); | 145 })(); |
OLD | NEW |