Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(664)

Side by Side Diff: chrome/browser/resources/predictors/autocomplete_action_predictor.js

Issue 10416002: Seculative resource prefetching for URLs CL. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Resolving conflicts. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 console.debug('Requesting NAP DB');
10 chrome.send('requestAutocompleteActionPredictorDb'); 9 chrome.send('requestAutocompleteActionPredictorDb');
11 } 10 }
12 11
13
14 /** 12 /**
15 * Callback from backend with the database contents. Sets up some globals and 13 * Callback from backend with the database contents. Sets up some globals and
16 * calls to create the UI. 14 * calls to create the UI.
17 * @param {Dictionary} database Information about AutocompleteActionPredictor 15 * @param {Dictionary} database Information about AutocompleteActionPredictor
18 * including the database as a flattened list, a boolean indicating if the 16 * including the database as a flattened list, a boolean indicating if the
19 * system is enabled and the current hit weight. 17 * system is enabled and the current hit weight.
20 */ 18 */
21 function updateDatabaseTable(database) { 19 function updateAutocompleteActionPredictorDb(database) {
22 console.debug('Updating Table NAP DB'); 20 console.debug('Updating Table NAP DB');
23 21
24 var filter = $('filter'); 22 var filter = $('filter');
25 filter.disabled = false; 23 filter.disabled = false;
26 filter.onchange = function() { 24 filter.onchange = function() {
27 updateDatabaseView(database); 25 updateAutocompleteActionPredictorDbView(database);
28 }; 26 };
29 27
30 updateDatabaseView(database); 28 updateAutocompleteActionPredictorDbView(database);
31 } 29 }
32 30
33 /** 31 /**
34 * Updates the table from the database. 32 * Updates the table from the database.
35 * @param {Dictionary} database Information about AutocompleteActionPredictor 33 * @param {Dictionary} database Information about AutocompleteActionPredictor
36 * including the database as a flattened list, a boolean indicating if the 34 * including the database as a flattened list, a boolean indicating if the
37 * system is enabled and the current hit weight. 35 * system is enabled and the current hit weight.
38 */ 36 */
39 function updateDatabaseView(database) { 37 function updateAutocompleteActionPredictorDbView(database) {
40 var databaseSection = $('databaseTableBody'); 38 var databaseSection = $('databaseTableBody');
41 var showEnabled = database.enabled && database.db; 39 var showEnabled = database.enabled && database.db;
42 40
43 $('enabledMode').hidden = !showEnabled; 41 $('autocompleteActionPredictorEnabledMode').hidden = !showEnabled;
44 $('disabledMode').hidden = showEnabled; 42 $('autocompleteActionPredictorDisabledMode').hidden = showEnabled;
45 43
46 if (!showEnabled) 44 if (!showEnabled)
47 return; 45 return;
48 46
49 var filter = $('filter'); 47 var filter = $('filter');
50 48
51 // Clear any previous list. 49 // Clear any previous list.
52 databaseSection.textContent = ''; 50 databaseSection.textContent = '';
53 51
54 for (var i = 0; i < database.db.length; ++i) { 52 for (var i = 0; i < database.db.length; ++i) {
(...skipping 12 matching lines...) Expand all
67 entry.hit_count; 65 entry.hit_count;
68 row.appendChild(document.createElement('td')).textContent = 66 row.appendChild(document.createElement('td')).textContent =
69 entry.miss_count; 67 entry.miss_count;
70 row.appendChild(document.createElement('td')).textContent = 68 row.appendChild(document.createElement('td')).textContent =
71 entry.confidence; 69 entry.confidence;
72 70
73 databaseSection.appendChild(row); 71 databaseSection.appendChild(row);
74 } 72 }
75 } 73 }
76 $('countBanner').textContent = 'Entries: ' + databaseSection.children.length; 74 $('countBanner').textContent = 'Entries: ' + databaseSection.children.length;
75 $('countBanner').textContent += ' Hit Weight: ' + database.hit_weight;
77 } 76 }
78 77
79 document.addEventListener('DOMContentLoaded', 78 document.addEventListener('DOMContentLoaded',
80 requestAutocompleteActionPredictorDb); 79 requestAutocompleteActionPredictorDb);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698