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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/NetworkManager.js

Issue 2300403003: DevTools: patch browser's Chrome version into Chrome user agents for emulation (Closed)
Patch Set: renames Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/network/NetworkConfigView.js ('k') | no next file » | 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 /** @type {!WebInspector.NetworkManager.Conditions} */ 692 /** @type {!WebInspector.NetworkManager.Conditions} */
693 this._networkConditions = WebInspector.NetworkManager.NoThrottlingConditions ; 693 this._networkConditions = WebInspector.NetworkManager.NoThrottlingConditions ;
694 } 694 }
695 695
696 /** @enum {symbol} */ 696 /** @enum {symbol} */
697 WebInspector.MultitargetNetworkManager.Events = { 697 WebInspector.MultitargetNetworkManager.Events = {
698 ConditionsChanged: Symbol("ConditionsChanged"), 698 ConditionsChanged: Symbol("ConditionsChanged"),
699 UserAgentChanged: Symbol("UserAgentChanged") 699 UserAgentChanged: Symbol("UserAgentChanged")
700 } 700 }
701 701
702 /**
703 * @param {string} uaString
704 * @return {string}
705 */
706 WebInspector.MultitargetNetworkManager.patchUserAgentWithChromeVersion = functio n(uaString)
707 {
708 // Patches Chrome/CriOS version from user agent ("1.2.3.4" when user agent i s: "Chrome/1.2.3.4").
709 var chromeRegex = new RegExp("(?:^|\\W)Chrome/(\\S+)");
710 var chromeMatch = navigator.userAgent.match(chromeRegex);
711 if (chromeMatch && chromeMatch.length > 1)
712 return String.sprintf(uaString, chromeMatch[1]);
713 return uaString;
714 }
715
702 WebInspector.MultitargetNetworkManager.prototype = { 716 WebInspector.MultitargetNetworkManager.prototype = {
703 /** 717 /**
704 * @override 718 * @override
705 * @param {!WebInspector.Target} target 719 * @param {!WebInspector.Target} target
706 */ 720 */
707 targetAdded: function(target) 721 targetAdded: function(target)
708 { 722 {
709 var networkAgent = target.networkAgent(); 723 var networkAgent = target.networkAgent();
710 if (this._extraHeaders) 724 if (this._extraHeaders)
711 networkAgent.setExtraHTTPHeaders(this._extraHeaders); 725 networkAgent.setExtraHTTPHeaders(this._extraHeaders);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 WebInspector.ResourceLoader.load(url, headers, callback); 927 WebInspector.ResourceLoader.load(url, headers, callback);
914 }, 928 },
915 929
916 __proto__: WebInspector.Object.prototype 930 __proto__: WebInspector.Object.prototype
917 } 931 }
918 932
919 /** 933 /**
920 * @type {!WebInspector.MultitargetNetworkManager} 934 * @type {!WebInspector.MultitargetNetworkManager}
921 */ 935 */
922 WebInspector.multitargetNetworkManager; 936 WebInspector.multitargetNetworkManager;
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/network/NetworkConfigView.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698