| 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 for (var resourceTreeModel of SDK.targetManager.models(SDK.ResourceTreeModel
)) |
| 146 resourceTreeModel.reloadPage(); |
| 145 } | 147 } |
| 146 | 148 |
| 147 _didLoadResource() { | 149 _didLoadResource() { |
| 148 if (this._pageReloadCallback && this._progress && this._progress.isCanceled(
)) | 150 if (this._pageReloadCallback && this._progress && this._progress.isCanceled(
)) |
| 149 this._pageReloadCallback(); | 151 this._pageReloadCallback(); |
| 150 } | 152 } |
| 151 | 153 |
| 152 _didMainResourceLoad() { | 154 /** |
| 155 * @param {!Common.Event} event |
| 156 */ |
| 157 _didMainResourceLoad(event) { |
| 158 if (event.data.resourceTreeModel.target() !== SDK.targetManager.mainTarget()
) |
| 159 return; |
| 153 if (this._pageReloadCallback) { | 160 if (this._pageReloadCallback) { |
| 154 var callback = this._pageReloadCallback; | 161 var callback = this._pageReloadCallback; |
| 155 delete this._pageReloadCallback; | 162 delete this._pageReloadCallback; |
| 156 callback(); | 163 callback(); |
| 157 } | 164 } |
| 158 } | 165 } |
| 159 | 166 |
| 160 clearResults() { | 167 clearResults() { |
| 161 this._auditsPanel.clearResults(); | 168 this._auditsPanel.clearResults(); |
| 162 } | 169 } |
| 163 }; | 170 }; |
| OLD | NEW |