Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Unified Diff: remoting/webapp/app_remoting/js/submenu_manager.js

Issue 1816653002: Remove app_remoting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/app_remoting/js/submenu_manager.js
diff --git a/remoting/webapp/app_remoting/js/submenu_manager.js b/remoting/webapp/app_remoting/js/submenu_manager.js
deleted file mode 100644
index 86ce39c1e95a86db96d31c27ee2dc2b9cbf10891..0000000000000000000000000000000000000000
--- a/remoting/webapp/app_remoting/js/submenu_manager.js
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2014 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.
-
-/**
- * @fileoverview
- * Helper class for submenus that should add or remove the parent menu entry
- * depending on whether or not any child items exist.
- */
-
-'use strict';
-
-/** @suppress {duplicate} */
-var remoting = remoting || {};
-
-/**
- * @param {remoting.ContextMenuAdapter} adapter
- * @param {string} title The title of the parent menu item.
- * @param {boolean} checkable True if the child menus should be checkable.
- * @constructor
- */
-remoting.SubmenuManager = function(adapter, title, checkable) {
- /** @private {remoting.ContextMenuAdapter} */
- this.adapter_ = adapter;
- /** @private {string} */
- this.title_ = title;
- /** @private {boolean} */
- this.checkable_ = checkable;
- /** @private {!Object} */
- this.childIds_ = {};
- /** @private {string} */
- this.parentId_ = '';
-};
-
-/**
- * Add a submenu item, or update the title of an existing submenu item.
- *
- * @param {string} id The child id.
- * @param {string} title The window title.
- * @return {boolean} True if a new menu item was created, false if an existing
- * menu item was renamed.
- */
-remoting.SubmenuManager.prototype.add = function(id, title) {
- if (id in this.childIds_) {
- this.adapter_.updateTitle(id, title);
- return false;
- } else {
- this.childIds_[id] = true;
- this.addOrRemoveParent_();
- this.adapter_.create(id, title, this.checkable_, this.parentId_);
- return true;
- }
-};
-
-/**
- * Remove a submenu item.
- *
- * @param {string} id The child id.
- */
-remoting.SubmenuManager.prototype.remove = function(id) {
- this.adapter_.remove(id);
- delete this.childIds_[id];
- this.addOrRemoveParent_();
-};
-
-/**
- * Remove all submenu items.
- */
-remoting.SubmenuManager.prototype.removeAll = function() {
- var submenus = Object.keys(this.childIds_);
- for (var i = 0; i < submenus.length; ++i) {
- this.remove(submenus[i]);
- }
-};
-
-/**
- * Add the parent menu item if it doesn't exist but there are submenus items,
- * or remove it if it exists but there are no submenus.
- *
- * @private
- */
-remoting.SubmenuManager.prototype.addOrRemoveParent_ = function() {
- if (Object.getOwnPropertyNames(this.childIds_).length != 0) {
- if (!this.parentId_) {
- this.parentId_ = base.generateXsrfToken(); // Use a random id
- this.adapter_.create(this.parentId_, this.title_, false);
- }
- } else {
- if (this.parentId_) {
- this.adapter_.remove(this.parentId_);
- this.parentId_ = '';
- }
- }
-};
« no previous file with comments | « remoting/webapp/app_remoting/js/loading_window.js ('k') | remoting/webapp/app_remoting/js/window_activation_menu.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698