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

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

Issue 2310633002: DevTools: Reduce color parsing by passing in Color to ColorSwatch (Closed)
Patch Set: Get color from model Created 4 years, 3 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 /** 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 var parsedManifest = JSON.parse(data); 92 var parsedManifest = JSON.parse(data);
93 this._nameField.textContent = stringProperty("name"); 93 this._nameField.textContent = stringProperty("name");
94 this._shortNameField.textContent = stringProperty("short_name"); 94 this._shortNameField.textContent = stringProperty("short_name");
95 this._startURLField.removeChildren(); 95 this._startURLField.removeChildren();
96 var startURL = stringProperty("start_url"); 96 var startURL = stringProperty("start_url");
97 if (startURL) 97 if (startURL)
98 this._startURLField.appendChild(WebInspector.linkifyResourceAsNode(/ ** @type {string} */(WebInspector.ParsedURL.completeURL(url, startURL)), undefin ed, undefined, undefined, undefined, startURL)); 98 this._startURLField.appendChild(WebInspector.linkifyResourceAsNode(/ ** @type {string} */(WebInspector.ParsedURL.completeURL(url, startURL)), undefin ed, undefined, undefined, undefined, startURL));
99 99
100 this._themeColorSwatch.classList.toggle("hidden", !stringProperty("theme _color")); 100 this._themeColorSwatch.classList.toggle("hidden", !stringProperty("theme _color"));
101 this._themeColorSwatch.setColorText(stringProperty("theme_color") || "wh ite"); 101 var themeColor = WebInspector.Color.parse(stringProperty("theme_color") || "white") || WebInspector.Color.parse("white");
102 this._themeColorSwatch.setColor(/** @type {!WebInspector.Color} */ (them eColor));
102 this._backgroundColorSwatch.classList.toggle("hidden", !stringProperty(" background_color")); 103 this._backgroundColorSwatch.classList.toggle("hidden", !stringProperty(" background_color"));
103 this._backgroundColorSwatch.setColorText(stringProperty("background_colo r") || "white"); 104 var backgroundColor = WebInspector.Color.parse(stringProperty("backgroun d_color") || "white") || WebInspector.Color.parse("white");
105 this._backgroundColorSwatch.setColor(/** @type {!WebInspector.Color} */ (backgroundColor));
104 106
105 this._orientationField.textContent = stringProperty("orientation"); 107 this._orientationField.textContent = stringProperty("orientation");
106 this._displayField.textContent = stringProperty("display"); 108 this._displayField.textContent = stringProperty("display");
107 109
108 var icons = parsedManifest["icons"] || []; 110 var icons = parsedManifest["icons"] || [];
109 this._iconsSection.clearContent(); 111 this._iconsSection.clearContent();
110 for (var icon of icons) { 112 for (var icon of icons) {
111 var title = (icon["sizes"] || "") + "\n" + (icon["type"] || ""); 113 var title = (icon["sizes"] || "") + "\n" + (icon["type"] || "");
112 var field = this._iconsSection.appendField(title); 114 var field = this._iconsSection.appendField(title);
113 var imageElement = field.createChild("img"); 115 var imageElement = field.createChild("img");
(...skipping 19 matching lines...) Expand all
133 { 135 {
134 var target = WebInspector.targetManager.mainTarget(); 136 var target = WebInspector.targetManager.mainTarget();
135 if (target && target.hasBrowserCapability()) { 137 if (target && target.hasBrowserCapability()) {
136 target.pageAgent().requestAppBanner(); 138 target.pageAgent().requestAppBanner();
137 WebInspector.console.show(); 139 WebInspector.console.show();
138 } 140 }
139 }, 141 },
140 142
141 __proto__: WebInspector.VBox.prototype 143 __proto__: WebInspector.VBox.prototype
142 } 144 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698