OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.PanelWithSidebar} | 7 * @extends {WebInspector.PanelWithSidebar} |
8 * @implements {WebInspector.TargetManager.Observer} | 8 * @implements {WebInspector.TargetManager.Observer} |
9 */ | 9 */ |
10 WebInspector.SecurityPanel = function() | 10 WebInspector.SecurityPanel = function() |
11 { | 11 { |
12 WebInspector.PanelWithSidebar.call(this, "security"); | 12 WebInspector.PanelWithSidebar.call(this, "security"); |
13 this.registerRequiredCSS("security/securityPanel.css"); | 13 this.registerRequiredCSS("security/mainView.css"); |
14 this.registerRequiredCSS("security/lockIcon.css"); | 14 this.registerRequiredCSS("security/lockIcon.css"); |
15 | 15 |
16 var sidebarTree = new TreeOutlineInShadow(); | 16 var sidebarTree = new TreeOutlineInShadow(); |
17 sidebarTree.element.classList.add("sidebar-tree"); | 17 sidebarTree.element.classList.add("sidebar-tree"); |
18 this.panelSidebarElement().appendChild(sidebarTree.element); | 18 this.panelSidebarElement().appendChild(sidebarTree.element); |
19 sidebarTree.registerRequiredCSS("security/sidebar.css"); | 19 sidebarTree.registerRequiredCSS("security/sidebar.css"); |
20 sidebarTree.registerRequiredCSS("security/lockIcon.css"); | 20 sidebarTree.registerRequiredCSS("security/lockIcon.css"); |
21 this.setDefaultFocusedElement(sidebarTree.element); | 21 this.setDefaultFocusedElement(sidebarTree.element); |
22 | 22 |
23 this._sidebarMainViewElement = new WebInspector.SecurityMainViewSidebarTreeE lement(this); | 23 this._sidebarMainViewElement = new WebInspector.SecurityMainViewSidebarTreeE lement(this); |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
323 * @extends {WebInspector.VBox} | 323 * @extends {WebInspector.VBox} |
324 */ | 324 */ |
325 WebInspector.SecurityMainView = function() | 325 WebInspector.SecurityMainView = function() |
326 { | 326 { |
327 WebInspector.VBox.call(this); | 327 WebInspector.VBox.call(this); |
328 this.setMinimumSize(100, 100); | 328 this.setMinimumSize(100, 100); |
329 | 329 |
330 this.element.classList.add("security-main-view"); | 330 this.element.classList.add("security-main-view"); |
331 | 331 |
332 // Create security state section. | 332 // Create security state section. |
333 var securityStateSection = this.element.createChild("div"); | 333 var summarySection = this.element.createChild("div", "section"); |
334 this._lockIcon = securityStateSection.createChild("div", "lock-icon"); | 334 summarySection.classList.add("summary"); |
335 this._securityStateText = securityStateSection.createChild("div", "security- state"); | 335 |
336 securityStateSection.createChild("hr"); | 336 this._summarylockIcon = summarySection.createChild("div", "lock-icon"); |
337 this._securityExplanations = securityStateSection.createChild("div", "securi ty-explanations"); | 337 |
338 var text = summarySection.createChild("div", "text"); | |
339 text.createChild("div", "title").textContent = WebInspector.UIString("Securi ty Overview"); | |
340 this._summaryExplanation = text.createChild("div", "explanation"); | |
341 | |
342 this._securityExplanations = this.element.createChild("div", "security-expla nations"); | |
338 | 343 |
339 } | 344 } |
340 | 345 |
341 WebInspector.SecurityMainView.prototype = { | 346 WebInspector.SecurityMainView.prototype = { |
342 /** | 347 /** |
343 * @param {!SecurityAgent.SecurityStateExplanation} explanation | 348 * @param {!SecurityAgent.SecurityStateExplanation} explanation |
344 */ | 349 */ |
345 _addExplanation: function(explanation) | 350 _addExplanation: function(explanation) |
346 { | 351 { |
347 var explanationDiv = this._securityExplanations.createChild("div", "secu rity-explanation"); | 352 var explanationSection = this._securityExplanations.createChild("div", " section"); |
353 explanationSection.classList.add("explanation"); | |
348 | 354 |
349 var explanationLockIcon = explanationDiv.createChild("div", "lock-icon") ; | 355 explanationSection.createChild("div", "lock-icon").classList.add("lock-i con-" + explanation.securityState); |
350 explanationLockIcon.classList.add("lock-icon-" + explanation.securitySta te); | 356 var text = explanationSection.createChild("div", "text"); |
351 explanationDiv.createChild("div", "explanation-title").textContent = Web Inspector.UIString(explanation.summary); | 357 text.createChild("div", "title").textContent = explanation.summary |
dgozman
2015/08/26 20:28:41
nit: semicolon missing
lgarron
2015/08/26 21:42:43
Done.
(One of these days I'll write myself an ext
| |
352 explanationDiv.createChild("div", "explanation-text").textContent = WebI nspector.UIString(explanation.description); | 358 text.createChild("div", "explanation").textContent = explanation.descrip tion; |
353 }, | 359 }, |
354 | 360 |
355 /** | 361 /** |
356 * @param {!SecurityAgent.SecurityState} newSecurityState | 362 * @param {!SecurityAgent.SecurityState} newSecurityState |
357 * @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations | 363 * @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations |
358 */ | 364 */ |
359 updateSecurityState: function(newSecurityState, explanations) | 365 updateSecurityState: function(newSecurityState, explanations) |
360 { | 366 { |
361 // Remove old state. | 367 // Remove old state. |
362 // It's safe to call this even when this._securityState is undefined. | 368 // It's safe to call this even when this._securityState is undefined. |
363 this._lockIcon.classList.remove("lock-icon-" + this._securityState); | 369 this._summarylockIcon.classList.remove("lock-icon-" + this._securityStat e); |
370 this._summaryExplanation.classList.remove("security-state-" + this._secu rityState); | |
364 | 371 |
365 // Add new state. | 372 // Add new state. |
366 this._securityState = newSecurityState; | 373 this._securityState = newSecurityState; |
367 this._lockIcon.classList.add("lock-icon-" + this._securityState); | 374 this._summarylockIcon.classList.add("lock-icon-" + this._securityState); |
368 this._securityStateText.textContent = WebInspector.UIString("Page securi ty state: %s", this._securityState); | 375 this._summaryExplanation.classList.add("security-state-" + this._securit yState); |
376 var summaryExplanationStrings = { | |
377 "unknown": WebInspector.UIString("This security of this page is unk nown."), | |
378 "insecure": WebInspector.UIString("This page is insecure (broken HTT PS)."), | |
379 "neutral": WebInspector.UIString("This page is not secure."), | |
380 "secure": WebInspector.UIString("This page is secure (valid HTTPS) .") | |
381 } | |
382 this._summaryExplanation.textContent = summaryExplanationStrings[this._s ecurityState]; | |
369 | 383 |
370 this._securityExplanations.removeChildren(); | 384 this._securityExplanations.removeChildren(); |
371 for (var explanation of explanations) | 385 for (var explanation of explanations) |
372 this._addExplanation(explanation); | 386 this._addExplanation(explanation); |
373 }, | 387 }, |
374 | 388 |
375 __proto__: WebInspector.VBox.prototype | 389 __proto__: WebInspector.VBox.prototype |
376 } | 390 } |
377 | 391 |
378 /** | 392 /** |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
512 | 526 |
513 var valueDiv = row.createChild("div"); | 527 var valueDiv = row.createChild("div"); |
514 if (value instanceof HTMLDivElement) { | 528 if (value instanceof HTMLDivElement) { |
515 valueDiv.appendChild(value); | 529 valueDiv.appendChild(value); |
516 } else { | 530 } else { |
517 valueDiv.textContent = value; | 531 valueDiv.textContent = value; |
518 } | 532 } |
519 } | 533 } |
520 } | 534 } |
521 | 535 |
OLD | NEW |