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 |
+} |