summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/settings/reset_page/reset_profile_dialog.js
blob: b639054e66ca1faf2ddc9fe6ab6e9ab3a6d58aa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright 2015 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.

/**
 * @fileoverview
 * 'settings-reset-profile-dialog' is the dialog shown for clearing profile
 * settings.
 *
 * @group Chrome Settings Elements
 * @element settings-reset-profile-dialog
 */
Polymer({
  is: 'settings-reset-profile-dialog',

  properties: {
    feedbackInfo_: String,
  },

  attached: function() {
    cr.define('SettingsResetPage', function() {
      return {
        doneResetting: function() {
          this.$.resetSpinner.active = false;
          this.$.dialog.close();
          this.dispatchResetDoneEvent();
        }.bind(this),

        setFeedbackInfo: function(data) {
          this.set('feedbackInfo_', data.feedbackInfo);
          this.async(function() {
            this.$.dialog.center();
          });
        }.bind(this),
      };
    }.bind(this));
  },

  dispatchResetDoneEvent: function() {
    this.dispatchEvent(new CustomEvent('reset-done'));
  },

  open: function() {
    this.$.dialog.open();
    chrome.send('onShowResetProfileDialog');
  },

  /** @private */
  onCancelTap_: function() {
    this.$.dialog.close();
    chrome.send('onHideResetProfileDialog');
  },

  /** @private */
  onResetTap_: function() {
    this.$.resetSpinner.active = true;
    chrome.send('performResetProfileSettings', [this.$.sendSettings.checked]);
  },

  /** @private */
  onSendSettingsChange_: function() {
    // TODO(dpapad): Update how settings info is surfaced when final mocks
    // exist.
    this.$.settings.hidden = !this.$.sendSettings.checked;
    this.$.dialog.center();
  },
});