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

Side by Side Diff: Source/devtools/front_end/OverridesSupport.js

Issue 23187005: [DevTools] Use device metrics emulation implemented in content. (Closed) Base URL: svn://svn.chromium.org/blink/trunk/
Patch Set: Another rebase Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/TextAutosizer.cpp ('k') | Source/web/InspectorClientImpl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 16 matching lines...) Expand all
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 */ 33 */
34 WebInspector.OverridesSupport = function() 34 WebInspector.OverridesSupport = function()
35 { 35 {
36 this._overridesActive = WebInspector.settings.enableOverridesOnStartup.get() ; 36 this._overridesActive = WebInspector.settings.enableOverridesOnStartup.get() ;
37 this._deviceMetricsOverridesActive = false;
37 this._updateAllOverrides(); 38 this._updateAllOverrides();
38 39
39 WebInspector.settings.overrideUserAgent.addChangeListener(this._userAgentCha nged, this); 40 WebInspector.settings.overrideUserAgent.addChangeListener(this._userAgentCha nged, this);
40 WebInspector.settings.userAgent.addChangeListener(this._userAgentChanged, th is); 41 WebInspector.settings.userAgent.addChangeListener(this._userAgentChanged, th is);
41 42
42 WebInspector.settings.overrideDeviceMetrics.addChangeListener(this._deviceMe tricsChanged, this); 43 WebInspector.settings.overrideDeviceMetrics.addChangeListener(this._deviceMe tricsChanged, this);
43 WebInspector.settings.deviceMetrics.addChangeListener(this._deviceMetricsCha nged, this); 44 WebInspector.settings.deviceMetrics.addChangeListener(this._deviceMetricsCha nged, this);
44 WebInspector.settings.deviceFitWindow.addChangeListener(this._deviceMetricsC hanged, this); 45 WebInspector.settings.deviceFitWindow.addChangeListener(this._deviceMetricsC hanged, this);
45 46
46 WebInspector.settings.overrideGeolocation.addChangeListener(this._geolocatio nPositionChanged, this); 47 WebInspector.settings.overrideGeolocation.addChangeListener(this._geolocatio nPositionChanged, this);
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 }, 340 },
340 341
341 _userAgentChanged: function() 342 _userAgentChanged: function()
342 { 343 {
343 NetworkAgent.setUserAgentOverride(this._overridesActive && WebInspector. settings.overrideUserAgent.get() ? WebInspector.settings.userAgent.get() : ""); 344 NetworkAgent.setUserAgentOverride(this._overridesActive && WebInspector. settings.overrideUserAgent.get() ? WebInspector.settings.userAgent.get() : "");
344 }, 345 },
345 346
346 _deviceMetricsChanged: function() 347 _deviceMetricsChanged: function()
347 { 348 {
348 var metrics = WebInspector.OverridesSupport.DeviceMetrics.parseSetting(t his._overridesActive && WebInspector.settings.overrideDeviceMetrics.get() ? WebI nspector.settings.deviceMetrics.get() : ""); 349 var metrics = WebInspector.OverridesSupport.DeviceMetrics.parseSetting(t his._overridesActive && WebInspector.settings.overrideDeviceMetrics.get() ? WebI nspector.settings.deviceMetrics.get() : "");
349 if (metrics.isValid()) 350 if (metrics.isValid()) {
351 var active = metrics.width > 0 && metrics.height > 0;
350 PageAgent.setDeviceMetricsOverride(metrics.width, metrics.height, me trics.fontScaleFactor, WebInspector.settings.deviceFitWindow.get()); 352 PageAgent.setDeviceMetricsOverride(metrics.width, metrics.height, me trics.fontScaleFactor, WebInspector.settings.deviceFitWindow.get());
353 if (active != this._deviceMetricsOverridesActive) {
354 PageAgent.reload(false);
355 this._deviceMetricsOverridesActive = active;
356 }
357 }
351 }, 358 },
352 359
353 _geolocationPositionChanged: function() 360 _geolocationPositionChanged: function()
354 { 361 {
355 if (!this._overridesActive || !WebInspector.settings.overrideGeolocation .get()) { 362 if (!this._overridesActive || !WebInspector.settings.overrideGeolocation .get()) {
356 PageAgent.clearGeolocationOverride(); 363 PageAgent.clearGeolocationOverride();
357 return; 364 return;
358 } 365 }
359 var geolocation = WebInspector.OverridesSupport.GeolocationPosition.pars eSetting(WebInspector.settings.geolocationOverride.get()); 366 var geolocation = WebInspector.OverridesSupport.GeolocationPosition.pars eSetting(WebInspector.settings.geolocationOverride.get());
360 if (geolocation.error) 367 if (geolocation.error)
(...skipping 22 matching lines...) Expand all
383 PageAgent.setEmulatedMedia(this._overridesActive && WebInspector.setting s.overrideCSSMedia.get() ? WebInspector.settings.emulatedCSSMedia.get() : ""); 390 PageAgent.setEmulatedMedia(this._overridesActive && WebInspector.setting s.overrideCSSMedia.get() ? WebInspector.settings.emulatedCSSMedia.get() : "");
384 WebInspector.cssModel.mediaQueryResultChanged(); 391 WebInspector.cssModel.mediaQueryResultChanged();
385 } 392 }
386 } 393 }
387 394
388 395
389 /** 396 /**
390 * @type {WebInspector.OverridesSupport} 397 * @type {WebInspector.OverridesSupport}
391 */ 398 */
392 WebInspector.overridesSupport; 399 WebInspector.overridesSupport;
OLDNEW
« no previous file with comments | « Source/core/rendering/TextAutosizer.cpp ('k') | Source/web/InspectorClientImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698