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

Side by Side Diff: chrome/browser/resources/options2/settings_dialog.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
« no previous file with comments | « chrome/browser/resources/options2/pref_ui.js ('k') | chrome/browser/ui/browser_init.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * @fileoverview Base class for dialogs that require saving preferences on 6 * @fileoverview Base class for dialogs that require saving preferences on
7 * confirm and resetting preference inputs on cancel. 7 * confirm and resetting preference inputs on cancel.
8 */ 8 */
9 9
10 cr.define('options', function() { 10 cr.define('options', function() {
(...skipping 24 matching lines...) Expand all
35 initializePage: function() { 35 initializePage: function() {
36 this.okButton.onclick = this.handleConfirm_.bind(this); 36 this.okButton.onclick = this.handleConfirm_.bind(this);
37 this.cancelButton.onclick = this.handleCancel_.bind(this); 37 this.cancelButton.onclick = this.handleCancel_.bind(this);
38 }, 38 },
39 39
40 /** 40 /**
41 * Handles the confirm button by saving the dialog preferences. 41 * Handles the confirm button by saving the dialog preferences.
42 * @private 42 * @private
43 */ 43 */
44 handleConfirm_: function() { 44 handleConfirm_: function() {
45 this.willConfirm();
45 OptionsPage.closeOverlay(); 46 OptionsPage.closeOverlay();
46 47
47 var els = this.pageDiv.querySelectorAll('[dialog-pref]'); 48 var els = this.pageDiv.querySelectorAll('[dialog-pref]');
48 for (var i = 0; i < els.length; i++) { 49 for (var i = 0; i < els.length; i++) {
49 if (els[i].savePrefState) 50 if (els[i].savePrefState)
50 els[i].savePrefState(); 51 els[i].savePrefState();
51 } 52 }
52 }, 53 },
53 54
54 /** 55 /**
55 * Handles the cancel button by closing the overlay. 56 * Handles the cancel button by closing the overlay.
56 * @private 57 * @private
57 */ 58 */
58 handleCancel_: function() { 59 handleCancel_: function() {
60 this.willCancel();
59 OptionsPage.closeOverlay(); 61 OptionsPage.closeOverlay();
60 62
61 var els = this.pageDiv.querySelectorAll('[dialog-pref]'); 63 var els = this.pageDiv.querySelectorAll('[dialog-pref]');
62 for (var i = 0; i < els.length; i++) { 64 for (var i = 0; i < els.length; i++) {
63 if (els[i].resetPrefState) 65 if (els[i].resetPrefState)
64 els[i].resetPrefState(); 66 els[i].resetPrefState();
65 } 67 }
66 }, 68 },
69
70 /**
71 * Called when the user clicks the confirm button, just before the
72 * preferences are saved. This is a no-op, but subclasses can override it.
73 */
74 willConfirm: function() {},
75
76 /**
77 * Called when the user cancels the dialog, just before the
78 * dialog is closed. This is a no-op, but subclasses can override it.
79 */
80 willCancel: function() {},
67 }; 81 };
68 82
69 return { 83 return {
70 SettingsDialog: SettingsDialog 84 SettingsDialog: SettingsDialog
71 }; 85 };
72 }); 86 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options2/pref_ui.js ('k') | chrome/browser/ui/browser_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698