| 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 24 matching lines...) Expand all Loading... |
| 35 this._themeColorSwatch = WebInspector.ColorSwatch.create(); | 35 this._themeColorSwatch = WebInspector.ColorSwatch.create(); |
| 36 themeColorField.appendChild(this._themeColorSwatch); | 36 themeColorField.appendChild(this._themeColorSwatch); |
| 37 | 37 |
| 38 var backgroundColorField = this._presentationSection.appendField(WebInspecto
r.UIString("Background color")); | 38 var backgroundColorField = this._presentationSection.appendField(WebInspecto
r.UIString("Background color")); |
| 39 this._backgroundColorSwatch = WebInspector.ColorSwatch.create(); | 39 this._backgroundColorSwatch = WebInspector.ColorSwatch.create(); |
| 40 backgroundColorField.appendChild(this._backgroundColorSwatch); | 40 backgroundColorField.appendChild(this._backgroundColorSwatch); |
| 41 | 41 |
| 42 this._orientationField = this._presentationSection.appendField(WebInspector.
UIString("Orientation")); | 42 this._orientationField = this._presentationSection.appendField(WebInspector.
UIString("Orientation")); |
| 43 this._displayField = this._presentationSection.appendField(WebInspector.UISt
ring("Display")); | 43 this._displayField = this._presentationSection.appendField(WebInspector.UISt
ring("Display")); |
| 44 | 44 |
| 45 WebInspector.targetManager.observeTargets(this); | 45 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili
ty.DOM); |
| 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 this._resourceTreeModel = resourceTreeModel; |
| 59 this._updateManifest(); | 59 this._updateManifest(); |
| 60 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.E
vents.MainFrameNavigated, this._updateManifest, this); | 60 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventT
ypes.MainFrameNavigated, this._updateManifest, this); |
| 61 }, | 61 }, |
| 62 | 62 |
| 63 /** | 63 /** |
| 64 * @override | 64 * @override |
| 65 * @param {!WebInspector.Target} target | 65 * @param {!WebInspector.Target} target |
| 66 */ | 66 */ |
| 67 targetRemoved: function(target) | 67 targetRemoved: function(target) |
| 68 { | 68 { |
| 69 }, | 69 }, |
| 70 | 70 |
| 71 _updateManifest: function() | 71 _updateManifest: function() |
| 72 { | 72 { |
| 73 this._target.resourceTreeModel.fetchAppManifest(this._renderManifest.bin
d(this)); | 73 this._resourceTreeModel.fetchAppManifest(this._renderManifest.bind(this)
); |
| 74 }, | 74 }, |
| 75 | 75 |
| 76 /** | 76 /** |
| 77 * @param {string} url | 77 * @param {string} url |
| 78 * @param {?string} data | 78 * @param {?string} data |
| 79 * @param {!Array<!PageAgent.AppManifestError>} errors | 79 * @param {!Array<!PageAgent.AppManifestError>} errors |
| 80 */ | 80 */ |
| 81 _renderManifest: function(url, data, errors) | 81 _renderManifest: function(url, data, errors) |
| 82 { | 82 { |
| 83 this._reportView.setURL(url); | 83 this._reportView.setURL(url); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 { | 133 { |
| 134 var target = WebInspector.targetManager.mainTarget(); | 134 var target = WebInspector.targetManager.mainTarget(); |
| 135 if (target && target.hasBrowserCapability()) { | 135 if (target && target.hasBrowserCapability()) { |
| 136 target.pageAgent().requestAppBanner(); | 136 target.pageAgent().requestAppBanner(); |
| 137 WebInspector.console.show(); | 137 WebInspector.console.show(); |
| 138 } | 138 } |
| 139 }, | 139 }, |
| 140 | 140 |
| 141 __proto__: WebInspector.VBox.prototype | 141 __proto__: WebInspector.VBox.prototype |
| 142 } | 142 } |
| OLD | NEW |