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 Page = cr.ui.pageManager.Page;
8 var AutomaticSettingsResetBanner = options.AutomaticSettingsResetBanner;
9 var ResetProfileSettingsBanner = options.ResetProfileSettingsBanner;
12 * ResetProfileSettingsOverlay class
13 * Encapsulated handling of the 'Reset Profile Settings' overlay page.
16 function ResetProfileSettingsOverlay() {
17 Page.call(this, 'resetProfileSettings',
18 loadTimeData.getString('resetProfileSettingsOverlayTabTitle'),
19 'reset-profile-settings-overlay');
22 cr.addSingletonGetter(ResetProfileSettingsOverlay);
24 ResetProfileSettingsOverlay.prototype = {
25 // Inherit ResetProfileSettingsOverlay from Page.
26 __proto__: Page.prototype,
29 initializePage: function() {
30 Page.prototype.initializePage.call(this);
32 $('reset-profile-settings-dismiss').onclick = function(e) {
33 ResetProfileSettingsOverlay.dismiss();
35 $('reset-profile-settings-commit').onclick = function(e) {
36 ResetProfileSettingsOverlay.setResettingState(true);
37 chrome.send('performResetProfileSettings',
38 [$('send-settings').checked]);
40 $('expand-feedback').onclick = function(e) {
41 var feedbackTemplate = $('feedback-template');
42 feedbackTemplate.hidden = !feedbackTemplate.hidden;
49 * @suppress {checkTypes}
50 * TODO(vitalyp): remove the suppression. See the explanation in
51 * chrome/browser/resources/options/automatic_settings_reset_banner.js.
53 didShowPage: function() {
54 ResetProfileSettingsBanner.dismiss();
55 chrome.send('onShowResetProfileDialog');
59 didClosePage: function() {
60 chrome.send('onHideResetProfileDialog');
65 * Enables/disables UI elements after/while Chrome is performing a reset.
66 * @param {boolean} state If true, UI elements are disabled.
68 ResetProfileSettingsOverlay.setResettingState = function(state) {
69 $('reset-profile-settings-throbber').style.visibility =
70 state ? 'visible' : 'hidden';
71 $('reset-profile-settings-dismiss').disabled = state;
72 $('reset-profile-settings-commit').disabled = state;
76 * Chrome callback to notify ResetProfileSettingsOverlay that the reset
77 * operation has terminated.
78 * @suppress {checkTypes}
79 * TODO(vitalyp): remove the suppression. See the explanation in
80 * chrome/browser/resources/options/automatic_settings_reset_banner.js.
82 ResetProfileSettingsOverlay.doneResetting = function() {
83 AutomaticSettingsResetBanner.dismiss();
84 ResetProfileSettingsOverlay.dismiss();
88 * Dismisses the overlay.
90 ResetProfileSettingsOverlay.dismiss = function() {
91 PageManager.closeOverlay();
92 ResetProfileSettingsOverlay.setResettingState(false);
95 ResetProfileSettingsOverlay.setFeedbackInfo = function(feedbackListData) {
96 var input = new JsEvalContext(feedbackListData);
97 var output = $('feedback-template');
98 jstProcess(input, output);
103 ResetProfileSettingsOverlay: ResetProfileSettingsOverlay