Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / resources / options / handler_options.js
bloba01261f199f9fad9bc2582dcd4e843d813078078
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 /**
6 * @typedef {{
7 * default_handler: number,
8 * handlers: Array,
9 * has_policy_recommendations: boolean,
10 * is_default_handler_set_by_user: boolean,
11 * protocol: string
12 * }}
13 * @see chrome/browser/ui/webui/options/handler_options_handler.cc
15 var Handlers;
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:
24 /**
25 * Encapsulated handling of handler options page.
26 * @constructor
27 * @extends {cr.ui.pageManager.Page}
29 function HandlerOptions() {
30 this.activeNavTab = null;
31 Page.call(this,
32 'handlers',
33 loadTimeData.getString('handlersPageTabTitle'),
34 'handler-options');
37 cr.addSingletonGetter(HandlerOptions);
39 HandlerOptions.prototype = {
40 __proto__: Page.prototype,
42 /**
43 * The handlers list.
44 * @type {options.HandlersList}
45 * @private
47 handlersList_: null,
49 /** @override */
50 initializePage: function() {
51 Page.prototype.initializePage.call(this);
53 this.createHandlersList_();
55 $('handler-options-overlay-confirm').onclick =
56 PageManager.closeOverlay.bind(PageManager);
59 /**
60 * Creates, decorates and initializes the handlers list.
61 * @private
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;
77 /**
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);
85 /**
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);
94 return {
95 HandlerOptions: HandlerOptions
97 });