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

Side by Side Diff: remoting/webapp/app_remoting/js/context_menu_dom.js

Issue 1143453007: remoting.WindowShape clean up. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's feedback Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * Provide an alternative location for the application's context menu items 7 * Provide an alternative location for the application's context menu items
8 * on platforms that don't provide it. 8 * on platforms that don't provide it.
9 * 9 *
10 * To mimic the behaviour of an OS-provided context menu, the menu is dismissed 10 * To mimic the behaviour of an OS-provided context menu, the menu is dismissed
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 this.eventSource_.defineEvents([this.eventName_]); 68 this.eventSource_.defineEvents([this.eventName_]);
69 this.root_.addEventListener( 69 this.root_.addEventListener(
70 'transitionend', this.onTransitionEnd_.bind(this), false); 70 'transitionend', this.onTransitionEnd_.bind(this), false);
71 this.stub_.addEventListener('click', this.onStubClick_.bind(this), false); 71 this.stub_.addEventListener('click', this.onStubClick_.bind(this), false);
72 this.icon_.addEventListener('click', this.onIconClick_.bind(this), false); 72 this.icon_.addEventListener('click', this.onIconClick_.bind(this), false);
73 this.screen_.addEventListener('click', this.onIconClick_.bind(this), false); 73 this.screen_.addEventListener('click', this.onIconClick_.bind(this), false);
74 74
75 this.root_.hidden = false; 75 this.root_.hidden = false;
76 this.root_.style.bottom = this.bottom_ + 'px'; 76 this.root_.style.bottom = this.bottom_ + 'px';
77 remoting.windowShape.addCallback(this); 77 remoting.windowShape.registerClientUI(this);
78 };
79
80 remoting.ContextMenuDom.prototype.dispose = function() {
81 remoting.windowShape.unregisterClientUI(this);
78 }; 82 };
79 83
80 /** 84 /**
81 * @param {Array<{left: number, top: number, width: number, height: number}>} 85 * @param {Array<{left: number, top: number, width: number, height: number}>}
82 * rects List of rectangles. 86 * rects List of rectangles.
83 */ 87 */
84 remoting.ContextMenuDom.prototype.addToRegion = function(rects) { 88 remoting.ContextMenuDom.prototype.addToRegion = function(rects) {
85 var rect = /** @type {ClientRect} */ (this.root_.getBoundingClientRect()); 89 var rect = /** @type {ClientRect} */ (this.root_.getBoundingClientRect());
86 // Clip the menu position to the main window in case the screen size has 90 // Clip the menu position to the main window in case the screen size has
87 // changed or a recent drag event tried to move it out of bounds. 91 // changed or a recent drag event tried to move it out of bounds.
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 this.bottom_ -= deltaY; 298 this.bottom_ -= deltaY;
295 this.root_.style.bottom = this.bottom_ + 'px'; 299 this.root_.style.bottom = this.bottom_ + 'px';
296 // Deferring the window shape update until the DOM update has completed 300 // Deferring the window shape update until the DOM update has completed
297 // helps keep the position of the context menu consistent with the window 301 // helps keep the position of the context menu consistent with the window
298 // shape (though it's still not perfect). 302 // shape (though it's still not perfect).
299 window.requestAnimationFrame( 303 window.requestAnimationFrame(
300 function() { 304 function() {
301 remoting.windowShape.updateClientWindowShape(); 305 remoting.windowShape.updateClientWindowShape();
302 }); 306 });
303 }; 307 };
OLDNEW
« no previous file with comments | « remoting/webapp/app_remoting/js/context_menu_chrome.js ('k') | remoting/webapp/app_remoting/js/idle_detector.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698