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

Unified Diff: third_party/WebKit/Source/devtools/front_end/security/SecurityModel.js

Issue 2466123002: DevTools: reformat front-end code to match chromium style. (Closed)
Patch Set: all done Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/security/SecurityModel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/security/SecurityModel.js b/third_party/WebKit/Source/devtools/front_end/security/SecurityModel.js
index bf0b25b83e6a7ce3a5ecdd05f4c332c85d33343c..3f904b4890bd496de406371bab22d978405f06dd 100644
--- a/third_party/WebKit/Source/devtools/front_end/security/SecurityModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/security/SecurityModel.js
@@ -1,113 +1,108 @@
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
/**
- * @constructor
- * @extends {WebInspector.SDKModel}
- * @param {!WebInspector.Target} target
+ * @unrestricted
*/
-WebInspector.SecurityModel = function(target)
-{
- WebInspector.SDKModel.call(this, WebInspector.SecurityModel, target);
+WebInspector.SecurityModel = class extends WebInspector.SDKModel {
+ /**
+ * @param {!WebInspector.Target} target
+ */
+ constructor(target) {
+ super(WebInspector.SecurityModel, target);
this._dispatcher = new WebInspector.SecurityDispatcher(this);
this._securityAgent = target.securityAgent();
target.registerSecurityDispatcher(this._dispatcher);
this._securityAgent.enable();
-};
-
-/** @enum {symbol} */
-WebInspector.SecurityModel.Events = {
- SecurityStateChanged: Symbol("SecurityStateChanged")
-};
+ }
-WebInspector.SecurityModel.prototype = {
- __proto__: WebInspector.SDKModel.prototype,
-
- showCertificateViewer: function()
- {
- this._securityAgent.showCertificateViewer();
- }
-};
-
-/**
- * @param {!WebInspector.Target} target
- * @return {?WebInspector.SecurityModel}
- */
-WebInspector.SecurityModel.fromTarget = function(target)
-{
+ /**
+ * @param {!WebInspector.Target} target
+ * @return {?WebInspector.SecurityModel}
+ */
+ static fromTarget(target) {
var model = /** @type {?WebInspector.SecurityModel} */ (target.model(WebInspector.SecurityModel));
if (!model)
- model = new WebInspector.SecurityModel(target);
+ model = new WebInspector.SecurityModel(target);
return model;
-};
+ }
-/**
- * @param {!SecurityAgent.SecurityState} a
- * @param {!SecurityAgent.SecurityState} b
- * @return {number}
- */
-WebInspector.SecurityModel.SecurityStateComparator = function(a, b)
-{
+ /**
+ * @param {!SecurityAgent.SecurityState} a
+ * @param {!SecurityAgent.SecurityState} b
+ * @return {number}
+ */
+ static SecurityStateComparator(a, b) {
var securityStateMap;
if (WebInspector.SecurityModel._symbolicToNumericSecurityState) {
- securityStateMap = WebInspector.SecurityModel._symbolicToNumericSecurityState;
+ securityStateMap = WebInspector.SecurityModel._symbolicToNumericSecurityState;
} else {
- securityStateMap = new Map();
- var ordering = [
- SecurityAgent.SecurityState.Info,
- SecurityAgent.SecurityState.Insecure,
- SecurityAgent.SecurityState.Neutral,
- SecurityAgent.SecurityState.Warning,
- SecurityAgent.SecurityState.Secure,
- // Unknown is max so that failed/cancelled requests don't overwrite the origin security state for successful requests,
- // and so that failed/cancelled requests appear at the bottom of the origins list.
- SecurityAgent.SecurityState.Unknown
- ];
- for (var i = 0; i < ordering.length; i++)
- securityStateMap.set(ordering[i], i + 1);
- WebInspector.SecurityModel._symbolicToNumericSecurityState = securityStateMap;
+ securityStateMap = new Map();
+ var ordering = [
+ SecurityAgent.SecurityState.Info, SecurityAgent.SecurityState.Insecure, SecurityAgent.SecurityState.Neutral,
+ SecurityAgent.SecurityState.Warning, SecurityAgent.SecurityState.Secure,
+ // Unknown is max so that failed/cancelled requests don't overwrite the origin security state for successful requests,
+ // and so that failed/cancelled requests appear at the bottom of the origins list.
+ SecurityAgent.SecurityState.Unknown
+ ];
+ for (var i = 0; i < ordering.length; i++)
+ securityStateMap.set(ordering[i], i + 1);
+ WebInspector.SecurityModel._symbolicToNumericSecurityState = securityStateMap;
}
var aScore = securityStateMap.get(a) || 0;
var bScore = securityStateMap.get(b) || 0;
return aScore - bScore;
+ }
+
+ showCertificateViewer() {
+ this._securityAgent.showCertificateViewer();
+ }
};
+/** @enum {symbol} */
+WebInspector.SecurityModel.Events = {
+ SecurityStateChanged: Symbol('SecurityStateChanged')
+};
+
+
/**
- * @constructor
- * @param {!SecurityAgent.SecurityState} securityState
- * @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations
- * @param {?SecurityAgent.InsecureContentStatus} insecureContentStatus
- * @param {boolean} schemeIsCryptographic
+ * @unrestricted
*/
-WebInspector.PageSecurityState = function(securityState, explanations, insecureContentStatus, schemeIsCryptographic) {
+WebInspector.PageSecurityState = class {
+ /**
+ * @param {!SecurityAgent.SecurityState} securityState
+ * @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations
+ * @param {?SecurityAgent.InsecureContentStatus} insecureContentStatus
+ * @param {boolean} schemeIsCryptographic
+ */
+ constructor(securityState, explanations, insecureContentStatus, schemeIsCryptographic) {
this.securityState = securityState;
this.explanations = explanations;
this.insecureContentStatus = insecureContentStatus;
this.schemeIsCryptographic = schemeIsCryptographic;
+ }
};
/**
- * @constructor
* @implements {SecurityAgent.Dispatcher}
+ * @unrestricted
*/
-WebInspector.SecurityDispatcher = function(model)
-{
+WebInspector.SecurityDispatcher = class {
+ constructor(model) {
this._model = model;
-};
+ }
-WebInspector.SecurityDispatcher.prototype = {
- /**
- * @override
- * @param {!SecurityAgent.SecurityState} securityState
- * @param {!Array<!SecurityAgent.SecurityStateExplanation>=} explanations
- * @param {!SecurityAgent.InsecureContentStatus=} insecureContentStatus
- * @param {boolean=} schemeIsCryptographic
- */
- securityStateChanged: function(securityState, explanations, insecureContentStatus, schemeIsCryptographic)
- {
- var pageSecurityState = new WebInspector.PageSecurityState(securityState, explanations || [], insecureContentStatus || null, schemeIsCryptographic || false);
- this._model.dispatchEventToListeners(WebInspector.SecurityModel.Events.SecurityStateChanged, pageSecurityState);
- }
+ /**
+ * @override
+ * @param {!SecurityAgent.SecurityState} securityState
+ * @param {!Array<!SecurityAgent.SecurityStateExplanation>=} explanations
+ * @param {!SecurityAgent.InsecureContentStatus=} insecureContentStatus
+ * @param {boolean=} schemeIsCryptographic
+ */
+ securityStateChanged(securityState, explanations, insecureContentStatus, schemeIsCryptographic) {
+ var pageSecurityState = new WebInspector.PageSecurityState(
+ securityState, explanations || [], insecureContentStatus || null, schemeIsCryptographic || false);
+ this._model.dispatchEventToListeners(WebInspector.SecurityModel.Events.SecurityStateChanged, pageSecurityState);
+ }
};

Powered by Google App Engine
This is Rietveld 408576698