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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/screencast/ScreencastView.js

Issue 2843763004: [DevTools] Introduce EmulationModel which will encapsulate emulation (Closed)
Patch Set: +throttling Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 this._isCasting = false; 123 this._isCasting = false;
124 return; 124 return;
125 } 125 }
126 dimensions.width *= window.devicePixelRatio; 126 dimensions.width *= window.devicePixelRatio;
127 dimensions.height *= window.devicePixelRatio; 127 dimensions.height *= window.devicePixelRatio;
128 // Note: startScreencast width and height are expected to be integers so mus t be floored. 128 // Note: startScreencast width and height are expected to be integers so mus t be floored.
129 this._screenCaptureModel.startScreencast( 129 this._screenCaptureModel.startScreencast(
130 'jpeg', 80, Math.floor(Math.min(maxImageDimension, dimensions.width)), 130 'jpeg', 80, Math.floor(Math.min(maxImageDimension, dimensions.width)),
131 Math.floor(Math.min(maxImageDimension, dimensions.height)), undefined, t his._screencastFrame.bind(this), 131 Math.floor(Math.min(maxImageDimension, dimensions.height)), undefined, t his._screencastFrame.bind(this),
132 this._screencastVisibilityChanged.bind(this)); 132 this._screencastVisibilityChanged.bind(this));
133 Emulation.MultitargetTouchModel.instance().setCustomTouchEnabled(true); 133 for (var emulationModel of SDK.targetManager.models(SDK.EmulationModel))
134 emulationModel.overrideEmulateTouch(true);
134 if (this._overlayModel) 135 if (this._overlayModel)
135 this._overlayModel.setHighlighter(this); 136 this._overlayModel.setHighlighter(this);
136 } 137 }
137 138
138 _stopCasting() { 139 _stopCasting() {
139 if (!this._isCasting) 140 if (!this._isCasting)
140 return; 141 return;
141 this._isCasting = false; 142 this._isCasting = false;
142 this._screenCaptureModel.stopScreencast(); 143 this._screenCaptureModel.stopScreencast();
143 Emulation.MultitargetTouchModel.instance().setCustomTouchEnabled(false); 144 for (var emulationModel of SDK.targetManager.models(SDK.EmulationModel))
145 emulationModel.overrideEmulateTouch(false);
144 if (this._overlayModel) 146 if (this._overlayModel)
145 this._overlayModel.setHighlighter(null); 147 this._overlayModel.setHighlighter(null);
146 } 148 }
147 149
148 /** 150 /**
149 * @param {string} base64Data 151 * @param {string} base64Data
150 * @param {!Protocol.Page.ScreencastFrameMetadata} metadata 152 * @param {!Protocol.Page.ScreencastFrameMetadata} metadata
151 */ 153 */
152 _screencastFrame(base64Data, metadata) { 154 _screencastFrame(base64Data, metadata) {
153 this._imageElement.onload = () => { 155 this._imageElement.onload = () => {
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 if (this._maxDisplayedProgress >= progress) 769 if (this._maxDisplayedProgress >= progress)
768 return; 770 return;
769 this._maxDisplayedProgress = progress; 771 this._maxDisplayedProgress = progress;
770 this._displayProgress(progress); 772 this._displayProgress(progress);
771 } 773 }
772 774
773 _displayProgress(progress) { 775 _displayProgress(progress) {
774 this._element.style.width = (100 * progress) + '%'; 776 this._element.style.width = (100 * progress) + '%';
775 } 777 }
776 }; 778 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698