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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 this._isCasting = false; | 87 this._isCasting = false; |
88 this._context = this._canvasElement.getContext("2d"); | 88 this._context = this._canvasElement.getContext("2d"); |
89 this._checkerboardPattern = this._createCheckerboardPattern(this._contex
t); | 89 this._checkerboardPattern = this._createCheckerboardPattern(this._contex
t); |
90 | 90 |
91 this._shortcuts = /** !Object.<number, function(Event=):boolean> */ ({})
; | 91 this._shortcuts = /** !Object.<number, function(Event=):boolean> */ ({})
; |
92 this._shortcuts[WebInspector.KeyboardShortcut.makeKey("l", WebInspector.
KeyboardShortcut.Modifiers.Ctrl)] = this._focusNavigationBar.bind(this); | 92 this._shortcuts[WebInspector.KeyboardShortcut.makeKey("l", WebInspector.
KeyboardShortcut.Modifiers.Ctrl)] = this._focusNavigationBar.bind(this); |
93 | 93 |
94 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.ScreencastFrame, this._screencastFrame, this); | 94 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.ScreencastFrame, this._screencastFrame, this); |
95 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.ScreencastVisibilityChanged, this._screencastVisibilityChanged
, this); | 95 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.ScreencastVisibilityChanged, this._screencastVisibilityChanged
, this); |
96 | 96 |
97 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManag
er.EventTypes.TimelineStarted, this._onTimeline.bind(this, true), this); | 97 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager
, WebInspector.TimelineManager.EventTypes.TimelineStarted, this._onTimeline.bind
(this), this); |
98 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManag
er.EventTypes.TimelineStopped, this._onTimeline.bind(this, false), this); | 98 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager
, WebInspector.TimelineManager.EventTypes.TimelineStopped, this._onTimeline.bind
(this), this); |
99 this._timelineActive = WebInspector.timelineManager.isStarted(); | 99 this._timelineActive = this._isTimelineActive(); |
100 | 100 |
101 WebInspector.cpuProfilerModel.addEventListener(WebInspector.CPUProfilerM
odel.EventTypes.ProfileStarted, this._onProfiler.bind(this, true), this); | 101 WebInspector.targetManager.addModelListener(WebInspector.CPUProfilerMode
l, WebInspector.CPUProfilerModel.EventTypes.ProfileStarted, this._onProfiler.bin
d(this), this); |
102 WebInspector.cpuProfilerModel.addEventListener(WebInspector.CPUProfilerM
odel.EventTypes.ProfileStopped, this._onProfiler.bind(this, false), this); | 102 WebInspector.targetManager.addModelListener(WebInspector.CPUProfilerMode
l, WebInspector.CPUProfilerModel.EventTypes.ProfileStopped, this._onProfiler.bin
d(this), this); |
103 this._profilerActive = WebInspector.cpuProfilerModel.isRecordingProfile(
); | 103 this._profilerActive = this._isProfilerActive(); |
104 | 104 |
105 this._updateGlasspane(); | 105 this._updateGlasspane(); |
106 }, | 106 }, |
107 | 107 |
108 wasShown: function() | 108 wasShown: function() |
109 { | 109 { |
110 this._startCasting(); | 110 this._startCasting(); |
111 }, | 111 }, |
112 | 112 |
113 willHide: function() | 113 willHide: function() |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 181 |
182 /** | 182 /** |
183 * @param {!WebInspector.Event} event | 183 * @param {!WebInspector.Event} event |
184 */ | 184 */ |
185 _screencastVisibilityChanged: function(event) | 185 _screencastVisibilityChanged: function(event) |
186 { | 186 { |
187 this._targetInactive = !event.data.visible; | 187 this._targetInactive = !event.data.visible; |
188 this._updateGlasspane(); | 188 this._updateGlasspane(); |
189 }, | 189 }, |
190 | 190 |
191 /** | 191 _onTimeline: function() |
192 * @param {boolean} on | |
193 * @private | |
194 */ | |
195 _onTimeline: function(on) | |
196 { | 192 { |
197 this._timelineActive = on; | 193 this._timelineActive = this._isTimelineActive(); |
198 if (this._timelineActive) | 194 if (this._timelineActive) |
199 this._stopCasting(); | 195 this._stopCasting(); |
200 else | 196 else |
201 this._startCasting(); | 197 this._startCasting(); |
202 this._updateGlasspane(); | 198 this._updateGlasspane(); |
203 }, | 199 }, |
204 | 200 |
205 /** | 201 /** |
206 * @param {boolean} on | |
207 * @param {!WebInspector.Event} event | 202 * @param {!WebInspector.Event} event |
208 * @private | |
209 */ | 203 */ |
210 _onProfiler: function(on, event) { | 204 _onProfiler: function(event) |
211 this._profilerActive = on; | 205 { |
| 206 this._profilerActive = this._isProfilerActive(); |
212 if (this._profilerActive) | 207 if (this._profilerActive) |
213 this._stopCasting(); | 208 this._stopCasting(); |
214 else | 209 else |
215 this._startCasting(); | 210 this._startCasting(); |
216 this._updateGlasspane(); | 211 this._updateGlasspane(); |
217 }, | 212 }, |
218 | 213 |
219 _updateGlasspane: function() | 214 _updateGlasspane: function() |
220 { | 215 { |
221 if (this._targetInactive) { | 216 if (this._targetInactive) { |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 this._navigationUrl.value = url; | 911 this._navigationUrl.value = url; |
917 }, | 912 }, |
918 | 913 |
919 _focusNavigationBar: function() | 914 _focusNavigationBar: function() |
920 { | 915 { |
921 this._navigationUrl.focus(); | 916 this._navigationUrl.focus(); |
922 this._navigationUrl.select(); | 917 this._navigationUrl.select(); |
923 return true; | 918 return true; |
924 }, | 919 }, |
925 | 920 |
| 921 _isTimelineActive: function() |
| 922 { |
| 923 return WebInspector.targetManager.targets().some(function(target){ retur
n target.timelineManager.isStarted();}); |
| 924 }, |
| 925 |
| 926 _isProfilerActive: function() |
| 927 { |
| 928 return WebInspector.targetManager.targets().some(function(target){ retur
n target.cpuProfilerModel.isRecordingProfile();}); |
| 929 }, |
| 930 |
926 __proto__: WebInspector.VBox.prototype | 931 __proto__: WebInspector.VBox.prototype |
927 } | 932 } |
928 | 933 |
929 /** | 934 /** |
930 * @param {!Element} element | 935 * @param {!Element} element |
931 * @constructor | 936 * @constructor |
932 */ | 937 */ |
933 WebInspector.ScreencastView.ProgressTracker = function(element) | 938 WebInspector.ScreencastView.ProgressTracker = function(element) |
934 { | 939 { |
935 this._element = element; | 940 this._element = element; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 return; | 1003 return; |
999 this._maxDisplayedProgress = progress; | 1004 this._maxDisplayedProgress = progress; |
1000 this._displayProgress(progress); | 1005 this._displayProgress(progress); |
1001 }, | 1006 }, |
1002 | 1007 |
1003 _displayProgress: function(progress) | 1008 _displayProgress: function(progress) |
1004 { | 1009 { |
1005 this._element.style.width = (100 * progress) + "%"; | 1010 this._element.style.width = (100 * progress) + "%"; |
1006 } | 1011 } |
1007 }; | 1012 }; |
OLD | NEW |