Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/resources/AppManifestView.js

Issue 2693193006: DevTools: Show docs link on empty manifest landing page (Closed)
Patch Set: tweak text. max-width Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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._emptyView = new UI.EmptyWidget(Common.UIString('No web app manifest')) ; 13 var p = createElement('p');
14 p.textContent = 'A web manifest allows you to control how your app behaves w hen launched and displayed to the user. ';
pfeldman 2017/02/15 19:57:02 UI.formatLocalized('Lorem %s.', [linkElement])
paulirish 2017/02/23 01:49:30 sgtm. done
15 p.appendChild(UI.createExternalLink('https://developers.google.com/web/funda mentals/engage-and-retain/web-app-manifest/?utm_source=devtools',
16 Common.UIString('Read more about the web manifest')));
17 this._emptyView = new UI.EmptyWidget(Common.UIString('No manifest detected') , p);
pfeldman 2017/02/15 19:57:02 style: prefer var p = this._emptyView.appendParag
paulirish 2017/02/23 01:49:30 yeah this is much better. good idea.
18
14 19
15 this._emptyView.show(this.contentElement); 20 this._emptyView.show(this.contentElement);
16 this._emptyView.hideWidget(); 21 this._emptyView.hideWidget();
17 22
18 this._reportView = new UI.ReportView(Common.UIString('App Manifest')); 23 this._reportView = new UI.ReportView(Common.UIString('App Manifest'));
19 this._reportView.show(this.contentElement); 24 this._reportView.show(this.contentElement);
20 this._reportView.hideWidget(); 25 this._reportView.hideWidget();
21 26
22 this._errorsSection = this._reportView.appendSection(Common.UIString('Errors and warnings')); 27 this._errorsSection = this._reportView.appendSection(Common.UIString('Errors and warnings'));
23 this._identitySection = this._reportView.appendSection(Common.UIString('Iden tity')); 28 this._identitySection = this._reportView.appendSection(Common.UIString('Iden tity'));
24 var toolbar = this._identitySection.createToolbar(); 29 var toolbar = this._identitySection.createToolbar();
25 toolbar.renderAsLinks(); 30 toolbar.renderAsLinks();
26 var addToHomeScreen = 31 var addToHomeScreen =
27 new UI.ToolbarButton(Common.UIString('Add to homescreen'), undefined, Co mmon.UIString('Add to homescreen')); 32 new UI.ToolbarButton(Common.UIString('Add to homescreen'), undefined, Co mmon.UIString('Add to homescreen'));
28 addToHomeScreen.addEventListener(UI.ToolbarButton.Events.Click, this._addToH omescreen, this); 33 addToHomeScreen.addEventListener(UI.ToolbarButton.Events.Click, this._addToH omescreen, this);
29 toolbar.appendToolbarItem(addToHomeScreen); 34 toolbar.appendToolbarItem(addToHomeScreen);
30 35
31 this._manifestlessSection = this._reportView.appendSection(Common.UIString(' No manifest detected'));
32 var p = createElement('p');
33 p.textContent = 'A web manifest allows you to control how your app behaves w hen launched and displayed to the user. ';
34 p.appendChild(UI.createExternalLink('https://developers.google.com/web/progr essive-web-apps/?utm_source=devtools',
35 Common.UIString('Read more on developers.google.com')));
36 this._manifestlessSection.element.appendChild(p);
37 this._manifestlessSection.element.classList.add('hidden');
38
39 this._presentationSection = this._reportView.appendSection(Common.UIString(' Presentation')); 36 this._presentationSection = this._reportView.appendSection(Common.UIString(' Presentation'));
40 this._iconsSection = this._reportView.appendSection(Common.UIString('Icons') ); 37 this._iconsSection = this._reportView.appendSection(Common.UIString('Icons') );
41 38
42 this._nameField = this._identitySection.appendField(Common.UIString('Name')) ; 39 this._nameField = this._identitySection.appendField(Common.UIString('Name')) ;
43 this._shortNameField = this._identitySection.appendField(Common.UIString('Sh ort name')); 40 this._shortNameField = this._identitySection.appendField(Common.UIString('Sh ort name'));
44 41
45 this._startURLField = this._presentationSection.appendField(Common.UIString( 'Start URL')); 42 this._startURLField = this._presentationSection.appendField(Common.UIString( 'Start URL'));
46 43
47 var themeColorField = this._presentationSection.appendField(Common.UIString( 'Theme color')); 44 var themeColorField = this._presentationSection.appendField(Common.UIString( 'Theme color'));
48 this._themeColorSwatch = InlineEditor.ColorSwatch.create(); 45 this._themeColorSwatch = InlineEditor.ColorSwatch.create();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 this._reportView.showWidget(); 101 this._reportView.showWidget();
105 102
106 this._reportView.setURL(Components.Linkifier.linkifyURL(url)); 103 this._reportView.setURL(Components.Linkifier.linkifyURL(url));
107 this._errorsSection.clearContent(); 104 this._errorsSection.clearContent();
108 this._errorsSection.element.classList.toggle('hidden', !errors.length); 105 this._errorsSection.element.classList.toggle('hidden', !errors.length);
109 for (var error of errors) { 106 for (var error of errors) {
110 this._errorsSection.appendRow().appendChild( 107 this._errorsSection.appendRow().appendChild(
111 UI.createLabel(error.message, error.critical ? 'smallicon-error' : 'sm allicon-warning')); 108 UI.createLabel(error.message, error.critical ? 'smallicon-error' : 'sm allicon-warning'));
112 } 109 }
113 110
114 var manifestDataFound = !!data; 111 if (!data)
115 this._manifestlessSection.element.classList.toggle('hidden', manifestDataFou nd); 112 return;
116 this._presentationSection.element.classList.toggle('hidden', !manifestDataFo und);
117 this._iconsSection.element.classList.toggle('hidden', !manifestDataFound);
118 this._identitySection.element.classList.toggle('hidden', !manifestDataFound) ;
119 if (!data) return;
120 113
121 var parsedManifest = JSON.parse(data); 114 var parsedManifest = JSON.parse(data);
122 this._nameField.textContent = stringProperty('name'); 115 this._nameField.textContent = stringProperty('name');
123 this._shortNameField.textContent = stringProperty('short_name'); 116 this._shortNameField.textContent = stringProperty('short_name');
124 this._startURLField.removeChildren(); 117 this._startURLField.removeChildren();
125 var startURL = stringProperty('start_url'); 118 var startURL = stringProperty('start_url');
126 if (startURL) { 119 if (startURL) {
127 this._startURLField.appendChild(Components.Linkifier.linkifyURL( 120 this._startURLField.appendChild(Components.Linkifier.linkifyURL(
128 /** @type {string} */ (Common.ParsedURL.completeURL(url, startURL)), s tartURL)); 121 /** @type {string} */ (Common.ParsedURL.completeURL(url, startURL)), s tartURL));
129 } 122 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 * @param {!Common.Event} event 159 * @param {!Common.Event} event
167 */ 160 */
168 _addToHomescreen(event) { 161 _addToHomescreen(event) {
169 var target = SDK.targetManager.mainTarget(); 162 var target = SDK.targetManager.mainTarget();
170 if (target && target.hasBrowserCapability()) { 163 if (target && target.hasBrowserCapability()) {
171 target.pageAgent().requestAppBanner(); 164 target.pageAgent().requestAppBanner();
172 Common.console.show(); 165 Common.console.show();
173 } 166 }
174 } 167 }
175 }; 168 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698