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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 6 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
7 /** @const */ var List = cr.ui.List; | 7 /** @const */ var List = cr.ui.List; |
8 /** @const */ var ListItem = cr.ui.ListItem; | 8 /** @const */ var ListItem = cr.ui.ListItem; |
9 /** @const */ var DeletableItem = options.DeletableItem; | 9 /** @const */ var DeletableItem = options.DeletableItem; |
10 /** @const */ var DeletableItemList = options.DeletableItemList; | 10 /** @const */ var DeletableItemList = options.DeletableItemList; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 /** | 52 /** |
53 * @constructor | 53 * @constructor |
54 * @extends {options.DeletableItemList} | 54 * @extends {options.DeletableItemList} |
55 */ | 55 */ |
56 var IgnoredHandlersList = cr.ui.define('list'); | 56 var IgnoredHandlersList = cr.ui.define('list'); |
57 | 57 |
58 IgnoredHandlersList.prototype = { | 58 IgnoredHandlersList.prototype = { |
59 __proto__: DeletableItemList.prototype, | 59 __proto__: DeletableItemList.prototype, |
60 | 60 |
| 61 /** |
| 62 * @override |
| 63 * @param {Object} entry |
| 64 */ |
61 createItem: function(entry) { | 65 createItem: function(entry) { |
62 return new IgnoredHandlersListItem(entry); | 66 return new IgnoredHandlersListItem(entry); |
63 }, | 67 }, |
64 | 68 |
65 deleteItemAtIndex: function(index) { | 69 deleteItemAtIndex: function(index) { |
66 chrome.send('removeIgnoredHandler', [this.dataModel.item(index)]); | 70 chrome.send('removeIgnoredHandler', [this.dataModel.item(index)]); |
67 }, | 71 }, |
68 | 72 |
69 /** | 73 /** |
70 * The length of the list. | 74 * The length of the list. |
71 */ | 75 */ |
72 get length() { | 76 get length() { |
73 return this.dataModel.length; | 77 return this.dataModel.length; |
74 }, | 78 }, |
75 | 79 |
76 /** | 80 /** |
77 * Set the protocol handlers displayed by this list. See | 81 * Set the protocol handlers displayed by this list. See |
78 * IgnoredHandlersListItem for an example of the format the list should | 82 * IgnoredHandlersListItem for an example of the format the list should |
79 * take. | 83 * take. |
80 * | 84 * |
81 * @param {Object} list A list of ignored protocol handlers. | 85 * @param {!Array} list A list of ignored protocol handlers. |
82 */ | 86 */ |
83 setHandlers: function(list) { | 87 setHandlers: function(list) { |
84 this.dataModel = new ArrayDataModel(list); | 88 this.dataModel = new ArrayDataModel(list); |
85 }, | 89 }, |
86 }; | 90 }; |
87 | 91 |
88 /** | 92 /** |
89 * Creates a new protocol / content handler list item. | 93 * Creates a new protocol / content handler list item. |
90 * | 94 * |
91 * Accepts values in the form | 95 * Accepts values in the form |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 }, | 259 }, |
256 }; | 260 }; |
257 | 261 |
258 return { | 262 return { |
259 IgnoredHandlersListItem: IgnoredHandlersListItem, | 263 IgnoredHandlersListItem: IgnoredHandlersListItem, |
260 IgnoredHandlersList: IgnoredHandlersList, | 264 IgnoredHandlersList: IgnoredHandlersList, |
261 HandlerListItem: HandlerListItem, | 265 HandlerListItem: HandlerListItem, |
262 HandlersList: HandlersList, | 266 HandlersList: HandlersList, |
263 }; | 267 }; |
264 }); | 268 }); |
OLD | NEW |