Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
| 8 * @implements {WebInspector.TargetManager.Observer} | 8 * @implements {WebInspector.TargetManager.Observer} |
| 9 */ | 9 */ |
| 10 WebInspector.AppManifestView = function() | 10 WebInspector.AppManifestView = function() |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 WebInspector.targetManager.observeTargets(this); | 45 WebInspector.targetManager.observeTargets(this); |
| 46 } | 46 } |
| 47 | 47 |
| 48 WebInspector.AppManifestView.prototype = { | 48 WebInspector.AppManifestView.prototype = { |
| 49 /** | 49 /** |
| 50 * @override | 50 * @override |
| 51 * @param {!WebInspector.Target} target | 51 * @param {!WebInspector.Target} target |
| 52 */ | 52 */ |
| 53 targetAdded: function(target) | 53 targetAdded: function(target) |
| 54 { | 54 { |
| 55 if (this._target) | 55 if (this._resourceTreeModel) |
| 56 return; | 56 return; |
| 57 this._target = target; | 57 var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(target ); |
| 58 | 58 if (resourceTreeModel) { |
|
dgozman
2016/07/22 03:27:02
Let's observe DOM capability and assert here inste
eostroukhov-old
2016/07/22 23:27:43
Done.
| |
| 59 this._updateManifest(); | 59 this._resourceTreeModel = resourceTreeModel; |
| 60 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.E vents.MainFrameNavigated, this._updateManifest, this); | 60 this._updateManifest(); |
| 61 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Ev entTypes.MainFrameNavigated, this._updateManifest, this); | |
| 62 } | |
| 61 }, | 63 }, |
| 62 | 64 |
| 63 /** | 65 /** |
| 64 * @override | 66 * @override |
| 65 * @param {!WebInspector.Target} target | 67 * @param {!WebInspector.Target} target |
| 66 */ | 68 */ |
| 67 targetRemoved: function(target) | 69 targetRemoved: function(target) |
| 68 { | 70 { |
| 69 }, | 71 }, |
| 70 | 72 |
| 71 _updateManifest: function() | 73 _updateManifest: function() |
| 72 { | 74 { |
| 73 this._target.resourceTreeModel.fetchAppManifest(this._renderManifest.bin d(this)); | 75 if (this._resourceTreeModel) |
|
dgozman
2016/07/22 03:27:02
Judging by previous code, this method is never cal
eostroukhov-old
2016/07/22 23:27:43
Done.
| |
| 76 this._resourceTreeModel.fetchAppManifest(this._renderManifest.bind(t his)); | |
| 74 }, | 77 }, |
| 75 | 78 |
| 76 /** | 79 /** |
| 77 * @param {string} url | 80 * @param {string} url |
| 78 * @param {?string} data | 81 * @param {?string} data |
| 79 * @param {!Array<!PageAgent.AppManifestError>} errors | 82 * @param {!Array<!PageAgent.AppManifestError>} errors |
| 80 */ | 83 */ |
| 81 _renderManifest: function(url, data, errors) | 84 _renderManifest: function(url, data, errors) |
| 82 { | 85 { |
| 83 this._reportView.setURL(url); | 86 this._reportView.setURL(url); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 { | 136 { |
| 134 var target = WebInspector.targetManager.mainTarget(); | 137 var target = WebInspector.targetManager.mainTarget(); |
| 135 if (target && target.hasBrowserCapability()) { | 138 if (target && target.hasBrowserCapability()) { |
| 136 target.pageAgent().requestAppBanner(); | 139 target.pageAgent().requestAppBanner(); |
| 137 WebInspector.console.show(); | 140 WebInspector.console.show(); |
| 138 } | 141 } |
| 139 }, | 142 }, |
| 140 | 143 |
| 141 __proto__: WebInspector.VBox.prototype | 144 __proto__: WebInspector.VBox.prototype |
| 142 } | 145 } |
| OLD | NEW |