1// Copyright (c) 2011 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.
4
5cr.define('options', function() {
6  var OptionsPage = options.OptionsPage;
7
8  function InstantConfirmOverlay() {
9    OptionsPage.call(this, 'instantConfirm',
10                     templateData.instantConfirmTitle,
11                     'instantConfirmOverlay');
12  };
13
14  cr.addSingletonGetter(InstantConfirmOverlay);
15
16  InstantConfirmOverlay.prototype = {
17    // Inherit from OptionsPage.
18    __proto__: OptionsPage.prototype,
19
20    initializePage: function() {
21      OptionsPage.prototype.initializePage.call(this);
22
23      $('instantConfirmCancel').onclick = function() {
24        OptionsPage.closeOverlay();
25      };
26      $('instantConfirmOk').onclick = function() {
27        OptionsPage.closeOverlay();
28        Preferences.setBooleanPref('instant.confirm_dialog_shown', true);
29        var instantEnabledCheckbox = $('instantEnableCheckbox');
30        Preferences.setBooleanPref(instantEnableCheckbox.pref, true,
31                                   instantEnableCheckbox.metric);
32      };
33    },
34  };
35
36  // Export
37  return {
38    InstantConfirmOverlay: InstantConfirmOverlay
39  };
40});
41