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

Unified Diff: chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js

Issue 1550423002: Autoclose Media Router dialog depending on mouse position 3s after route creation/close. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
diff --git a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
index dc070077e456267908c7080870da2432762bc11c..bba0d4a610544af777af34c526adce57d9aa7a25 100644
--- a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
+++ b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
@@ -123,6 +123,15 @@ Polymer({
},
/**
+ * Whether the user's mouse is positioned over the dialog.
+ * @private {boolean}
+ */
+ mouseIsPositionedOverDialog_: {
+ type: Boolean,
+ value: false,
+ },
+
+ /**
* The list of current routes.
* @type {!Array<!media_router.Route>}
*/
@@ -208,16 +217,6 @@ Polymer({
},
/**
- * List of active timer IDs. Used to retrieve active timer IDs when
- * clearing timers.
- * @private {!Array<number>}
- */
- timerIdList_: {
- type: Array,
- value: [],
- },
-
- /**
* Whether the user has explicitly selected a cast mode.
* @private {boolean}
*/
@@ -229,7 +228,8 @@ Polymer({
listeners: {
'arrow-drop-click': 'toggleCastModeHidden_',
- 'tap': 'onTap_',
+ 'mouseleave': 'onMouseLeave_',
+ 'mouseenter': 'onMouseEnter_',
},
ready: function() {
@@ -674,6 +674,24 @@ Polymer({
this.startTapTimer_();
},
+ /**
+ * Called when a mouseleave event is triggered.
+ *
+ * @private
+ */
+ onMouseLeave_: function() {
+ this.mouseIsPositionedOverDialog_ = false;
+ },
+
+ /**
+ * Called when a mouseenter event is triggered.
+ *
+ * @private
+ */
+ onMouseEnter_: function() {
+ this.mouseIsPositionedOverDialog_ = true;
+ },
+
onNotifyRouteCreationTimeout: function() {
this.currentLaunchingSinkId_ = '';
},
@@ -690,24 +708,6 @@ Polymer({
},
/**
- * Called when a tap event is triggered. Clears any active timers. onTap_
- * is called before a new timer is started for taps that trigger a new active
- * timer.
- *
- * @private
- */
- onTap_: function(e) {
- if (this.timerIdList_.length == 0)
- return;
-
- this.timerIdList_.forEach(function(id) {
- clearTimeout(id);
- }, this);
-
- this.timerIdList_ = [];
- },
-
- /**
* Called when |routeList| is updated. Rebuilds |routeMap_| and
* |sinkToRouteMap_|.
*
@@ -859,17 +859,16 @@ Polymer({
},
/**
- * Starts a timer which fires a close-dialog event if the timer has not been
- * cleared within three seconds.
+ * Starts a timer which fires a close-dialog event if the user's mouse is
+ * not positioned over the dialog after three seconds.
*
* @private
*/
startTapTimer_: function() {
var id = setTimeout(function() {
- this.fire('close-dialog');
+ if (!this.mouseIsPositionedOverDialog_)
+ this.fire('close-dialog');
}.bind(this), 3000 /* 3 seconds */);
-
- this.timerIdList_.push(id);
},
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698