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

Unified Diff: chrome/browser/resources/md_bookmarks/toast.js

Issue 2898303004: [MD Bookmarks] Add toasts. (Closed)
Patch Set: address comments Created 3 years, 7 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: chrome/browser/resources/md_bookmarks/toast.js
diff --git a/chrome/browser/resources/md_bookmarks/toast.js b/chrome/browser/resources/md_bookmarks/toast.js
new file mode 100644
index 0000000000000000000000000000000000000000..fe85ef762cd5b3bba6eab38a2d8c739f547c630e
--- /dev/null
+++ b/chrome/browser/resources/md_bookmarks/toast.js
@@ -0,0 +1,28 @@
+// 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.
+
+Polymer({
+ is: 'bookmarks-toast',
+
+ properties: {
+ open: {
+ type: Boolean,
+ reflectToAttribute: true,
+ observer: 'openChanged_',
+ },
+
+ // Leaving duration undefined or set to 0 will make the toast show forever.
+ duration: Number,
dpapad 2017/06/01 17:35:44 Nit: Can we give this an initial value of 0? This
calamity 2017/06/02 05:34:22 Done.
+ },
+
+ /** @private */
+ openChanged_: function() {
+ if (!this.open || !this.duration)
+ return;
+
+ setTimeout(function() {
dpapad 2017/06/01 17:35:44 Shouldn't we be canceling this timeout to avoid ra
calamity 2017/06/02 05:34:22 Good catch! Done.
+ this.open = false;
+ }.bind(this), this.duration);
+ },
+});

Powered by Google App Engine
This is Rietveld 408576698