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 Page = cr.ui.pageManager.Page;
7 /** @const */ var PageManager = cr.ui.pageManager.PageManager;
9 /////////////////////////////////////////////////////////////////////////////
10 // HandlerOptions class:
13 * Encapsulated handling of handler options page.
16 function HandlerOptions() {
17 this.activeNavTab = null;
20 loadTimeData.getString('handlersPageTabTitle'),
24 cr.addSingletonGetter(HandlerOptions);
26 HandlerOptions.prototype = {
27 __proto__: Page.prototype,
31 * @type {options.HandlersList}
37 initializePage: function() {
38 Page.prototype.initializePage.call(this);
40 this.createHandlersList_();
42 $('handler-options-overlay-confirm').onclick =
43 PageManager.closeOverlay.bind(PageManager);
47 * Creates, decorates and initializes the handlers list.
50 createHandlersList_: function() {
51 this.handlersList_ = $('handlers-list');
52 options.HandlersList.decorate(this.handlersList_);
53 this.handlersList_.autoExpands = true;
55 this.ignoredHandlersList_ = $('ignored-handlers-list');
56 options.IgnoredHandlersList.decorate(this.ignoredHandlersList_);
57 this.ignoredHandlersList_.autoExpands = true;
62 * Sets the list of handlers shown by the view.
63 * @param {Array} Handlers to be shown in the view.
65 HandlerOptions.setHandlers = function(handlers) {
66 $('handlers-list').setHandlers(handlers);
70 * Sets the list of ignored handlers shown by the view.
71 * @param {Array} Handlers to be shown in the view.
73 HandlerOptions.setIgnoredHandlers = function(handlers) {
74 $('ignored-handlers-section').hidden = handlers.length == 0;
75 $('ignored-handlers-list').setHandlers(handlers);
79 HandlerOptions: HandlerOptions