summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/options/factory_reset_overlay.js
blob: 0a446488016cf73107aae4d3c184fe232b361ba2 (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
// Copyright (c) 2012 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.

cr.define('options', function() {
  var Page = cr.ui.pageManager.Page;
  var PageManager = cr.ui.pageManager.PageManager;

  /**
   * FactoryResetOverlay class
   * Encapsulated handling of the Factory Reset confirmation overlay page.
   * @class
   */
  function FactoryResetOverlay() {
    Page.call(this, 'factoryResetData',
              loadTimeData.getString('factoryResetTitle'),
              'factory-reset-overlay');
  }

  cr.addSingletonGetter(FactoryResetOverlay);

  FactoryResetOverlay.prototype = {
    // Inherit FactoryResetOverlay from Page.
    __proto__: Page.prototype,

    /** @override */
    initializePage: function() {
      Page.prototype.initializePage.call(this);

      $('factory-reset-data-dismiss').onclick = function(event) {
        FactoryResetOverlay.dismiss();
      };
      $('factory-reset-data-restart').onclick = function(event) {
        chrome.send('performFactoryResetRestart');
      };
    },
  };

  FactoryResetOverlay.dismiss = function() {
    PageManager.closeOverlay();
  };

  // Export
  return {
    FactoryResetOverlay: FactoryResetOverlay
  };
});