Move Webstore URL concepts to //extensions and out
[chromium-blink-merge.git] / chrome / browser / resources / options / handler_options.js
blobdf2732ec43e9fdeb0455b718ffc13d0f51becbb0
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:
12 /**
13 * Encapsulated handling of handler options page.
14 * @constructor
16 function HandlerOptions() {
17 this.activeNavTab = null;
18 Page.call(this,
19 'handlers',
20 loadTimeData.getString('handlersPageTabTitle'),
21 'handler-options');
24 cr.addSingletonGetter(HandlerOptions);
26 HandlerOptions.prototype = {
27 __proto__: Page.prototype,
29 /**
30 * The handlers list.
31 * @type {options.HandlersList}
32 * @private
34 handlersList_: null,
36 /** @override */
37 initializePage: function() {
38 Page.prototype.initializePage.call(this);
40 this.createHandlersList_();
42 $('handler-options-overlay-confirm').onclick =
43 PageManager.closeOverlay.bind(PageManager);
46 /**
47 * Creates, decorates and initializes the handlers list.
48 * @private
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;
61 /**
62 * Sets the list of handlers shown by the view.
63 * @param {Array} handlers Handlers to be shown in the view.
65 HandlerOptions.setHandlers = function(handlers) {
66 $('handlers-list').setHandlers(handlers);
69 /**
70 * Sets the list of ignored handlers shown by the view.
71 * @param {Array} handlers 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);
78 return {
79 HandlerOptions: HandlerOptions
81 });