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

Unified Diff: ui/webui/resources/custom_elements/cr/toggle-button/cr-toggle-button.js

Issue 902053003: Add cr-toggle-button to Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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: ui/webui/resources/custom_elements/cr/toggle-button/cr-toggle-button.js
diff --git a/ui/webui/resources/custom_elements/cr/toggle-button/cr-toggle-button.js b/ui/webui/resources/custom_elements/cr/toggle-button/cr-toggle-button.js
new file mode 100644
index 0000000000000000000000000000000000000000..38e840490786ea795cad413afdf18dc3a04e1174
--- /dev/null
+++ b/ui/webui/resources/custom_elements/cr/toggle-button/cr-toggle-button.js
@@ -0,0 +1,47 @@
+/* Copyright 2015 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
+ * `cr-toggle-button` provides a switch the user can toggle on or off by
+ * tapping or by dragging. Wraps a `paper-toggle-button`.
+ *
+ * Example:
+ *
+ * <cr-toggle-button></cr-toggle-button>
+ *
+ * @element cr-toggle-button
+ */
+Polymer({
+ publish: {
+ /**
+ * Gets or sets the state. `true` is checked and `false` is unchecked.
+ *
+ * @attribute checked
+ * @type boolean
+ * @default false
+ */
+ checked: {
+ value: false,
+ reflect: true,
+ },
+
+ /**
+ * If true, the toggle button is disabled.
+ *
+ * @attribute disabled
+ * @type boolean
+ * @default false
+ */
+ disabled: {
+ value: false,
+ reflect: true,
+ },
+ },
stevenjb 2015/02/05 23:36:21 It does seem a little tedious to have to re-publis
Jeremy Klein 2015/02/05 23:42:11 +1. This is a lot of code for a really thin wrappe
+
+ ready: function() {
+ this.$['toggle-button'].addEventListener('change',
+ this.$.util.forwardEvent);
+ },
+});

Powered by Google App Engine
This is Rietveld 408576698