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 * Requests the database from the backend. | 6 * Requests the database from the backend. |
7 */ | 7 */ |
8 function requestNetworkActionPredictorDb() { | 8 function requestAutocompleteActionPredictorDb() { |
9 console.debug('Requesting NAP DB'); | 9 console.debug('Requesting NAP DB'); |
10 chrome.send('requestNetworkActionPredictorDb', []) | 10 chrome.send('requestAutocompleteActionPredictorDb', []) |
11 } | 11 } |
12 | 12 |
13 | 13 |
14 /** | 14 /** |
15 * Callback from backend with the database contents. Sets up some globals and | 15 * Callback from backend with the database contents. Sets up some globals and |
16 * calls to create the UI. | 16 * calls to create the UI. |
17 * @param {Dictionary} database Information about NetworkActionPredictor | 17 * @param {Dictionary} database Information about NetworkActionPredictor |
18 * including the database as a flattened list, a boolean indicating if the | 18 * including the database as a flattened list, a boolean indicating if the |
19 * system is enabled and the current hit weight. | 19 * system is enabled and the current hit weight. |
20 */ | 20 */ |
21 function updateDatabaseTable(database) { | 21 function updateDatabaseTable(database) { |
22 console.debug('Updating Table NAP DB'); | 22 console.debug('Updating Table NAP DB'); |
23 | 23 |
24 var filter = $('filter'); | 24 var filter = $('filter'); |
25 filter.disabled = false; | 25 filter.disabled = false; |
26 filter.onchange = function() { | 26 filter.onchange = function() { |
27 updateDatabaseView(database); | 27 updateDatabaseView(database); |
28 }; | 28 }; |
29 | 29 |
30 updateDatabaseView(database); | 30 updateDatabaseView(database); |
31 } | 31 } |
32 | 32 |
33 /** | 33 /** |
34 * Updates the table from the database. | 34 * Updates the table from the database. |
35 * @param {Dictionary} database Information about NetworkActionPredictor | 35 * @param {Dictionary} database Information about AutocompleteActionPredictor |
36 * including the database as a flattened list, a boolean indicating if the | 36 * including the database as a flattened list, a boolean indicating if the |
37 * system is enabled and the current hit weight. | 37 * system is enabled and the current hit weight. |
38 */ | 38 */ |
39 function updateDatabaseView(database) { | 39 function updateDatabaseView(database) { |
40 var databaseSection = $('databaseTableBody'); | 40 var databaseSection = $('databaseTableBody'); |
41 var showEnabled = database.enabled && database.db; | 41 var showEnabled = database.enabled && database.db; |
42 | 42 |
43 $('enabledMode').hidden = !showEnabled; | 43 $('enabledMode').hidden = !showEnabled; |
44 $('disabledMode').hidden = showEnabled; | 44 $('disabledMode').hidden = showEnabled; |
45 | 45 |
(...skipping 21 matching lines...) Expand all Loading... | |
67 row.appendChild(document.createElement('td')).textContent = | 67 row.appendChild(document.createElement('td')).textContent = |
68 entry.confidence; | 68 entry.confidence; |
69 | 69 |
70 databaseSection.appendChild(row); | 70 databaseSection.appendChild(row); |
71 } | 71 } |
72 } | 72 } |
73 $('countBanner').textContent = 'Entries: ' + databaseSection.children.length; | 73 $('countBanner').textContent = 'Entries: ' + databaseSection.children.length; |
74 $('countBanner').textContent += ' Hit Weight: ' + database.hit_weight; | 74 $('countBanner').textContent += ' Hit Weight: ' + database.hit_weight; |
75 } | 75 } |
76 | 76 |
77 document.addEventListener('DOMContentLoaded', requestNetworkActionPredictorDb); | 77 document.addEventListener('DOMContentLoaded', requestAutocompleteActionPredictor Db); |
dominich
2012/03/06 16:42:13
wrap line
Shishir
2012/03/14 21:14:37
Done.
| |
OLD | NEW |