OLD | NEW |
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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 | 501 |
502 this._showRulersChanged(); | 502 this._showRulersChanged(); |
503 }, | 503 }, |
504 | 504 |
505 _userAgentChanged: function() | 505 _userAgentChanged: function() |
506 { | 506 { |
507 if (this._userAgentChangedListenerMuted) | 507 if (this._userAgentChangedListenerMuted) |
508 return; | 508 return; |
509 var userAgent = this.settings.overrideUserAgent.get() ? this.settings.us
erAgent.get() : ""; | 509 var userAgent = this.settings.overrideUserAgent.get() ? this.settings.us
erAgent.get() : ""; |
510 NetworkAgent.setUserAgentOverride(userAgent); | 510 NetworkAgent.setUserAgentOverride(userAgent); |
511 this._updateUserAgentWarningMessage(this._userAgent !== userAgent ? WebI
nspector.UIString("You might need to reload the page for proper user agent spoof
ing and viewport rendering.") : ""); | 511 if (this._userAgent !== userAgent) |
| 512 this._updateUserAgentWarningMessage(WebInspector.UIString("You might
need to reload the page for proper user agent spoofing and viewport rendering."
)); |
512 this._userAgent = userAgent; | 513 this._userAgent = userAgent; |
513 this.maybeHasActiveOverridesChanged(); | 514 this.maybeHasActiveOverridesChanged(); |
514 }, | 515 }, |
515 | 516 |
516 _onPageResizerAvailableSizeChanged: function() | 517 _onPageResizerAvailableSizeChanged: function() |
517 { | 518 { |
518 this._deviceMetricsChanged(); | 519 this._deviceMetricsChanged(); |
519 }, | 520 }, |
520 | 521 |
521 _onPageResizerResizeRequested: function(event) | 522 _onPageResizerResizeRequested: function(event) |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 function apiCallback(error) | 604 function apiCallback(error) |
604 { | 605 { |
605 if (error) { | 606 if (error) { |
606 this._updateDeviceMetricsWarningMessage(WebInspector.UIString("S
creen emulation is not available on this page.")); | 607 this._updateDeviceMetricsWarningMessage(WebInspector.UIString("S
creen emulation is not available on this page.")); |
607 this._deviceMetricsOverrideAppliedForTest(); | 608 this._deviceMetricsOverrideAppliedForTest(); |
608 return; | 609 return; |
609 } | 610 } |
610 | 611 |
611 var overrideDeviceResolution = this.settings.overrideDeviceResolutio
n.get(); | 612 var overrideDeviceResolution = this.settings.overrideDeviceResolutio
n.get(); |
612 var viewportEnabled = this.settings.emulateViewport.get(); | 613 var viewportEnabled = this.settings.emulateViewport.get(); |
613 this._updateDeviceMetricsWarningMessage(this._overrideDeviceResoluti
on !== overrideDeviceResolution || this._emulateViewportEnabled != viewportEnabl
ed ? | 614 if (this._overrideDeviceResolution !== overrideDeviceResolution || t
his._emulateViewportEnabled !== viewportEnabled) |
614 WebInspector.UIString("You might need to reload the page for pro
per user agent spoofing and viewport rendering.") : ""); | 615 this._updateDeviceMetricsWarningMessage(WebInspector.UIString("Y
ou might need to reload the page for proper user agent spoofing and viewport ren
dering.")); |
615 this._overrideDeviceResolution = overrideDeviceResolution; | 616 this._overrideDeviceResolution = overrideDeviceResolution; |
616 this._emulateViewportEnabled = viewportEnabled; | 617 this._emulateViewportEnabled = viewportEnabled; |
617 this._deviceMetricsOverrideAppliedForTest(); | 618 this._deviceMetricsOverrideAppliedForTest(); |
618 } | 619 } |
619 }, | 620 }, |
620 | 621 |
621 _deviceMetricsOverrideAppliedForTest: function() | 622 _deviceMetricsOverrideAppliedForTest: function() |
622 { | 623 { |
623 // Used for sniffing in tests. | 624 // Used for sniffing in tests. |
624 }, | 625 }, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 if (this._hasActiveOverrides !== hasActiveOverrides) { | 710 if (this._hasActiveOverrides !== hasActiveOverrides) { |
710 this._hasActiveOverrides = hasActiveOverrides; | 711 this._hasActiveOverrides = hasActiveOverrides; |
711 this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.H
asActiveOverridesChanged); | 712 this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.H
asActiveOverridesChanged); |
712 } | 713 } |
713 }, | 714 }, |
714 | 715 |
715 _onMainFrameNavigated: function() | 716 _onMainFrameNavigated: function() |
716 { | 717 { |
717 this._deviceMetricsChanged(); | 718 this._deviceMetricsChanged(); |
718 this._updateUserAgentWarningMessage(""); | 719 this._updateUserAgentWarningMessage(""); |
| 720 this._updateDeviceMetricsWarningMessage(""); |
719 }, | 721 }, |
720 | 722 |
721 /** | 723 /** |
722 * @param {string} warningMessage | 724 * @param {string} warningMessage |
723 */ | 725 */ |
724 _updateDeviceMetricsWarningMessage: function(warningMessage) | 726 _updateDeviceMetricsWarningMessage: function(warningMessage) |
725 { | 727 { |
726 this._deviceMetricsWarningMessage = warningMessage; | 728 this._deviceMetricsWarningMessage = warningMessage; |
727 this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.Overr
idesWarningUpdated); | 729 this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.Overr
idesWarningUpdated); |
728 }, | 730 }, |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 }, | 931 }, |
930 | 932 |
931 __proto__: WebInspector.Object.prototype | 933 __proto__: WebInspector.Object.prototype |
932 } | 934 } |
933 | 935 |
934 | 936 |
935 /** | 937 /** |
936 * @type {!WebInspector.OverridesSupport} | 938 * @type {!WebInspector.OverridesSupport} |
937 */ | 939 */ |
938 WebInspector.overridesSupport; | 940 WebInspector.overridesSupport; |
OLD | NEW |