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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @implements {SDK.TargetManager.Observer} 5 * @implements {SDK.TargetManager.Observer}
6 * @unrestricted 6 * @unrestricted
7 */ 7 */
8 Emulation.DeviceModeModel = class { 8 Emulation.DeviceModeModel = class {
9 /** 9 /**
10 * @param {function()} updateCallback 10 * @param {function()} updateCallback
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 this._target.emulationAgent().resetViewport(); 668 this._target.emulationAgent().resetViewport();
669 this._calculateAndEmulate(false); 669 this._calculateAndEmulate(false);
670 return screenshot; 670 return screenshot;
671 } 671 }
672 672
673 /** 673 /**
674 * @param {boolean} touchEnabled 674 * @param {boolean} touchEnabled
675 * @param {boolean} mobile 675 * @param {boolean} mobile
676 */ 676 */
677 _applyTouch(touchEnabled, mobile) { 677 _applyTouch(touchEnabled, mobile) {
678 Emulation.MultitargetTouchModel.instance().setTouchEnabled(touchEnabled, mob ile); 678 for (var emulationModel of SDK.targetManager.models(SDK.EmulationModel))
679 emulationModel.emulateTouch(touchEnabled, mobile);
679 } 680 }
680 }; 681 };
681 682
682 /** @enum {string} */ 683 /** @enum {string} */
683 Emulation.DeviceModeModel.Type = { 684 Emulation.DeviceModeModel.Type = {
684 None: 'None', 685 None: 'None',
685 Responsive: 'Responsive', 686 Responsive: 'Responsive',
686 Device: 'Device' 687 Device: 'Device'
687 }; 688 };
688 689
689 /** @enum {string} */ 690 /** @enum {string} */
690 Emulation.DeviceModeModel.UA = { 691 Emulation.DeviceModeModel.UA = {
691 Mobile: Common.UIString('Mobile'), 692 Mobile: Common.UIString('Mobile'),
692 MobileNoTouch: Common.UIString('Mobile (no touch)'), 693 MobileNoTouch: Common.UIString('Mobile (no touch)'),
693 Desktop: Common.UIString('Desktop'), 694 Desktop: Common.UIString('Desktop'),
694 DesktopTouch: Common.UIString('Desktop (touch)') 695 DesktopTouch: Common.UIString('Desktop (touch)')
695 }; 696 };
696 697
697 Emulation.DeviceModeModel.MinDeviceSize = 50; 698 Emulation.DeviceModeModel.MinDeviceSize = 50;
698 Emulation.DeviceModeModel.MaxDeviceSize = 9999; 699 Emulation.DeviceModeModel.MaxDeviceSize = 9999;
699 700
700 701
701 Emulation.DeviceModeModel._defaultMobileUserAgent = 702 Emulation.DeviceModeModel._defaultMobileUserAgent =
702 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 ( KHTML, like Gecko) Chrome/%s Mobile Safari/537.36'; 703 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 ( KHTML, like Gecko) Chrome/%s Mobile Safari/537.36';
703 Emulation.DeviceModeModel._defaultMobileUserAgent = 704 Emulation.DeviceModeModel._defaultMobileUserAgent =
704 SDK.MultitargetNetworkManager.patchUserAgentWithChromeVersion(Emulation.Devi ceModeModel._defaultMobileUserAgent); 705 SDK.MultitargetNetworkManager.patchUserAgentWithChromeVersion(Emulation.Devi ceModeModel._defaultMobileUserAgent);
705 Emulation.DeviceModeModel.defaultMobileScaleFactor = 2; 706 Emulation.DeviceModeModel.defaultMobileScaleFactor = 2;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698