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 /** | |
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 | |
14 */ | |
15 var HandlersValue; | |
Dan Beam
2014/09/11 21:42:48
nit: Handlers
Vitaly Pavlenko
2014/09/11 23:16:50
Done.
| |
16 | |
5 cr.define('options', function() { | 17 cr.define('options', function() { |
6 /** @const */ var Page = cr.ui.pageManager.Page; | 18 /** @const */ var Page = cr.ui.pageManager.Page; |
7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; | 19 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
8 | 20 |
9 ///////////////////////////////////////////////////////////////////////////// | 21 ///////////////////////////////////////////////////////////////////////////// |
10 // HandlerOptions class: | 22 // HandlerOptions class: |
11 | 23 |
12 /** | 24 /** |
13 * Encapsulated handling of handler options page. | 25 * Encapsulated handling of handler options page. |
14 * @constructor | 26 * @constructor |
27 * @extends {cr.ui.pageManager.Page} | |
15 */ | 28 */ |
16 function HandlerOptions() { | 29 function HandlerOptions() { |
17 this.activeNavTab = null; | 30 this.activeNavTab = null; |
18 Page.call(this, | 31 Page.call(this, |
19 'handlers', | 32 'handlers', |
20 loadTimeData.getString('handlersPageTabTitle'), | 33 loadTimeData.getString('handlersPageTabTitle'), |
21 'handler-options'); | 34 'handler-options'); |
22 } | 35 } |
23 | 36 |
24 cr.addSingletonGetter(HandlerOptions); | 37 cr.addSingletonGetter(HandlerOptions); |
(...skipping 16 matching lines...) Expand all Loading... | |
41 | 54 |
42 $('handler-options-overlay-confirm').onclick = | 55 $('handler-options-overlay-confirm').onclick = |
43 PageManager.closeOverlay.bind(PageManager); | 56 PageManager.closeOverlay.bind(PageManager); |
44 }, | 57 }, |
45 | 58 |
46 /** | 59 /** |
47 * Creates, decorates and initializes the handlers list. | 60 * Creates, decorates and initializes the handlers list. |
48 * @private | 61 * @private |
49 */ | 62 */ |
50 createHandlersList_: function() { | 63 createHandlersList_: function() { |
51 this.handlersList_ = $('handlers-list'); | 64 var handlersList = $('handlers-list'); |
52 options.HandlersList.decorate(this.handlersList_); | 65 options.HandlersList.decorate(handlersList); |
66 this.handlersList_ = assertInstanceof(handlersList, options.HandlersList); | |
53 this.handlersList_.autoExpands = true; | 67 this.handlersList_.autoExpands = true; |
54 | 68 |
55 this.ignoredHandlersList_ = $('ignored-handlers-list'); | 69 var ignoredHandlersList = $('ignored-handlers-list'); |
56 options.IgnoredHandlersList.decorate(this.ignoredHandlersList_); | 70 options.IgnoredHandlersList.decorate(ignoredHandlersList); |
71 this.ignoredHandlersList_ = assertInstanceof(ignoredHandlersList, | |
72 options.HandlersList); | |
57 this.ignoredHandlersList_.autoExpands = true; | 73 this.ignoredHandlersList_.autoExpands = true; |
58 }, | 74 }, |
59 }; | 75 }; |
60 | 76 |
61 /** | 77 /** |
62 * Sets the list of handlers shown by the view. | 78 * Sets the list of handlers shown by the view. |
63 * @param {Array} handlers Handlers to be shown in the view. | 79 * @param {Array.<HandlersValue>} handlers Handlers to be shown in the view. |
64 */ | 80 */ |
65 HandlerOptions.setHandlers = function(handlers) { | 81 HandlerOptions.setHandlers = function(handlers) { |
66 $('handlers-list').setHandlers(handlers); | 82 $('handlers-list').setHandlers(handlers); |
67 }; | 83 }; |
68 | 84 |
69 /** | 85 /** |
70 * Sets the list of ignored handlers shown by the view. | 86 * Sets the list of ignored handlers shown by the view. |
71 * @param {Array} handlers Handlers to be shown in the view. | 87 * @param {Array} handlers Handlers to be shown in the view. |
72 */ | 88 */ |
73 HandlerOptions.setIgnoredHandlers = function(handlers) { | 89 HandlerOptions.setIgnoredHandlers = function(handlers) { |
74 $('ignored-handlers-section').hidden = handlers.length == 0; | 90 $('ignored-handlers-section').hidden = handlers.length == 0; |
75 $('ignored-handlers-list').setHandlers(handlers); | 91 $('ignored-handlers-list').setHandlers(handlers); |
76 }; | 92 }; |
77 | 93 |
78 return { | 94 return { |
79 HandlerOptions: HandlerOptions | 95 HandlerOptions: HandlerOptions |
80 }; | 96 }; |
81 }); | 97 }); |
OLD | NEW |