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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js

Issue 2782773002: [DevTools] Remove SDKModels' fromTarget methods (Closed)
Patch Set: addressed review comments Created 3 years, 8 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 Security.SecurityPanel = class extends UI.PanelWithSidebar { 8 Security.SecurityPanel = class extends UI.PanelWithSidebar {
9 constructor() { 9 constructor() {
10 super('security'); 10 super('security');
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 258
259 /** 259 /**
260 * @param {!Network.NetworkLogView.MixedContentFilterValues} filterKey 260 * @param {!Network.NetworkLogView.MixedContentFilterValues} filterKey
261 * @return {number} 261 * @return {number}
262 */ 262 */
263 filterRequestCount(filterKey) { 263 filterRequestCount(filterKey) {
264 return this._filterRequestCounts.get(filterKey) || 0; 264 return this._filterRequestCounts.get(filterKey) || 0;
265 } 265 }
266 266
267 showCertificateViewer() { 267 showCertificateViewer() {
268 var securityModel = Security.SecurityModel.fromTarget(this._target); 268 this._target.model(Security.SecurityModel).showCertificateViewer();
269 securityModel.showCertificateViewer();
270 } 269 }
271 270
272 /** 271 /**
273 * @param {!Protocol.Security.SecurityState} stateA 272 * @param {!Protocol.Security.SecurityState} stateA
274 * @param {!Protocol.Security.SecurityState} stateB 273 * @param {!Protocol.Security.SecurityState} stateB
275 * @return {!Protocol.Security.SecurityState} 274 * @return {!Protocol.Security.SecurityState}
276 */ 275 */
277 _securityStateMin(stateA, stateB) { 276 _securityStateMin(stateA, stateB) {
278 return Security.SecurityModel.SecurityStateComparator(stateA, stateB) < 0 ? stateA : stateB; 277 return Security.SecurityModel.SecurityStateComparator(stateA, stateB) < 0 ? stateA : stateB;
279 } 278 }
280 279
281 /** 280 /**
282 * @override 281 * @override
283 * @param {!SDK.Target} target 282 * @param {!SDK.Target} target
284 */ 283 */
285 targetAdded(target) { 284 targetAdded(target) {
286 if (this._target) 285 if (this._target)
287 return; 286 return;
288 287
289 var listeners = []; 288 var listeners = [];
290 var resourceTreeModel = SDK.ResourceTreeModel.fromTarget(target); 289 var resourceTreeModel = target.model(SDK.ResourceTreeModel);
291 if (resourceTreeModel) { 290 if (resourceTreeModel) {
292 listeners = listeners.concat([ 291 listeners = listeners.concat([
293 resourceTreeModel.addEventListener( 292 resourceTreeModel.addEventListener(
294 SDK.ResourceTreeModel.Events.MainFrameNavigated, this._onMainFrameNa vigated, this), 293 SDK.ResourceTreeModel.Events.MainFrameNavigated, this._onMainFrameNa vigated, this),
295 resourceTreeModel.addEventListener( 294 resourceTreeModel.addEventListener(
296 SDK.ResourceTreeModel.Events.InterstitialShown, this._onInterstitial Shown, this), 295 SDK.ResourceTreeModel.Events.InterstitialShown, this._onInterstitial Shown, this),
297 resourceTreeModel.addEventListener( 296 resourceTreeModel.addEventListener(
298 SDK.ResourceTreeModel.Events.InterstitialHidden, this._onInterstitia lHidden, this), 297 SDK.ResourceTreeModel.Events.InterstitialHidden, this._onInterstitia lHidden, this),
299 ]); 298 ]);
300 299
301 if (resourceTreeModel.isInterstitialShowing()) 300 if (resourceTreeModel.isInterstitialShowing())
302 this._onInterstitialShown(); 301 this._onInterstitialShown();
303 } 302 }
304 303
305 var networkManager = SDK.NetworkManager.fromTarget(target); 304 var networkManager = target.model(SDK.NetworkManager);
306 if (networkManager) { 305 if (networkManager) {
307 listeners = listeners.concat([ 306 listeners = listeners.concat([
308 networkManager.addEventListener(SDK.NetworkManager.Events.ResponseReceiv ed, this._onResponseReceived, this), 307 networkManager.addEventListener(SDK.NetworkManager.Events.ResponseReceiv ed, this._onResponseReceived, this),
309 networkManager.addEventListener(SDK.NetworkManager.Events.RequestFinishe d, this._onRequestFinished, this), 308 networkManager.addEventListener(SDK.NetworkManager.Events.RequestFinishe d, this._onRequestFinished, this),
310 ]); 309 ]);
311 } 310 }
312 311
313 var securityModel = Security.SecurityModel.fromTarget(target); 312 var securityModel = target.model(Security.SecurityModel);
314 if (securityModel) { 313 if (securityModel) {
315 listeners = listeners.concat([securityModel.addEventListener( 314 listeners = listeners.concat([securityModel.addEventListener(
316 Security.SecurityModel.Events.SecurityStateChanged, this._onSecuritySt ateChanged, this)]); 315 Security.SecurityModel.Events.SecurityStateChanged, this._onSecuritySt ateChanged, this)]);
317 } 316 }
318 317
319 this._target = target; 318 this._target = target;
320 this._eventListeners.set(target, listeners); 319 this._eventListeners.set(target, listeners);
321 } 320 }
322 321
323 /** 322 /**
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 var row = this._element.createChild('div', 'details-table-row'); 1068 var row = this._element.createChild('div', 'details-table-row');
1070 row.createChild('div').textContent = key; 1069 row.createChild('div').textContent = key;
1071 1070
1072 var valueDiv = row.createChild('div'); 1071 var valueDiv = row.createChild('div');
1073 if (typeof value === 'string') 1072 if (typeof value === 'string')
1074 valueDiv.textContent = value; 1073 valueDiv.textContent = value;
1075 else 1074 else
1076 valueDiv.appendChild(value); 1075 valueDiv.appendChild(value);
1077 } 1076 }
1078 }; 1077 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698