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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.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 /* 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 29 matching lines...) Expand all
40 40
41 var networkManager = target.model(SDK.NetworkManager); 41 var networkManager = target.model(SDK.NetworkManager);
42 if (networkManager) { 42 if (networkManager) {
43 networkManager.addEventListener(SDK.NetworkManager.Events.RequestFinished, this._onRequestFinished, this); 43 networkManager.addEventListener(SDK.NetworkManager.Events.RequestFinished, this._onRequestFinished, this);
44 networkManager.addEventListener( 44 networkManager.addEventListener(
45 SDK.NetworkManager.Events.RequestUpdateDropped, this._onRequestUpdateD ropped, this); 45 SDK.NetworkManager.Events.RequestUpdateDropped, this._onRequestUpdateD ropped, this);
46 } 46 }
47 47
48 this._agent = target.pageAgent(); 48 this._agent = target.pageAgent();
49 this._agent.enable(); 49 this._agent.enable();
50 this._securityOriginManager = SDK.SecurityOriginManager.fromTarget(target); 50 this._securityOriginManager = target.model(SDK.SecurityOriginManager);
51 51
52 this._fetchResourceTree(); 52 this._fetchResourceTree();
53 53
54 target.registerPageDispatcher(new SDK.PageDispatcher(this)); 54 target.registerPageDispatcher(new SDK.PageDispatcher(this));
55 55
56 this._pendingReloadOptions = null; 56 this._pendingReloadOptions = null;
57 this._reloadSuspensionCount = 0; 57 this._reloadSuspensionCount = 0;
58 this._isInterstitialShowing = false; 58 this._isInterstitialShowing = false;
59 } 59 }
60 60
61 /** 61 /**
62 * @param {!SDK.Target} target
63 * @return {?SDK.ResourceTreeModel}
64 */
65 static fromTarget(target) {
66 return target.model(SDK.ResourceTreeModel);
67 }
68
69 /**
70 * @return {!Array.<!SDK.ResourceTreeFrame>} 62 * @return {!Array.<!SDK.ResourceTreeFrame>}
71 */ 63 */
72 static frames() { 64 static frames() {
73 var result = []; 65 var result = [];
74 for (var target of SDK.targetManager.targets(SDK.Target.Capability.DOM)) 66 for (var resourceTreeModel of SDK.targetManager.models(SDK.ResourceTreeModel ))
75 result = result.concat(SDK.ResourceTreeModel.fromTarget(target)._frames.va luesArray()); 67 result = result.concat(resourceTreeModel._frames.valuesArray());
76 return result; 68 return result;
77 } 69 }
78 70
79 /** 71 /**
80 * @param {string} url 72 * @param {string} url
81 * @return {?SDK.Resource} 73 * @return {?SDK.Resource}
82 */ 74 */
83 static resourceForURL(url) { 75 static resourceForURL(url) {
84 for (var target of SDK.targetManager.targets(SDK.Target.Capability.DOM)) { 76 for (var resourceTreeModel of SDK.targetManager.models(SDK.ResourceTreeModel )) {
85 var mainFrame = SDK.ResourceTreeModel.fromTarget(target).mainFrame; 77 var mainFrame = resourceTreeModel.mainFrame;
86 var result = mainFrame ? mainFrame.resourceForURL(url) : null; 78 var result = mainFrame ? mainFrame.resourceForURL(url) : null;
87 if (result) 79 if (result)
88 return result; 80 return result;
89 } 81 }
90 return null; 82 return null;
91 } 83 }
92 84
93 /** 85 /**
94 * @param {boolean=} bypassCache 86 * @param {boolean=} bypassCache
95 * @param {string=} scriptToEvaluateOnLoad 87 * @param {string=} scriptToEvaluateOnLoad
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 this._resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Event s.InterstitialHidden); 857 this._resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Event s.InterstitialHidden);
866 } 858 }
867 859
868 /** 860 /**
869 * @override 861 * @override
870 */ 862 */
871 navigationRequested() { 863 navigationRequested() {
872 // Frontend is not interested in when navigations are requested. 864 // Frontend is not interested in when navigations are requested.
873 } 865 }
874 }; 866 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698