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.
7 * default_handler: number,
9 * has_policy_recommendations: boolean,
10 * is_default_handler_set_by_user: boolean,
13 * @see chrome/browser/ui/webui/options/handler_options_handler.cc
17 cr.define('options', function() {
18 /** @const */ var Page = cr.ui.pageManager.Page;
19 /** @const */ var PageManager = cr.ui.pageManager.PageManager;
21 /////////////////////////////////////////////////////////////////////////////
22 // HandlerOptions class:
25 * Encapsulated handling of handler options page.
27 * @extends {cr.ui.pageManager.Page}
29 function HandlerOptions() {
30 this.activeNavTab = null;
33 loadTimeData.getString('handlersPageTabTitle'),
37 cr.addSingletonGetter(HandlerOptions);
39 HandlerOptions.prototype = {
40 __proto__: Page.prototype,
44 * @type {options.HandlersList}
50 initializePage: function() {
51 Page.prototype.initializePage.call(this);
53 this.createHandlersList_();
55 $('handler-options-overlay-confirm').onclick =
56 PageManager.closeOverlay.bind(PageManager);
60 * Creates, decorates and initializes the handlers list.
63 createHandlersList_: function() {
64 var handlersList = $('handlers-list');
65 options.HandlersList.decorate(handlersList);
66 this.handlersList_ = assertInstanceof(handlersList, options.HandlersList);
67 this.handlersList_.autoExpands = true;
69 var ignoredHandlersList = $('ignored-handlers-list');
70 options.IgnoredHandlersList.decorate(ignoredHandlersList);
71 this.ignoredHandlersList_ = assertInstanceof(ignoredHandlersList,
72 options.IgnoredHandlersList);
73 this.ignoredHandlersList_.autoExpands = true;
78 * Sets the list of handlers shown by the view.
79 * @param {Array<Handlers>} handlers Handlers to be shown in the view.
81 HandlerOptions.setHandlers = function(handlers) {
82 $('handlers-list').setHandlers(handlers);
86 * Sets the list of ignored handlers shown by the view.
87 * @param {Array} handlers Handlers to be shown in the view.
89 HandlerOptions.setIgnoredHandlers = function(handlers) {
90 $('ignored-handlers-section').hidden = handlers.length == 0;
91 $('ignored-handlers-list').setHandlers(handlers);
95 HandlerOptions: HandlerOptions