1 // Copyright (c) 2012 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 /** @const */ var OptionsPage = options.OptionsPage;
8 /////////////////////////////////////////////////////////////////////////////
9 // HandlerOptions class:
12 * Encapsulated handling of handler options page.
15 function HandlerOptions() {
16 this.activeNavTab = null;
17 OptionsPage.call(this,
19 loadTimeData.getString('handlersPageTabTitle'),
23 cr.addSingletonGetter(HandlerOptions);
25 HandlerOptions.prototype = {
26 __proto__: OptionsPage.prototype,
30 * @type {DeletableItemList}
36 initializePage: function() {
37 OptionsPage.prototype.initializePage.call(this);
39 this.createHandlersList_();
41 $('handler-options-overlay-confirm').onclick =
42 OptionsPage.closeOverlay.bind(OptionsPage);
46 * Creates, decorates and initializes the handlers list.
49 createHandlersList_: function() {
50 this.handlersList_ = $('handlers-list');
51 options.HandlersList.decorate(this.handlersList_);
52 this.handlersList_.autoExpands = true;
54 this.ignoredHandlersList_ = $('ignored-handlers-list');
55 options.IgnoredHandlersList.decorate(this.ignoredHandlersList_);
56 this.ignoredHandlersList_.autoExpands = true;
61 * Sets the list of handlers shown by the view.
62 * @param {Array} Handlers to be shown in the view.
64 HandlerOptions.setHandlers = function(handlers) {
65 $('handlers-list').setHandlers(handlers);
69 * Sets the list of ignored handlers shown by the view.
70 * @param {Array} Handlers to be shown in the view.
72 HandlerOptions.setIgnoredHandlers = function(handlers) {
73 $('ignored-handlers-section').hidden = handlers.length == 0;
74 $('ignored-handlers-list').setHandlers(handlers);
78 HandlerOptions: HandlerOptions