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

Unified Diff: remoting/webapp/crd/js/connected_view.js

Issue 1016623002: [Webapp Refactor] Reparent the ConnectedView into the delegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing Created 5 years, 9 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 | « remoting/webapp/crd/js/client_session.js ('k') | remoting/webapp/crd/js/desktop_connected_view.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/connected_view.js
diff --git a/remoting/webapp/crd/js/connected_view.js b/remoting/webapp/crd/js/connected_view.js
index 26387bb423cfce3dcdefc5fddb14724422cc9604..70803e07ba14d170ca8cec51ea2c0dde0d6ddbbb 100644
--- a/remoting/webapp/crd/js/connected_view.js
+++ b/remoting/webapp/crd/js/connected_view.js
@@ -45,6 +45,10 @@ remoting.ConnectedView = function(plugin, viewportElement, cursorElement) {
this.cursor_ = new remoting.ConnectedView.Cursor(
plugin, viewportElement, cursorElement);
+ /** @private {Element} */
+ this.debugRegionContainer_ =
+ viewportElement.querySelector('.debug-region-container');
+
var pluginElement = plugin.element();
/** private */
@@ -123,6 +127,43 @@ remoting.ConnectedView.prototype.onPluginLostFocus_ = function() {
};
/**
+ * Handles dirty region debug messages.
+ *
+ * @param {{rects:Array<Array<number>>}} region Dirty region of the latest
+ * frame.
+ */
+remoting.ConnectedView.prototype.handleDebugRegion = function(region) {
+ while (this.debugRegionContainer_.firstChild) {
+ this.debugRegionContainer_.removeChild(
+ this.debugRegionContainer_.firstChild);
+ }
+ if (region.rects) {
+ var rects = region.rects;
+ for (var i = 0; i < rects.length; ++i) {
+ var rect = document.createElement('div');
+ rect.classList.add('debug-region-rect');
+ rect.style.left = rects[i][0] + 'px';
+ rect.style.top = rects[i][1] +'px';
+ rect.style.width = rects[i][2] +'px';
+ rect.style.height = rects[i][3] + 'px';
+ this.debugRegionContainer_.appendChild(rect);
+ }
+ }
+};
+
+/**
+ * Enables or disables rendering of dirty regions for debugging.
+ * @param {boolean} enable True to enable rendering.
+ */
+remoting.ConnectedView.prototype.enableDebugRegion = function(enable) {
+ if (enable) {
+ this.plugin_.setDebugDirtyRegionHandler(this.handleDebugRegion.bind(this));
+ } else {
+ this.plugin_.setDebugDirtyRegionHandler(null);
+ }
+};
+
+/**
* @param {remoting.ClientPlugin} plugin
* @param {HTMLElement} viewportElement
* @param {HTMLElement} cursorElement
« no previous file with comments | « remoting/webapp/crd/js/client_session.js ('k') | remoting/webapp/crd/js/desktop_connected_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698