OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @typedef {{ | 6 * @typedef {{ |
7 * default_handler: number, | 7 * default_handler: number, |
8 * handlers: Array, | 8 * handlers: Array, |
9 * has_policy_recommendations: boolean, | 9 * has_policy_recommendations: boolean, |
10 * is_default_handler_set_by_user: boolean, | 10 * is_default_handler_set_by_user: boolean, |
(...skipping 10 matching lines...) Expand all Loading... |
21 ///////////////////////////////////////////////////////////////////////////// | 21 ///////////////////////////////////////////////////////////////////////////// |
22 // HandlerOptions class: | 22 // HandlerOptions class: |
23 | 23 |
24 /** | 24 /** |
25 * Encapsulated handling of handler options page. | 25 * Encapsulated handling of handler options page. |
26 * @constructor | 26 * @constructor |
27 * @extends {cr.ui.pageManager.Page} | 27 * @extends {cr.ui.pageManager.Page} |
28 */ | 28 */ |
29 function HandlerOptions() { | 29 function HandlerOptions() { |
30 this.activeNavTab = null; | 30 this.activeNavTab = null; |
31 Page.call(this, | 31 Page.call( |
32 'handlers', | 32 this, 'handlers', loadTimeData.getString('handlersPageTabTitle'), |
33 loadTimeData.getString('handlersPageTabTitle'), | 33 'handler-options'); |
34 'handler-options'); | |
35 } | 34 } |
36 | 35 |
37 cr.addSingletonGetter(HandlerOptions); | 36 cr.addSingletonGetter(HandlerOptions); |
38 | 37 |
39 HandlerOptions.prototype = { | 38 HandlerOptions.prototype = { |
40 __proto__: Page.prototype, | 39 __proto__: Page.prototype, |
41 | 40 |
42 /** | 41 /** |
43 * The handlers list. | 42 * The handlers list. |
44 * @type {options.HandlersList} | 43 * @type {options.HandlersList} |
(...skipping 16 matching lines...) Expand all Loading... |
61 * @private | 60 * @private |
62 */ | 61 */ |
63 createHandlersList_: function() { | 62 createHandlersList_: function() { |
64 var handlersList = $('handlers-list'); | 63 var handlersList = $('handlers-list'); |
65 options.HandlersList.decorate(handlersList); | 64 options.HandlersList.decorate(handlersList); |
66 this.handlersList_ = assertInstanceof(handlersList, options.HandlersList); | 65 this.handlersList_ = assertInstanceof(handlersList, options.HandlersList); |
67 this.handlersList_.autoExpands = true; | 66 this.handlersList_.autoExpands = true; |
68 | 67 |
69 var ignoredHandlersList = $('ignored-handlers-list'); | 68 var ignoredHandlersList = $('ignored-handlers-list'); |
70 options.IgnoredHandlersList.decorate(ignoredHandlersList); | 69 options.IgnoredHandlersList.decorate(ignoredHandlersList); |
71 this.ignoredHandlersList_ = assertInstanceof(ignoredHandlersList, | 70 this.ignoredHandlersList_ = |
72 options.IgnoredHandlersList); | 71 assertInstanceof(ignoredHandlersList, options.IgnoredHandlersList); |
73 this.ignoredHandlersList_.autoExpands = true; | 72 this.ignoredHandlersList_.autoExpands = true; |
74 }, | 73 }, |
75 }; | 74 }; |
76 | 75 |
77 /** | 76 /** |
78 * Sets the list of handlers shown by the view. | 77 * Sets the list of handlers shown by the view. |
79 * @param {Array<Handlers>} handlers Handlers to be shown in the view. | 78 * @param {Array<Handlers>} handlers Handlers to be shown in the view. |
80 */ | 79 */ |
81 HandlerOptions.setHandlers = function(handlers) { | 80 HandlerOptions.setHandlers = function(handlers) { |
82 $('handlers-list').setHandlers(handlers); | 81 $('handlers-list').setHandlers(handlers); |
83 }; | 82 }; |
84 | 83 |
85 /** | 84 /** |
86 * Sets the list of ignored handlers shown by the view. | 85 * Sets the list of ignored handlers shown by the view. |
87 * @param {Array} handlers Handlers to be shown in the view. | 86 * @param {Array} handlers Handlers to be shown in the view. |
88 */ | 87 */ |
89 HandlerOptions.setIgnoredHandlers = function(handlers) { | 88 HandlerOptions.setIgnoredHandlers = function(handlers) { |
90 $('ignored-handlers-section').hidden = handlers.length == 0; | 89 $('ignored-handlers-section').hidden = handlers.length == 0; |
91 $('ignored-handlers-list').setHandlers(handlers); | 90 $('ignored-handlers-list').setHandlers(handlers); |
92 }; | 91 }; |
93 | 92 |
94 return { | 93 return {HandlerOptions: HandlerOptions}; |
95 HandlerOptions: HandlerOptions | |
96 }; | |
97 }); | 94 }); |
OLD | NEW |