Chromium Code Reviews| Index: chrome/browser/resources/chromeos/wrench_menu.js |
| diff --git a/chrome/browser/resources/chromeos/wrench_menu.js b/chrome/browser/resources/chromeos/wrench_menu.js |
| index 85662705999360d490ff13e98dedada7163dce77..35f9a1d930625630a47daf7898e3d9ec5a0971d0 100644 |
| --- a/chrome/browser/resources/chromeos/wrench_menu.js |
| +++ b/chrome/browser/resources/chromeos/wrench_menu.js |
| @@ -1,9 +1,11 @@ |
| -// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| +// Copyright (c) 2012 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. |
| /** |
| * ButtonCommand class for small buttons on menu items. |
| + * @constructor |
| + * @extends {HTMLDivElement} |
| */ |
| var ButtonCommand = cr.ui.define('div'); |
| @@ -19,6 +21,7 @@ ButtonCommand.prototype = { |
| /** |
| * Changes the selection state of the menu item. |
| * @param {boolean} selected True to set the selection, or false otherwise. |
| + * @this {ButtonCommand} |
| */ |
| set selected(selected) { |
| if (selected) { |
| @@ -31,6 +34,7 @@ ButtonCommand.prototype = { |
| /** |
| * Activate the menu item. |
| + * @this {ButtonCommand} |
| */ |
| activate: function() { |
| sendActivate(this.menu_.getMenuItemIndexOf(this), |
| @@ -40,6 +44,8 @@ ButtonCommand.prototype = { |
| /** |
| * EditCommand implements Copy and Paste command. |
| + * @constructor |
| + * @extends {HTMLDivElement} |
| */ |
| var EditCommand = cr.ui.define('div'); |
| @@ -48,6 +54,7 @@ EditCommand.prototype = { |
| /** |
| * Initialize the menu item. |
| + * @this {EditCommand} |
| * @override |
| */ |
| init: function(menu, attrs, model) { |
| @@ -69,6 +76,8 @@ EditCommand.prototype = { |
| /** |
| * EditMenuItem which has Copy and Paste commands inside. |
| + * @constructor |
| + * @extends {HTMLDivElement} |
| */ |
| var EditMenuItem = cr.ui.define('div'); |
| @@ -77,6 +86,7 @@ EditMenuItem.prototype = { |
| /** |
| * Initialize |
| + * @this {EditMenuItem} |
| */ |
| decorate: function() { |
| this.className = 'menu-item'; |
| @@ -97,6 +107,7 @@ EditMenuItem.prototype = { |
| /** |
| * Activates the command. |
| + * @this {EditMenuItem} |
| * @override |
| */ |
| activate: function() { |
| @@ -106,6 +117,7 @@ EditMenuItem.prototype = { |
| /** |
| * @override |
| + * @this {EditMenuItem} |
| */ |
| set selected(selected) { |
| if (selected) { |
| @@ -119,6 +131,7 @@ EditMenuItem.prototype = { |
| /** |
| * Initialize the edit items with configuration info. |
| * @override |
| + * @this {EditMenuItem} |
| */ |
| initMenuItem_: function() { |
| this.label_.textContent = |
| @@ -136,6 +149,8 @@ EditMenuItem.prototype = { |
| /** |
| * ZoomCommand class implements Zoom plus and fullscreen. |
| + * @constructor |
| + * @extends {HTMLDivElement} |
|
Dan Beam
2012/05/07 17:43:53
it seems that this actually extends ButtonCommand,
kmadhusu
2012/05/08 20:20:19
Reverted my changes.
|
| */ |
| var ZoomCommand = cr.ui.define('div'); |
| @@ -144,6 +159,7 @@ ZoomCommand.prototype = { |
| /** |
| * Initialize the menu item. |
| + * @this {ZoomCommand} |
| * @override |
| */ |
| init: function(menu, attrs, model) { |
| @@ -160,6 +176,7 @@ ZoomCommand.prototype = { |
| /** |
| * Activate zoom plus and full screen commands. |
| + * @this {ZoomCommand} |
| * @override |
| */ |
| activate: function() { |
| @@ -171,6 +188,8 @@ ZoomCommand.prototype = { |
| /** |
| * ZoomMenuItem which has plus and fullscreen buttons inside. |
| + * @constructor |
| + * @extends {HTMLDivElement} |
| */ |
| var ZoomMenuItem = cr.ui.define('div'); |
| @@ -179,6 +198,7 @@ ZoomMenuItem.prototype = { |
| /** |
| * Decorate Zoom button item. |
| + * @this {ZoomMenuItem} |
| */ |
| decorate: function() { |
| this.className = 'menu-item'; |
| @@ -204,6 +224,7 @@ ZoomMenuItem.prototype = { |
| /** |
| * Activates the cut command. |
| + * @this {ZoomMenuItem} |
| * @override |
| */ |
| activate: function() { |
| @@ -213,7 +234,8 @@ ZoomMenuItem.prototype = { |
| /** |
| * Updates zoom controls. |
| - * @params {JSON} params JSON object to configure zoom controls. |
| + * @param {JSON} params JSON object to configure zoom controls. |
| + * @this {ZoomMenuItem} |
| */ |
| updateZoomControls: function(params) { |
| this.attrs.enabled = params.plus; |
| @@ -233,6 +255,7 @@ ZoomMenuItem.prototype = { |
| /** |
| * @override |
| + * @this {ZoomMenuItem} |
| */ |
| set selected(selected) { |
| if (selected) { |
| @@ -246,6 +269,7 @@ ZoomMenuItem.prototype = { |
| /** |
| * Initializes the zoom menu item with configuration info. |
| * @override |
| + * @this {ZoomMenuItem} |
| */ |
| initMenuItem_: function() { |
| this.label_.textContent = |
| @@ -262,6 +286,8 @@ ZoomMenuItem.prototype = { |
| /** |
| * WrenchMenu |
| + * @constructor |
| + * @extends {HTMLDivElement} |
|
Dan Beam
2012/05/07 17:43:53
same here with this probably extending Menu.
kmadhusu
2012/05/08 20:20:19
Since we are going to remove this file in the near
|
| */ |
| var WrenchMenu = cr.ui.define('div'); |
| @@ -270,6 +296,7 @@ WrenchMenu.prototype = { |
| /** |
| * Decorate Zoom button item. |
| + * @this {WrenchMenu} |
| */ |
| decorate: function() { |
| Menu.prototype.decorate.call(this); |
| @@ -280,9 +307,10 @@ WrenchMenu.prototype = { |
| /** |
| * Create a MenuItem for given {@code attrs}. |
| * @override |
| + * @this {WrenchMenu} |
| */ |
| createMenuItem: function(attrs) { |
| - switch(attrs.command_id) { |
| + switch (attrs.command_id) { |
| case this.config_.IDC_CUT: |
| return this.edit_; |
| case this.config_.IDC_COPY: |
| @@ -300,12 +328,15 @@ WrenchMenu.prototype = { |
| } |
| }, |
| + /** |
| + * @this {WrenchMenu} |
| + */ |
| updateZoomControls: function(params) { |
| this.zoom_.updateZoomControls(params); |
| }, |
| }; |
| function updateZoomControls(params) { |
| - var menu = document.getElementById('viewport'); |
| + var menu = $('viewport'); |
| menu.updateZoomControls(params); |
| } |