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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 return !!this._requestIds; | 831 return !!this._requestIds; |
832 } | 832 } |
833 | 833 |
834 _onRequestStarted(event) { | 834 _onRequestStarted(event) { |
835 if (!this._navigationProgressVisible()) | 835 if (!this._navigationProgressVisible()) |
836 return; | 836 return; |
837 var request = /** @type {!SDK.NetworkRequest} */ (event.data); | 837 var request = /** @type {!SDK.NetworkRequest} */ (event.data); |
838 // Ignore long-living WebSockets for the sake of progress indicator, as we w
on't be waiting them anyway. | 838 // Ignore long-living WebSockets for the sake of progress indicator, as we w
on't be waiting them anyway. |
839 if (request.type === Common.resourceTypes.WebSocket) | 839 if (request.type === Common.resourceTypes.WebSocket) |
840 return; | 840 return; |
841 this._requestIds[request.requestId] = request; | 841 this._requestIds[request.requestId()] = request; |
842 ++this._startedRequests; | 842 ++this._startedRequests; |
843 } | 843 } |
844 | 844 |
845 _onRequestFinished(event) { | 845 _onRequestFinished(event) { |
846 if (!this._navigationProgressVisible()) | 846 if (!this._navigationProgressVisible()) |
847 return; | 847 return; |
848 var request = /** @type {!SDK.NetworkRequest} */ (event.data); | 848 var request = /** @type {!SDK.NetworkRequest} */ (event.data); |
849 if (!(request.requestId in this._requestIds)) | 849 if (!(request.requestId() in this._requestIds)) |
850 return; | 850 return; |
851 ++this._finishedRequests; | 851 ++this._finishedRequests; |
852 setTimeout(function() { | 852 setTimeout(function() { |
853 this._updateProgress( | 853 this._updateProgress( |
854 this._finishedRequests / this._startedRequests * 0.9); // Finished re
quests drive the progress up to 90%. | 854 this._finishedRequests / this._startedRequests * 0.9); // Finished re
quests drive the progress up to 90%. |
855 }.bind(this), 500); // Delay to give the new requests time to start. This m
akes the progress smoother. | 855 }.bind(this), 500); // Delay to give the new requests time to start. This m
akes the progress smoother. |
856 } | 856 } |
857 | 857 |
858 _updateProgress(progress) { | 858 _updateProgress(progress) { |
859 if (!this._navigationProgressVisible()) | 859 if (!this._navigationProgressVisible()) |
860 return; | 860 return; |
861 if (this._maxDisplayedProgress >= progress) | 861 if (this._maxDisplayedProgress >= progress) |
862 return; | 862 return; |
863 this._maxDisplayedProgress = progress; | 863 this._maxDisplayedProgress = progress; |
864 this._displayProgress(progress); | 864 this._displayProgress(progress); |
865 } | 865 } |
866 | 866 |
867 _displayProgress(progress) { | 867 _displayProgress(progress) { |
868 this._element.style.width = (100 * progress) + '%'; | 868 this._element.style.width = (100 * progress) + '%'; |
869 } | 869 } |
870 }; | 870 }; |
OLD | NEW |