Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 | 53 |
| 54 /** @type {!Map<!SecurityAgent.CertificateId, !Promise<!NetworkAgent.Certifi cateDetails>>} */ | 54 /** @type {!Map<!SecurityAgent.CertificateId, !Promise<!NetworkAgent.Certifi cateDetails>>} */ |
| 55 this._certificateDetailsCache = new Map(); | 55 this._certificateDetailsCache = new Map(); |
| 56 | 56 |
| 57 this._bypassServiceWorkerSetting = WebInspector.settings.createSetting("bypa ssServiceWorker", false); | 57 this._bypassServiceWorkerSetting = WebInspector.settings.createSetting("bypa ssServiceWorker", false); |
| 58 if (this._bypassServiceWorkerSetting.get()) | 58 if (this._bypassServiceWorkerSetting.get()) |
| 59 this._bypassServiceWorkerChanged(); | 59 this._bypassServiceWorkerChanged(); |
| 60 this._bypassServiceWorkerSetting.addChangeListener(this._bypassServiceWorker Changed, this); | 60 this._bypassServiceWorkerSetting.addChangeListener(this._bypassServiceWorker Changed, this); |
| 61 | 61 |
| 62 WebInspector.moduleSetting("cacheDisabled").addChangeListener(this._cacheDis abledSettingChanged, this); | 62 WebInspector.moduleSetting("cacheDisabled").addChangeListener(this._cacheDis abledSettingChanged, this); |
| 63 | |
| 64 console.assert(!target[WebInspector.NetworkManager._symbol]); | |
| 65 target[WebInspector.NetworkManager._symbol] = this; | |
| 63 } | 66 } |
| 64 | 67 |
| 65 WebInspector.NetworkManager.EventTypes = { | 68 WebInspector.NetworkManager.EventTypes = { |
| 66 RequestStarted: "RequestStarted", | 69 RequestStarted: "RequestStarted", |
| 67 RequestUpdated: "RequestUpdated", | 70 RequestUpdated: "RequestUpdated", |
| 68 RequestFinished: "RequestFinished", | 71 RequestFinished: "RequestFinished", |
| 69 RequestUpdateDropped: "RequestUpdateDropped", | 72 RequestUpdateDropped: "RequestUpdateDropped", |
| 70 ResponseReceived: "ResponseReceived" | 73 ResponseReceived: "ResponseReceived" |
| 71 } | 74 } |
| 72 | 75 |
| 73 WebInspector.NetworkManager._MIMETypes = { | 76 WebInspector.NetworkManager._MIMETypes = { |
| 74 "text/html": {"document": true}, | 77 "text/html": {"document": true}, |
| 75 "text/xml": {"document": true}, | 78 "text/xml": {"document": true}, |
| 76 "text/plain": {"document": true}, | 79 "text/plain": {"document": true}, |
| 77 "application/xhtml+xml": {"document": true}, | 80 "application/xhtml+xml": {"document": true}, |
| 78 "image/svg+xml": {"document": true}, | 81 "image/svg+xml": {"document": true}, |
| 79 "text/css": {"stylesheet": true}, | 82 "text/css": {"stylesheet": true}, |
| 80 "text/xsl": {"stylesheet": true}, | 83 "text/xsl": {"stylesheet": true}, |
| 81 "text/vtt": {"texttrack": true}, | 84 "text/vtt": {"texttrack": true}, |
| 82 } | 85 } |
| 83 | 86 |
| 87 WebInspector.NetworkManager._symbol = Symbol("NetworkManager"); | |
| 88 | |
| 89 /** | |
| 90 * @param {!WebInspector.Target} target | |
| 91 * @return {?WebInspector.NetworkManager} | |
| 92 */ | |
| 93 WebInspector.NetworkManager.fromTarget = function(target) | |
| 94 { | |
| 95 return target[WebInspector.NetworkManager._symbol] || null; | |
|
dgozman
2016/07/05 17:54:31
target.model(WebInspector.NetworkManager)
eostroukhov-old
2016/07/06 20:37:53
Done.
| |
| 96 } | |
| 97 | |
| 84 /** @typedef {{download: number, upload: number, latency: number, title: string} } */ | 98 /** @typedef {{download: number, upload: number, latency: number, title: string} } */ |
| 85 WebInspector.NetworkManager.Conditions; | 99 WebInspector.NetworkManager.Conditions; |
| 86 /** @type {!WebInspector.NetworkManager.Conditions} */ | 100 /** @type {!WebInspector.NetworkManager.Conditions} */ |
| 87 WebInspector.NetworkManager.NoThrottlingConditions = {title: WebInspector.UIStri ng("No throttling"), download: -1, upload: -1, latency: 0}; | 101 WebInspector.NetworkManager.NoThrottlingConditions = {title: WebInspector.UIStri ng("No throttling"), download: -1, upload: -1, latency: 0}; |
| 88 /** @type {!WebInspector.NetworkManager.Conditions} */ | 102 /** @type {!WebInspector.NetworkManager.Conditions} */ |
| 89 WebInspector.NetworkManager.OfflineConditions = {title: WebInspector.UIString("O ffline"), download: 0, upload: 0, latency: 0}; | 103 WebInspector.NetworkManager.OfflineConditions = {title: WebInspector.UIString("O ffline"), download: 0, upload: 0, latency: 0}; |
| 90 | 104 |
| 91 /** | 105 /** |
| 92 * @param {!WebInspector.NetworkManager.Conditions} conditions | 106 * @param {!WebInspector.NetworkManager.Conditions} conditions |
| 93 * @return {!NetworkAgent.ConnectionType} | 107 * @return {!NetworkAgent.ConnectionType} |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 | 141 |
| 128 /** | 142 /** |
| 129 * @param {!WebInspector.Event} event | 143 * @param {!WebInspector.Event} event |
| 130 */ | 144 */ |
| 131 _cacheDisabledSettingChanged: function(event) | 145 _cacheDisabledSettingChanged: function(event) |
| 132 { | 146 { |
| 133 var enabled = /** @type {boolean} */ (event.data); | 147 var enabled = /** @type {boolean} */ (event.data); |
| 134 this._networkAgent.setCacheDisabled(enabled); | 148 this._networkAgent.setCacheDisabled(enabled); |
| 135 }, | 149 }, |
| 136 | 150 |
| 137 dispose: function() | 151 dispose: function(event) |
|
dgozman
2016/07/05 17:54:31
Remove the parameter.
eostroukhov-old
2016/07/06 20:37:53
Done.
| |
| 138 { | 152 { |
| 139 WebInspector.moduleSetting("cacheDisabled").removeChangeListener(this._c acheDisabledSettingChanged, this); | 153 WebInspector.moduleSetting("cacheDisabled").removeChangeListener(this._c acheDisabledSettingChanged, this); |
| 140 }, | 154 }, |
| 141 | 155 |
| 142 /** | 156 /** |
| 143 * @param {!SecurityAgent.CertificateId} certificateId | 157 * @param {!SecurityAgent.CertificateId} certificateId |
| 144 * @return {!Promise<!NetworkAgent.CertificateDetails>} | 158 * @return {!Promise<!NetworkAgent.CertificateDetails>} |
| 145 */ | 159 */ |
| 146 certificateDetailsPromise: function(certificateId) | 160 certificateDetailsPromise: function(certificateId) |
| 147 { | 161 { |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 934 WebInspector.ResourceLoader.load(url, headers, callback); | 948 WebInspector.ResourceLoader.load(url, headers, callback); |
| 935 }, | 949 }, |
| 936 | 950 |
| 937 __proto__: WebInspector.Object.prototype | 951 __proto__: WebInspector.Object.prototype |
| 938 } | 952 } |
| 939 | 953 |
| 940 /** | 954 /** |
| 941 * @type {!WebInspector.MultitargetNetworkManager} | 955 * @type {!WebInspector.MultitargetNetworkManager} |
| 942 */ | 956 */ |
| 943 WebInspector.multitargetNetworkManager; | 957 WebInspector.multitargetNetworkManager; |
| OLD | NEW |