1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 cr.define('options', function() {
6 var OptionsPage = options.OptionsPage;
7 var ResetProfileSettingsBanner = options.ResetProfileSettingsBanner;
10 * ResetProfileSettingsOverlay class
11 * Encapsulated handling of the 'Reset Profile Settings' overlay page.
14 function ResetProfileSettingsOverlay() {
16 this, 'resetProfileSettings',
17 loadTimeData.getString('resetProfileSettingsOverlayTabTitle'),
18 'reset-profile-settings-overlay');
21 cr.addSingletonGetter(ResetProfileSettingsOverlay);
23 ResetProfileSettingsOverlay.prototype = {
24 // Inherit ResetProfileSettingsOverlay from OptionsPage.
25 __proto__: OptionsPage.prototype,
28 * Initialize the page.
30 initializePage: function() {
31 OptionsPage.prototype.initializePage.call(this);
33 $('reset-profile-settings-dismiss').onclick = function(event) {
34 ResetProfileSettingsOverlay.dismiss();
36 $('reset-profile-settings-commit').onclick = function(event) {
37 ResetProfileSettingsOverlay.setResettingState(true);
38 chrome.send('performResetProfileSettings',
39 [$('send-settings').checked]);
41 $('expand-feedback').onclick = function(event) {
42 var feedbackTemplate = $('feedback-template');
43 feedbackTemplate.hidden = !feedbackTemplate.hidden;
48 didShowPage: function() {
49 ResetProfileSettingsBanner.dismiss();
50 chrome.send('onShowResetProfileDialog');
55 * Enables/disables UI elements after/while Chrome is performing a reset.
56 * @param {boolean} state If true, UI elements are disabled.
58 ResetProfileSettingsOverlay.setResettingState = function(state) {
59 $('reset-profile-settings-throbber').style.visibility =
60 state ? 'visible' : 'hidden';
61 $('reset-profile-settings-dismiss').disabled = state;
62 $('reset-profile-settings-commit').disabled = state;
66 * Chrome callback to notify ResetProfileSettingsOverlay that the reset
67 * operation has terminated.
69 ResetProfileSettingsOverlay.doneResetting = function() {
70 // The delay gives the user some feedback that the resetting
71 // actually worked. Otherwise the dialog just vanishes instantly in most
73 window.setTimeout(function() {
74 ResetProfileSettingsOverlay.dismiss();
79 * Dismisses the overlay.
81 ResetProfileSettingsOverlay.dismiss = function() {
82 OptionsPage.closeOverlay();
83 ResetProfileSettingsOverlay.setResettingState(false);
86 ResetProfileSettingsOverlay.setFeedbackInfo = function(feedbackListData) {
87 var input = new JsEvalContext(feedbackListData);
88 var output = $('feedback-template');
89 jstProcess(input, output);
94 ResetProfileSettingsOverlay: ResetProfileSettingsOverlay