summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-19 20:49:09 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-19 20:49:09 +0000
commit409fadfa6b5255c3392e94de04d9d366be1e5820 (patch)
tree758fc0dfb7cc29fd539c72633b1046529873a09e /chrome/browser/resources
parent058e7b76bcc68217ab69453ff514dff315690230 (diff)
downloadchromium_src-409fadfa6b5255c3392e94de04d9d366be1e5820.zip
chromium_src-409fadfa6b5255c3392e94de04d9d366be1e5820.tar.gz
chromium_src-409fadfa6b5255c3392e94de04d9d366be1e5820.tar.bz2
DOMUI Prefs: Improve saving of homepage pref.
- Adds oninput handling to live-save the homepage pref. I had avoided this before because I didn't want to pollute metrics, but this pref doesn't actually have a metric. (Also, if one is added, we can increment it only on the onchange events.) - Does URL fixup for onchange events (not oninput, because it would make typing impossible). BUG=69901,62851 TEST=Change the homepage to a non-canonical URL; it should be updated on blur to a full URL. On ChromeOS, power off the machine after changing the home page, but not blurring the field; it should be saved. Review URL: http://codereview.chromium.org/6332006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71835 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r--chrome/browser/resources/options/browser_options.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js
index 22a4595..d17d443 100644
--- a/chrome/browser/resources/options/browser_options.js
+++ b/chrome/browser/resources/options/browser_options.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -69,8 +69,8 @@ cr.define('options', function() {
this.handleHomepageUseNTPButtonChange_.bind(this);
$('homepageUseURLButton').onchange =
this.handleHomepageUseURLButtonChange_.bind(this);
- homepageField.onchange =
- this.handleHomepageURLChange_.bind(this);
+ homepageField.onchange = this.handleHomepageURLChange_.bind(this);
+ homepageField.oninput = this.handleHomepageURLChange_.bind(this);
// Ensure that changes are committed when closing the page.
window.addEventListener('unload', function() {
@@ -203,12 +203,13 @@ cr.define('options', function() {
},
/**
- * Handles change events of the text field 'homepageURL'.
+ * Handles input and change events of the text field 'homepageURL'.
* @private
- * @param {event} change event.
+ * @param {event} input/change event.
*/
handleHomepageURLChange_: function(event) {
- Preferences.setStringPref('homepage', $('homepageURL').value);
+ var doFixup = event.type == 'change' ? '1' : '0';
+ chrome.send('setHomePage', [$('homepageURL').value, doFixup]);
},
/**