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.SDKModelObserver<!SDK.ResourceTreeModel>} | 5 * @implements {SDK.SDKModelObserver<!SDK.ResourceTreeModel>} |
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); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 if (data.charCodeAt(0) === 0xFEFF) | 109 if (data.charCodeAt(0) === 0xFEFF) |
110 data = data.slice(1); // Trim the BOM as per https://tools.ietf.org/html/
rfc7159#section-8.1. | 110 data = data.slice(1); // Trim the BOM as per https://tools.ietf.org/html/
rfc7159#section-8.1. |
111 | 111 |
112 var parsedManifest = JSON.parse(data); | 112 var parsedManifest = JSON.parse(data); |
113 this._nameField.textContent = stringProperty('name'); | 113 this._nameField.textContent = stringProperty('name'); |
114 this._shortNameField.textContent = stringProperty('short_name'); | 114 this._shortNameField.textContent = stringProperty('short_name'); |
115 this._startURLField.removeChildren(); | 115 this._startURLField.removeChildren(); |
116 var startURL = stringProperty('start_url'); | 116 var startURL = stringProperty('start_url'); |
117 if (startURL) { | 117 if (startURL) { |
118 this._startURLField.appendChild(Components.Linkifier.linkifyURL( | 118 var completeURL = /** @type {string} */ (Common.ParsedURL.completeURL(url,
startURL)); |
119 /** @type {string} */ (Common.ParsedURL.completeURL(url, startURL)), s
tartURL)); | 119 this._startURLField.appendChild(Components.Linkifier.linkifyURL(completeUR
L, {text: startURL})); |
120 } | 120 } |
121 | 121 |
122 this._themeColorSwatch.classList.toggle('hidden', !stringProperty('theme_col
or')); | 122 this._themeColorSwatch.classList.toggle('hidden', !stringProperty('theme_col
or')); |
123 var themeColor = Common.Color.parse(stringProperty('theme_color') || 'white'
) || Common.Color.parse('white'); | 123 var themeColor = Common.Color.parse(stringProperty('theme_color') || 'white'
) || Common.Color.parse('white'); |
124 this._themeColorSwatch.setColor(/** @type {!Common.Color} */ (themeColor)); | 124 this._themeColorSwatch.setColor(/** @type {!Common.Color} */ (themeColor)); |
125 this._backgroundColorSwatch.classList.toggle('hidden', !stringProperty('back
ground_color')); | 125 this._backgroundColorSwatch.classList.toggle('hidden', !stringProperty('back
ground_color')); |
126 var backgroundColor = | 126 var backgroundColor = |
127 Common.Color.parse(stringProperty('background_color') || 'white') || Com
mon.Color.parse('white'); | 127 Common.Color.parse(stringProperty('background_color') || 'white') || Com
mon.Color.parse('white'); |
128 this._backgroundColorSwatch.setColor(/** @type {!Common.Color} */ (backgroun
dColor)); | 128 this._backgroundColorSwatch.setColor(/** @type {!Common.Color} */ (backgroun
dColor)); |
129 | 129 |
(...skipping 27 matching lines...) Expand all Loading... |
157 * @param {!Common.Event} event | 157 * @param {!Common.Event} event |
158 */ | 158 */ |
159 _addToHomescreen(event) { | 159 _addToHomescreen(event) { |
160 var target = SDK.targetManager.mainTarget(); | 160 var target = SDK.targetManager.mainTarget(); |
161 if (target && target.hasBrowserCapability()) { | 161 if (target && target.hasBrowserCapability()) { |
162 target.pageAgent().requestAppBanner(); | 162 target.pageAgent().requestAppBanner(); |
163 Common.console.show(); | 163 Common.console.show(); |
164 } | 164 } |
165 } | 165 } |
166 }; | 166 }; |
OLD | NEW |