summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/options/instant_confirm_overlay.js
blob: 6cadd5c30a22de1efaa631c98ec239ede29314ae (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
// 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 SettingsDialog = options.SettingsDialog;

  /*
   * InstantConfirmOverlay class
   * Dialog to confirm that the user really wants to enable Chrome Instant.
   * @extends {SettingsDialog}
   */
  function InstantConfirmOverlay() {
    SettingsDialog.call(this,
                        'instantConfirm',
                        loadTimeData.getString('instantConfirmTitle'),
                        'instantConfirmOverlay',
                        $('instantConfirmOk'),
                        $('instantConfirmCancel'));
  };

  cr.addSingletonGetter(InstantConfirmOverlay);

  InstantConfirmOverlay.prototype = {
    __proto__: SettingsDialog.prototype,

    /** @inheritDoc */
    initializePage: function() {
      SettingsDialog.prototype.initializePage.call(this);
    },

    /** @inheritDoc */
    handleConfirm: function() {
      SettingsDialog.prototype.handleConfirm.call(this);
      Preferences.setBooleanPref('instant.confirm_dialog_shown', true);
      Preferences.setBooleanPref('instant.enabled', true);
    },

    /** @inheritDoc */
    handleCancel: function() {
      SettingsDialog.prototype.handleCancel.call(this);
      $('instant-enabled-control').checked = false;
    },
  };

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