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

Side by Side Diff: chrome/browser/resources/options2/home_page_overlay.js

Issue 9296038: [uber] Redoing the homepage selection UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 10 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 | Annotate | Revision Log
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 cr.define('options', function() { 5 cr.define('options', function() {
6 const OptionsPage = options.OptionsPage; 6 const OptionsPage = options.OptionsPage;
7 const SettingsDialog = options.SettingsDialog; 7 const SettingsDialog = options.SettingsDialog;
8 8
9 /** 9 /**
10 * HomePageOverlay class 10 * HomePageOverlay class
(...skipping 11 matching lines...) Expand all
22 __proto__: SettingsDialog.prototype, 22 __proto__: SettingsDialog.prototype,
23 23
24 /** 24 /**
25 * Initialize the page. 25 * Initialize the page.
26 */ 26 */
27 initializePage: function() { 27 initializePage: function() {
28 // Call base class implementation to start preference initialization. 28 // Call base class implementation to start preference initialization.
29 SettingsDialog.prototype.initializePage.call(this); 29 SettingsDialog.prototype.initializePage.call(this);
30 30
31 var self = this; 31 var self = this;
32 $('homepage-use-ntp').onchange = this.updateHomePageInput_.bind(this);
33 $('homepage-use-url').onchange = this.updateHomePageInput_.bind(this);
34
35 $('homepageURL').addEventListener('keydown', function(event) { 32 $('homepageURL').addEventListener('keydown', function(event) {
36 // Focus the 'OK' button when the user hits enter since people expect 33 // Focus the 'OK' button when the user hits enter since people expect
37 // feedback indicating that they are done editing. 34 // feedback indicating that they are done editing.
38 if (event.keyIdentifier == 'Enter') 35 if (event.keyIdentifier == 'Enter')
39 $('home-page-confirm').focus(); 36 $('home-page-confirm').focus();
40 }); 37 });
41 38
42 // TODO(jhawkins): Refactor BrowserOptions.autocompleteList and use it 39 // TODO(jhawkins): Refactor BrowserOptions.autocompleteList and use it
43 // here. 40 // here.
44 }, 41 },
45 42
46 /** 43 /**
47 * @inheritDoc 44 * Sets the 'show home button' and 'home page is new tab page' preferences.
45 * (The home page url preference is set automatically by the SettingsDialog
46 * code.)
48 */ 47 */
49 didShowPage: function() { 48 willConfirm: function() {
50 // Set initial state. 49 Preferences.setBooleanPref('browser.show_home_button', true);
51 this.updateHomePageInput_(); 50 Preferences.setBooleanPref('homepage_is_newtabpage', false);
52 }, 51 },
53 52
54 /** 53 /**
55 * Updates the state of the homepage text input. The input is enabled only 54 * Resets the <select> on the browser options page to the appropriate value,
56 * if the |homepageUseURLBUtton| radio is checked. 55 * based on the current preferences.
57 * @private
58 */ 56 */
59 updateHomePageInput_: function() { 57 willCancel: function() {
60 var homepageInput = $('homepageURL'); 58 BrowserOptions.getInstance().updateHomePageSelector();
61 var homepageUseURL = $('homepage-use-url');
62 homepageInput.setDisabled('radio-choice', !homepageUseURL.checked);
63 }, 59 },
64 }; 60 };
65 61
66 // Export 62 // Export
67 return { 63 return {
68 HomePageOverlay: HomePageOverlay 64 HomePageOverlay: HomePageOverlay
69 }; 65 };
70 }); 66 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options2/home_page_overlay.html ('k') | chrome/browser/resources/options2/options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698