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

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: 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 data = "{}"; 90 data = "{}";
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 if (stringProperty("theme_color")) {
101 this._themeColorSwatch.setColorText(stringProperty("theme_color") || "wh ite"); 101 this._themeColorSwatch.classList.remove("hidden");
102 this._backgroundColorSwatch.classList.toggle("hidden", !stringProperty(" background_color")); 102 var themeColor = WebInspector.Color.parse(stringProperty("theme_colo r")) || WebInspector.Color.parse("white");
dgozman 2016/09/02 22:08:01 This is a semantic change. Leave it as parse(strin
flandy 2016/09/02 23:09:18 We need the extra || WebInspector.Color.parse("whi
103 this._backgroundColorSwatch.setColorText(stringProperty("background_colo r") || "white"); 103 this._themeColorSwatch.setColor(/** @type {!WebInspector.Color} */ ( themeColor));
104 } else {
105 this._themeColorSwatch.classList.add("hidden");
106 }
107
108 if (stringProperty("background_color")) {
109 this._backgroundColorSwatch.classList.remove("hidden");
110 var backgroundColor = WebInspector.Color.parse(stringProperty("backg round_color")) || WebInspector.Color.parse("white");
dgozman 2016/09/02 22:08:01 ditto
111 this._backgroundColorSwatch.setColor(/** @type {!WebInspector.Color} */ (backgroundColor));
112 } else {
113 this._backgroundColorSwatch.classList.add("hidden");
114 }
104 115
105 this._orientationField.textContent = stringProperty("orientation"); 116 this._orientationField.textContent = stringProperty("orientation");
106 this._displayField.textContent = stringProperty("display"); 117 this._displayField.textContent = stringProperty("display");
107 118
108 var icons = parsedManifest["icons"] || []; 119 var icons = parsedManifest["icons"] || [];
109 this._iconsSection.clearContent(); 120 this._iconsSection.clearContent();
110 for (var icon of icons) { 121 for (var icon of icons) {
111 var title = (icon["sizes"] || "") + "\n" + (icon["type"] || ""); 122 var title = (icon["sizes"] || "") + "\n" + (icon["type"] || "");
112 var field = this._iconsSection.appendField(title); 123 var field = this._iconsSection.appendField(title);
113 var imageElement = field.createChild("img"); 124 var imageElement = field.createChild("img");
(...skipping 19 matching lines...) Expand all
133 { 144 {
134 var target = WebInspector.targetManager.mainTarget(); 145 var target = WebInspector.targetManager.mainTarget();
135 if (target && target.hasBrowserCapability()) { 146 if (target && target.hasBrowserCapability()) {
136 target.pageAgent().requestAppBanner(); 147 target.pageAgent().requestAppBanner();
137 WebInspector.console.show(); 148 WebInspector.console.show();
138 } 149 }
139 }, 150 },
140 151
141 __proto__: WebInspector.VBox.prototype 152 __proto__: WebInspector.VBox.prototype
142 } 153 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698