| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @extends {WebInspector.VBox} | 33 * @extends {WebInspector.VBox} |
| 34 * @implements {WebInspector.DOMNodeHighlighter} | 34 * @implements {WebInspector.DOMNodeHighlighter} |
| 35 * @param {!WebInspector.Target} target | 35 * @param {!WebInspector.Target} target |
| 36 * @param {!WebInspector.ResourceTreeModel} resourceTreeModel |
| 36 */ | 37 */ |
| 37 WebInspector.ScreencastView = function(target) | 38 WebInspector.ScreencastView = function(target, resourceTreeModel) |
| 38 { | 39 { |
| 39 WebInspector.VBox.call(this); | 40 WebInspector.VBox.call(this); |
| 40 this._target = target; | 41 this._target = target; |
| 41 this._domModel = WebInspector.DOMModel.fromTarget(target); | 42 this._domModel = WebInspector.DOMModel.fromTarget(target); |
| 43 this._resourceTreeModel = resourceTreeModel; |
| 42 | 44 |
| 43 this.setMinimumSize(150, 150); | 45 this.setMinimumSize(150, 150); |
| 44 this.registerRequiredCSS("screencast/screencastView.css"); | 46 this.registerRequiredCSS("screencast/screencastView.css"); |
| 45 }; | 47 }; |
| 46 | 48 |
| 47 WebInspector.ScreencastView._bordersSize = 44; | 49 WebInspector.ScreencastView._bordersSize = 44; |
| 48 | 50 |
| 49 WebInspector.ScreencastView._navBarHeight = 29; | 51 WebInspector.ScreencastView._navBarHeight = 29; |
| 50 | 52 |
| 51 WebInspector.ScreencastView._HttpRegex = /^http:\/\/(.+)/; | 53 WebInspector.ScreencastView._HttpRegex = /^http:\/\/(.+)/; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 this._titleElement.style.left = "0"; | 92 this._titleElement.style.left = "0"; |
| 91 | 93 |
| 92 this._imageElement = new Image(); | 94 this._imageElement = new Image(); |
| 93 this._isCasting = false; | 95 this._isCasting = false; |
| 94 this._context = this._canvasElement.getContext("2d"); | 96 this._context = this._canvasElement.getContext("2d"); |
| 95 this._checkerboardPattern = this._createCheckerboardPattern(this._contex
t); | 97 this._checkerboardPattern = this._createCheckerboardPattern(this._contex
t); |
| 96 | 98 |
| 97 this._shortcuts = /** !Object.<number, function(Event=):boolean> */ ({})
; | 99 this._shortcuts = /** !Object.<number, function(Event=):boolean> */ ({})
; |
| 98 this._shortcuts[WebInspector.KeyboardShortcut.makeKey("l", WebInspector.
KeyboardShortcut.Modifiers.Ctrl)] = this._focusNavigationBar.bind(this); | 100 this._shortcuts[WebInspector.KeyboardShortcut.makeKey("l", WebInspector.
KeyboardShortcut.Modifiers.Ctrl)] = this._focusNavigationBar.bind(this); |
| 99 | 101 |
| 100 this._target.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.ScreencastFrame, this._screencastFrame, this); | 102 this._resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.
EventTypes.ScreencastFrame, this._screencastFrame, this); |
| 101 this._target.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.ScreencastVisibilityChanged, this._screencastVisibilityChanged
, this); | 103 this._resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.
EventTypes.ScreencastVisibilityChanged, this._screencastVisibilityChanged, this)
; |
| 102 | 104 |
| 103 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.E
vents.SuspendStateChanged, this._onSuspendStateChange, this); | 105 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.E
vents.SuspendStateChanged, this._onSuspendStateChange, this); |
| 104 this._updateGlasspane(); | 106 this._updateGlasspane(); |
| 105 }, | 107 }, |
| 106 | 108 |
| 107 wasShown: function() | 109 wasShown: function() |
| 108 { | 110 { |
| 109 this._startCasting(); | 111 this._startCasting(); |
| 110 }, | 112 }, |
| 111 | 113 |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 { | 736 { |
| 735 var newIndex = this._historyIndex + offset; | 737 var newIndex = this._historyIndex + offset; |
| 736 if (newIndex < 0 || newIndex >= this._historyEntries.length) | 738 if (newIndex < 0 || newIndex >= this._historyEntries.length) |
| 737 return; | 739 return; |
| 738 this._target.pageAgent().navigateToHistoryEntry(this._historyEntries[new
Index].id); | 740 this._target.pageAgent().navigateToHistoryEntry(this._historyEntries[new
Index].id); |
| 739 this._requestNavigationHistory(); | 741 this._requestNavigationHistory(); |
| 740 }, | 742 }, |
| 741 | 743 |
| 742 _navigateReload: function() | 744 _navigateReload: function() |
| 743 { | 745 { |
| 744 this._target.resourceTreeModel.reloadPage(); | 746 this._resourceTreeModel.reloadPage(); |
| 745 }, | 747 }, |
| 746 | 748 |
| 747 _navigationUrlKeyUp: function(event) | 749 _navigationUrlKeyUp: function(event) |
| 748 { | 750 { |
| 749 if (event.key !== "Enter") | 751 if (event.key !== "Enter") |
| 750 return; | 752 return; |
| 751 var url = this._navigationUrl.value; | 753 var url = this._navigationUrl.value; |
| 752 if (!url) | 754 if (!url) |
| 753 return; | 755 return; |
| 754 if (!url.match(WebInspector.ScreencastView._SchemeRegex)) | 756 if (!url.match(WebInspector.ScreencastView._SchemeRegex)) |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 return; | 865 return; |
| 864 this._maxDisplayedProgress = progress; | 866 this._maxDisplayedProgress = progress; |
| 865 this._displayProgress(progress); | 867 this._displayProgress(progress); |
| 866 }, | 868 }, |
| 867 | 869 |
| 868 _displayProgress: function(progress) | 870 _displayProgress: function(progress) |
| 869 { | 871 { |
| 870 this._element.style.width = (100 * progress) + "%"; | 872 this._element.style.width = (100 * progress) + "%"; |
| 871 } | 873 } |
| 872 }; | 874 }; |
| OLD | NEW |