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

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

Issue 9610006: Refactoring, moving and renaming the NetworkActionPredictor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Resolved sync conflicts. Created 8 years, 7 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 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 AutocompleteActionPredictor
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 24 matching lines...) Expand all
70 row.appendChild(document.createElement('td')).textContent = 70 row.appendChild(document.createElement('td')).textContent =
71 entry.confidence; 71 entry.confidence;
72 72
73 databaseSection.appendChild(row); 73 databaseSection.appendChild(row);
74 } 74 }
75 } 75 }
76 $('countBanner').textContent = 'Entries: ' + databaseSection.children.length; 76 $('countBanner').textContent = 'Entries: ' + databaseSection.children.length;
77 $('countBanner').textContent += ' Hit Weight: ' + database.hit_weight; 77 $('countBanner').textContent += ' Hit Weight: ' + database.hit_weight;
78 } 78 }
79 79
80 document.addEventListener('DOMContentLoaded', requestNetworkActionPredictorDb); 80 document.addEventListener('DOMContentLoaded',
81 81 requestAutocompleteActionPredictorDb);
82
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698