OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 /** | 32 /** |
33 * @unrestricted | 33 * @unrestricted |
34 */ | 34 */ |
35 Audits.AuditController = class { | 35 Audits.AuditController = class { |
36 /** | 36 /** |
37 * @param {!Audits.AuditsPanel} auditsPanel | 37 * @param {!Audits.AuditsPanel} auditsPanel |
38 */ | 38 */ |
39 constructor(auditsPanel) { | 39 constructor(auditsPanel) { |
40 this._auditsPanel = auditsPanel; | 40 this._auditsPanel = auditsPanel; |
41 SDK.targetManager.addEventListener(SDK.TargetManager.Events.Load, this._didM
ainResourceLoad, this); | 41 SDK.targetManager.addModelListener( |
| 42 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.Load, this._didMainR
esourceLoad, this); |
42 SDK.targetManager.addModelListener( | 43 SDK.targetManager.addModelListener( |
43 SDK.NetworkManager, SDK.NetworkManager.Events.RequestFinished, this._did
LoadResource, this); | 44 SDK.NetworkManager, SDK.NetworkManager.Events.RequestFinished, this._did
LoadResource, this); |
44 } | 45 } |
45 | 46 |
46 /** | 47 /** |
47 * @param {!SDK.Target} target | 48 * @param {!SDK.Target} target |
48 * @param {!Array.<!Audits.AuditCategory>} categories | 49 * @param {!Array.<!Audits.AuditCategory>} categories |
49 * @param {function(string, !Array.<!Audits.AuditCategoryResult>)} resultCallb
ack | 50 * @param {function(string, !Array.<!Audits.AuditCategoryResult>)} resultCallb
ack |
50 */ | 51 */ |
51 _executeAudit(target, categories, resultCallback) { | 52 _executeAudit(target, categories, resultCallback) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 135 } |
135 startedCallback(); | 136 startedCallback(); |
136 this._executeAudit(target, categories, this._auditFinishedCallback.bind(this
)); | 137 this._executeAudit(target, categories, this._auditFinishedCallback.bind(this
)); |
137 } | 138 } |
138 | 139 |
139 /** | 140 /** |
140 * @param {function()=} callback | 141 * @param {function()=} callback |
141 */ | 142 */ |
142 _reloadResources(callback) { | 143 _reloadResources(callback) { |
143 this._pageReloadCallback = callback; | 144 this._pageReloadCallback = callback; |
144 SDK.targetManager.reloadPage(); | 145 SDK.ResourceTreeModel.reloadAllPages(); |
145 } | 146 } |
146 | 147 |
147 _didLoadResource() { | 148 _didLoadResource() { |
148 if (this._pageReloadCallback && this._progress && this._progress.isCanceled(
)) | 149 if (this._pageReloadCallback && this._progress && this._progress.isCanceled(
)) |
149 this._pageReloadCallback(); | 150 this._pageReloadCallback(); |
150 } | 151 } |
151 | 152 |
152 _didMainResourceLoad() { | 153 /** |
| 154 * @param {!Common.Event} event |
| 155 */ |
| 156 _didMainResourceLoad(event) { |
| 157 if (event.data.resourceTreeModel.target() !== SDK.targetManager.mainTarget()
) |
| 158 return; |
153 if (this._pageReloadCallback) { | 159 if (this._pageReloadCallback) { |
154 var callback = this._pageReloadCallback; | 160 var callback = this._pageReloadCallback; |
155 delete this._pageReloadCallback; | 161 delete this._pageReloadCallback; |
156 callback(); | 162 callback(); |
157 } | 163 } |
158 } | 164 } |
159 | 165 |
160 clearResults() { | 166 clearResults() { |
161 this._auditsPanel.clearResults(); | 167 this._auditsPanel.clearResults(); |
162 } | 168 } |
163 }; | 169 }; |
OLD | NEW |