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

Unified Diff: Source/devtools/front_end/ScreencastView.js

Issue 23011021: DevTools: introduce screencast experiment. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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 | « Source/devtools/front_end/ResourceTreeModel.js ('k') | Source/devtools/front_end/Settings.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ScreencastView.js
diff --git a/Source/devtools/front_end/WorkspaceController.js b/Source/devtools/front_end/ScreencastView.js
similarity index 62%
copy from Source/devtools/front_end/WorkspaceController.js
copy to Source/devtools/front_end/ScreencastView.js
index 65353e7603ef85331f59dd1304d7f6583b4566e6..bb2c0895b5c4009a1022db73ad2ac5894279ed81 100644
--- a/Source/devtools/front_end/WorkspaceController.js
+++ b/Source/devtools/front_end/ScreencastView.js
@@ -30,46 +30,52 @@
/**
* @constructor
+ * @extends {WebInspector.View}
*/
-WebInspector.WorkspaceController = function(workspace)
+WebInspector.ScreencastView = function()
{
- this._workspace = workspace;
- WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged, this._inspectedURLChanged, this);
- window.addEventListener("focus", this._windowFocused.bind(this), false);
+ WebInspector.View.call(this);
+ this.element.addStyleClass("fill");
+ this._isCasting = false;
+ this._imageElement = this.element.createChild("img");
+ WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ScreencastFrame, this._screencastFrame, this);
}
-WebInspector.WorkspaceController.prototype = {
- /**
- * @param {WebInspector.Event} event
- */
- _inspectedURLChanged: function(event)
+WebInspector.ScreencastView.prototype = {
+ wasShown: function()
{
- WebInspector.Revision.filterOutStaleRevisions();
+ this.startCasting();
},
- /**
- * @param {Event} event
- */
- _windowFocused: function(event)
+ willHide: function()
{
- if (!WebInspector.experimentsSettings.refreshFileSystemsOnFocus.isEnabled())
- return;
- if (this._fileSystemRefreshTimeout)
+ this.stopCasting();
+ },
+
+ startCasting: function()
+ {
+ if (this._isCasting)
return;
- this._fileSystemRefreshTimeout = setTimeout(refreshFileSystems.bind(this), 1000);
+ this._isCasting = true;
+ PageAgent.startScreencast("jpeg", 80, 0.7);
+ },
- function refreshFileSystems()
- {
- delete this._fileSystemRefreshTimeout;
- var projects = this._workspace.projects();
- for (var i = 0; i < projects.length; ++i)
- projects[i].refresh("/");
- }
- }
-}
+ stopCasting: function()
+ {
+ if (!this._isCasting)
+ return;
+ this._isCasting = false;
+ PageAgent.stopScreencast();
+ },
-/**
- * @type {?WebInspector.WorkspaceController}
- */
-WebInspector.workspaceController = null;
+ /**
+ * @param {WebInspector.Event} event
+ */
+ _screencastFrame: function(event)
+ {
+ var base64Data = /** type {string} */(event.data);
+ this._imageElement.src = "data:image/jpg;base64," + base64Data;
+ },
+ __proto__: WebInspector.View.prototype
+}
« no previous file with comments | « Source/devtools/front_end/ResourceTreeModel.js ('k') | Source/devtools/front_end/Settings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698