| 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 requestAutocompleteActionPredictorDb() { | 8 function requestAutocompleteActionPredictorDb() { |
| 9 chrome.send('requestAutocompleteActionPredictorDb'); | 9 chrome.send('requestAutocompleteActionPredictorDb'); |
| 10 } | 10 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 var filter = $('filter'); | 47 var filter = $('filter'); |
| 48 | 48 |
| 49 // Clear any previous list. | 49 // Clear any previous list. |
| 50 databaseSection.textContent = ''; | 50 databaseSection.textContent = ''; |
| 51 | 51 |
| 52 for (var i = 0; i < database.db.length; ++i) { | 52 for (var i = 0; i < database.db.length; ++i) { |
| 53 var entry = database.db[i]; | 53 var entry = database.db[i]; |
| 54 | 54 |
| 55 if (!filter.checked || entry.confidence > 0) { | 55 if (!filter.checked || entry.confidence > 0) { |
| 56 var row = document.createElement('tr'); | 56 var row = document.createElement('tr'); |
| 57 row.className = (entry.confidence > 0.8 ? 'action-prerender' : | 57 row.className = |
| 58 (entry.confidence > 0.5 ? 'action-preconnect' : | 58 (entry.confidence > 0.8 ? |
| 59 'action-none')); | 59 'action-prerender' : |
| 60 (entry.confidence > 0.5 ? 'action-preconnect' : 'action-none')); |
| 60 | 61 |
| 61 row.appendChild(document.createElement('td')).textContent = | 62 row.appendChild(document.createElement('td')).textContent = |
| 62 entry.user_text; | 63 entry.user_text; |
| 63 row.appendChild(document.createElement('td')).textContent = entry.url; | 64 row.appendChild(document.createElement('td')).textContent = entry.url; |
| 64 row.appendChild(document.createElement('td')).textContent = | 65 row.appendChild(document.createElement('td')).textContent = |
| 65 entry.hit_count; | 66 entry.hit_count; |
| 66 row.appendChild(document.createElement('td')).textContent = | 67 row.appendChild(document.createElement('td')).textContent = |
| 67 entry.miss_count; | 68 entry.miss_count; |
| 68 row.appendChild(document.createElement('td')).textContent = | 69 row.appendChild(document.createElement('td')).textContent = |
| 69 entry.confidence; | 70 entry.confidence; |
| 70 | 71 |
| 71 databaseSection.appendChild(row); | 72 databaseSection.appendChild(row); |
| 72 } | 73 } |
| 73 } | 74 } |
| 74 $('countBanner').textContent = 'Entries: ' + databaseSection.children.length; | 75 $('countBanner').textContent = 'Entries: ' + databaseSection.children.length; |
| 75 } | 76 } |
| 76 | 77 |
| 77 document.addEventListener('DOMContentLoaded', | 78 document.addEventListener( |
| 78 requestAutocompleteActionPredictorDb); | 79 'DOMContentLoaded', requestAutocompleteActionPredictorDb); |
| OLD | NEW |