Index: ui/file_manager/file_manager/foreground/js/webui_command_extender.js |
diff --git a/ui/file_manager/file_manager/foreground/js/webui_command_extender.js b/ui/file_manager/file_manager/foreground/js/webui_command_extender.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5a9069a43183574288f57cceca93b30ab77f44fb |
--- /dev/null |
+++ b/ui/file_manager/file_manager/foreground/js/webui_command_extender.js |
@@ -0,0 +1,20 @@ |
+// Copyright 2017 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. |
+ |
+/** |
+ * Sets 'hidden' property of a cr.ui.Command instance and dispatches |
+ * 'hiddenChange' event manually so that associated cr.ui.MenuItem can handle |
+ * the event. |
+ * TODO(fukino): Remove this workaround when crbug.com/481941 is fixed. |
+ * |
+ * @param {boolean} value New value of hidden property. |
+ */ |
+cr.ui.Command.prototype.setHidden = function(value) { |
+ if (value === this.hidden) |
+ return; |
+ |
+ var oldValue = this.hidden; |
+ this.hidden = value; |
+ cr.dispatchPropertyChange(this, 'hidden', value, oldValue); |
+}; |