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

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

Issue 1159163005: Add a minimal Security panel to DevTools (behind a hidden experiment). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address final comments. Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/main/Main.js ('k') | Source/devtools/front_end/security/SecurityPanel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/security/SecurityModel.js
diff --git a/Source/devtools/front_end/security/SecurityModel.js b/Source/devtools/front_end/security/SecurityModel.js
new file mode 100644
index 0000000000000000000000000000000000000000..e9e75c23608b3d0e01813426c314116b6f5efeeb
--- /dev/null
+++ b/Source/devtools/front_end/security/SecurityModel.js
@@ -0,0 +1,68 @@
+// 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
+ */
+WebInspector.SecurityModel = function(target)
+{
+ WebInspector.SDKModel.call(this, WebInspector.SecurityModel, target);
+ this._dispatcher = new WebInspector.SecurityDispatcher(this);
+ this._securityAgent = target.securityAgent();
+ target.registerSecurityDispatcher(this._dispatcher);
+ this._securityAgent.enable();
+
+ this._securityState = "unknown";
+}
+
+WebInspector.SecurityModel.EventTypes = {
+ SecurityStateChanged: "SecurityStateChanged"
+}
+
+WebInspector.SecurityModel.prototype = {
+ /**
+ * @return {!SecurityAgent.SecurityState} securityState
+ */
+ securityState: function()
+ {
+ return /** @type {!SecurityAgent.SecurityState} */ (this._securityState);
+ },
+
+ __proto__: WebInspector.SDKModel.prototype
+}
+
+/**
+ * @param {!WebInspector.Target} target
+ * @return {?WebInspector.SecurityModel}
+ */
+WebInspector.SecurityModel.fromTarget = function(target)
+{
+ var model = /** @type {?WebInspector.SecurityModel} */ (target.model(WebInspector.SecurityModel));
+ if (!model)
+ model = new WebInspector.SecurityModel(target);
+ return model;
+}
+
+/**
+ * @constructor
+ * @implements {SecurityAgent.Dispatcher}
+ */
+WebInspector.SecurityDispatcher = function(model)
+{
+ this._model = model;
+}
+
+WebInspector.SecurityDispatcher.prototype = {
+ /**
+ * @override
+ * @param {!SecurityAgent.SecurityState} securityState
+ */
+ securityStateChanged: function(securityState)
+ {
+ this._model._securityState = securityState;
+ this._model.dispatchEventToListeners(WebInspector.SecurityModel.EventTypes.SecurityStateChanged, securityState);
+ }
+}
« no previous file with comments | « Source/devtools/front_end/main/Main.js ('k') | Source/devtools/front_end/security/SecurityPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698