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 * @implements {SDK.TargetManager.Observer} | 5 * @implements {SDK.TargetManager.Observer} |
6 * @unrestricted | 6 * @unrestricted |
7 */ | 7 */ |
8 Resources.AppManifestView = class extends UI.VBox { | 8 Resources.AppManifestView = class extends UI.VBox { |
9 constructor() { | 9 constructor() { |
10 super(true); | 10 super(true); |
11 this.registerRequiredCSS('resources/appManifestView.css'); | 11 this.registerRequiredCSS('resources/appManifestView.css'); |
12 | 12 |
13 this._reportView = new UI.ReportView(Common.UIString('App Manifest')); | 13 this._reportView = new UI.ReportView(Common.UIString('App Manifest')); |
14 this._reportView.show(this.contentElement); | 14 this._reportView.show(this.contentElement); |
15 | 15 |
16 this._errorsSection = this._reportView.appendSection(Common.UIString('Errors
and warnings')); | 16 this._errorsSection = this._reportView.appendSection(Common.UIString('Errors
and warnings')); |
17 this._identitySection = this._reportView.appendSection(Common.UIString('Iden
tity')); | 17 this._identitySection = this._reportView.appendSection(Common.UIString('Iden
tity')); |
18 var toolbar = this._identitySection.createToolbar(); | 18 var toolbar = this._identitySection.createToolbar(); |
19 toolbar.renderAsLinks(); | 19 toolbar.renderAsLinks(); |
20 var addToHomeScreen = | 20 var addToHomeScreen = |
21 new UI.ToolbarButton(Common.UIString('Add to homescreen'), undefined, Co
mmon.UIString('Add to homescreen')); | 21 new UI.ToolbarButton(Common.UIString('Add to homescreen'), undefined, Co
mmon.UIString('Add to homescreen')); |
22 addToHomeScreen.addEventListener('click', this._addToHomescreen.bind(this)); | 22 addToHomeScreen.addEventListener(UI.ToolbarButton.Events.Click, this._addToH
omescreen, this); |
23 toolbar.appendToolbarItem(addToHomeScreen); | 23 toolbar.appendToolbarItem(addToHomeScreen); |
24 | 24 |
25 this._presentationSection = this._reportView.appendSection(Common.UIString('
Presentation')); | 25 this._presentationSection = this._reportView.appendSection(Common.UIString('
Presentation')); |
26 this._iconsSection = this._reportView.appendSection(Common.UIString('Icons')
); | 26 this._iconsSection = this._reportView.appendSection(Common.UIString('Icons')
); |
27 | 27 |
28 this._nameField = this._identitySection.appendField(Common.UIString('Name'))
; | 28 this._nameField = this._identitySection.appendField(Common.UIString('Name'))
; |
29 this._shortNameField = this._identitySection.appendField(Common.UIString('Sh
ort name')); | 29 this._shortNameField = this._identitySection.appendField(Common.UIString('Sh
ort name')); |
30 | 30 |
31 this._startURLField = this._presentationSection.appendField(Common.UIString(
'Start URL')); | 31 this._startURLField = this._presentationSection.appendField(Common.UIString(
'Start URL')); |
32 | 32 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 * @return {string} | 129 * @return {string} |
130 */ | 130 */ |
131 function stringProperty(name) { | 131 function stringProperty(name) { |
132 var value = parsedManifest[name]; | 132 var value = parsedManifest[name]; |
133 if (typeof value !== 'string') | 133 if (typeof value !== 'string') |
134 return ''; | 134 return ''; |
135 return value; | 135 return value; |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 _addToHomescreen() { | 139 /** |
| 140 * @param {!Common.Event} event |
| 141 */ |
| 142 _addToHomescreen(event) { |
140 var target = SDK.targetManager.mainTarget(); | 143 var target = SDK.targetManager.mainTarget(); |
141 if (target && target.hasBrowserCapability()) { | 144 if (target && target.hasBrowserCapability()) { |
142 target.pageAgent().requestAppBanner(); | 145 target.pageAgent().requestAppBanner(); |
143 Common.console.show(); | 146 Common.console.show(); |
144 } | 147 } |
145 } | 148 } |
146 }; | 149 }; |
OLD | NEW |