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

Unified Diff: chrome/browser/resources/instant/instant.js

Issue 10933023: Control zero suggest with a pref, not a switch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for clang compile error. Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | chrome/browser/ui/webui/instant_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/instant/instant.js
diff --git a/chrome/browser/resources/instant/instant.js b/chrome/browser/resources/instant/instant.js
index 8fa494bb6d372f94c5c32d2ed728d3311a192edf..3abe0661217196eada90f651db486f824a2493a1 100644
--- a/chrome/browser/resources/instant/instant.js
+++ b/chrome/browser/resources/instant/instant.js
@@ -19,8 +19,16 @@ var instantConfig = (function() {
{
key: 'instant.animation_scale_factor',
label: 'Slow down animations by a factor of',
+ type: 'float',
units: 'no units, range 1 to 10',
default: 1
+ },
+ {
+ key: 'instant.experimental_zero_suggest_url_prefix',
+ label: 'Prefix URL for the (experimental) ZeroSuggest provider',
+ type: 'string',
+ units: '',
+ default: ''
}
];
@@ -52,13 +60,17 @@ var instantConfig = (function() {
row.appendChild(label);
var input = createElementWithClass('input', 'row-input');
- input.type = 'number';
- input.size = 3;
input.id = field.key;
- input.min = field.min || 0;
input.title = "Default Value: " + field.default;
- if (field.max) input.max = field.max;
- if (field.step) input.step = field.step;
+ if (field.type == 'float') {
+ input.size = 3;
+ input.type = 'number';
+ input.min = field.min || 0;
+ if (field.max) input.max = field.max;
+ if (field.step) input.step = field.step;
+ } else {
+ input.size = 40;
+ }
row.appendChild(input);
var units = createElementWithClass('div', 'row-units');
@@ -107,9 +119,7 @@ var instantConfig = (function() {
* @param {value} value The value to be associated with prefName.
*/
function setPreferenceValue(prefName, value) {
- chrome.send(
- 'setPreferenceValue',
- [prefName, parseFloat(value)]);
+ chrome.send('setPreferenceValue', [prefName, value]);
}
/**
@@ -131,7 +141,9 @@ var instantConfig = (function() {
function onSave() {
for (var i = 0; i < FIELDS.length; i++) {
var field = FIELDS[i];
- setPreferenceValue(field.key, $(field.key).value);
+ var value = $(field.key).value;
+ setPreferenceValue(
+ field.key, (field.type == 'float') ? parseFloat(value) : value);
}
return false;
}
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | chrome/browser/ui/webui/instant_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698