Chromium Code Reviews| Index: chrome/browser/resources/options/handler_options.js |
| diff --git a/chrome/browser/resources/options/handler_options.js b/chrome/browser/resources/options/handler_options.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..08caf30c6e2bbf51049de5f703c9264d3ffdd6b6 |
| --- /dev/null |
| +++ b/chrome/browser/resources/options/handler_options.js |
| @@ -0,0 +1,79 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +cr.define('options', function() { |
| + const OptionsPage = options.OptionsPage; |
| + |
| + ///////////////////////////////////////////////////////////////////////////// |
| + // HandlerOptions class: |
| + |
| + /** |
| + * Encapsulated handling of handler options page. |
| + * @constructor |
| + */ |
| + function HandlerOptions() { |
| + this.activeNavTab = null; |
| + OptionsPage.call(this, |
| + 'handlers', |
| + templateData.handlersPageTabTitle, |
| + 'handler-options'); |
| + } |
| + |
| + cr.addSingletonGetter(HandlerOptions); |
| + |
| + HandlerOptions.prototype = { |
| + __proto__: OptionsPage.prototype, |
| + |
| + /** |
| + * The handlers list. |
| + * @type {DeletableItemList} |
| + * @private |
| + */ |
| + handlersList_: null, |
| + |
| + /** @inheritDoc */ |
| + initializePage: function() { |
| + OptionsPage.prototype.initializePage.call(this); |
| + |
| + this.createHandlersList_(); |
| + }, |
| + |
| + /** |
| + * Creates, decorates and initializes the handlers list. |
| + * @private |
| + */ |
| + createHandlersList_: function() { |
| + this.handlersList_ = $('handlers-list'); |
| + options.HandlersList.decorate(this.handlersList_); |
| + this.handlersList_.autoExpands = true; |
| + }, |
| + }; |
| + |
| + /** |
| + * Call to remove a handler. |
|
Evan Stade
2011/05/19 17:08:42
describe what the function does ("Call to remove a
koz (OOO until 15th September)
2011/05/19 21:07:52
Done.
|
| + * @param rowIndex indicating the row to remove. |
| + */ |
| + HandlerOptions.removeHandler = function(index, handler) { |
| + chrome.send('removeHandler', [handler]); |
| + }; |
| + |
| + HandlerOptions.setDefault = function(handler) { |
|
Evan Stade
2011/05/19 17:08:42
function comment
koz (OOO until 15th September)
2011/05/19 21:07:52
I inilned this function as well.
|
| + chrome.send('setDefault', [handler]); |
| + }; |
| + |
| + /** |
| + * Sets the list of handlers shown by the view. |
| + * @param handlers to be shown in the view. |
| + */ |
| + HandlerOptions.setHandlers = function(handlers) { |
| + $('handlers-list').setHandlers(handlers); |
| + }; |
| + |
| + // Export |
| + return { |
| + HandlerOptions: HandlerOptions |
| + }; |
| + |
| +}); |
| + |
|
Evan Stade
2011/05/19 17:08:42
remove excess newline
koz (OOO until 15th September)
2011/05/19 21:07:52
Done.
|