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

Side by Side Diff: Source/devtools/front_end/security/SecurityModel.js

Issue 1179353002: Surface lock icon explanations in the DevTools Security panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Additional linter annotations. 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 unified diff | Download patch
OLDNEW
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.SDKModel} 7 * @extends {WebInspector.SDKModel}
8 * @param {!WebInspector.Target} target 8 * @param {!WebInspector.Target} target
9 */ 9 */
10 WebInspector.SecurityModel = function(target) 10 WebInspector.SecurityModel = function(target)
11 { 11 {
12 WebInspector.SDKModel.call(this, WebInspector.SecurityModel, target); 12 WebInspector.SDKModel.call(this, WebInspector.SecurityModel, target);
13 this._dispatcher = new WebInspector.SecurityDispatcher(this); 13 this._dispatcher = new WebInspector.SecurityDispatcher(this);
14 this._securityAgent = target.securityAgent(); 14 this._securityAgent = target.securityAgent();
15 target.registerSecurityDispatcher(this._dispatcher); 15 target.registerSecurityDispatcher(this._dispatcher);
16 this._securityAgent.enable(); 16 this._securityAgent.enable();
17 17
18 this._securityState = "unknown"; 18 this._securityState = /** @type {!SecurityAgent.SecurityState} */ ("unknown" );
19 } 19 }
20 20
21 WebInspector.SecurityModel.EventTypes = { 21 WebInspector.SecurityModel.EventTypes = {
22 SecurityStateChanged: "SecurityStateChanged" 22 SecurityStateChanged: "SecurityStateChanged"
23 } 23 }
24 24
25 /** @typedef {!{
dgozman 2015/06/18 10:50:48 Just put this in a single line.
lgarron 2015/06/18 18:16:18 Done.
26 securityState: SecurityAgent.SecurityState,
27 summary: string,
28 description: string
29 }}
30 */
31 WebInspector.SecurityModel.SecurityStateExplanation;
32
25 WebInspector.SecurityModel.prototype = { 33 WebInspector.SecurityModel.prototype = {
26 /** 34 /**
27 * @return {!SecurityAgent.SecurityState} securityState 35 * @return {!SecurityAgent.SecurityState} securityState
28 */ 36 */
29 securityState: function() 37 securityState: function()
30 { 38 {
31 return /** @type {!SecurityAgent.SecurityState} */ (this._securityState) ; 39 return /** @type {!SecurityAgent.SecurityState} */ (this._securityState) ;
32 }, 40 },
33 41
34 __proto__: WebInspector.SDKModel.prototype 42 __proto__: WebInspector.SDKModel.prototype
(...skipping 13 matching lines...) Expand all
48 56
49 /** 57 /**
50 * @constructor 58 * @constructor
51 * @implements {SecurityAgent.Dispatcher} 59 * @implements {SecurityAgent.Dispatcher}
52 */ 60 */
53 WebInspector.SecurityDispatcher = function(model) 61 WebInspector.SecurityDispatcher = function(model)
54 { 62 {
55 this._model = model; 63 this._model = model;
56 } 64 }
57 65
66 /** @typedef {!{
dgozman 2015/06/18 10:50:48 We don't usually typdef events, since you will cas
lgarron 2015/06/18 18:16:17 Done.
67 securityState: !SecurityAgent.SecurityState,
68 explanations: !Array<!WebInspector.SecurityModel.SecurityStateExplanatio n>
69 }}
70 */
71 WebInspector.SecurityDispatcher.SecurityStateChangedEvent;
72
58 WebInspector.SecurityDispatcher.prototype = { 73 WebInspector.SecurityDispatcher.prototype = {
59 /** 74 /**
60 * @override 75 * @override
61 * @param {!SecurityAgent.SecurityState} securityState 76 * @param {!SecurityAgent.SecurityState} securityState
77 * @param {!Array<!WebInspector.SecurityModel.SecurityStateExplanation>=} ex planations
62 */ 78 */
63 securityStateChanged: function(securityState) 79 securityStateChanged: function(securityState, explanations)
64 { 80 {
65 this._model._securityState = securityState; 81 var event = /** @type {!WebInspector.SecurityDispatcher.SecurityStateCha ngedEvent} */ ({
66 this._model.dispatchEventToListeners(WebInspector.SecurityModel.EventTyp es.SecurityStateChanged, securityState); 82 "securityState": securityState,
83 "explanations": explanations || []
84 });
85 this._model.dispatchEventToListeners(WebInspector.SecurityModel.EventTyp es.SecurityStateChanged, event);
dgozman 2015/06/18 10:50:48 event->data
lgarron 2015/06/18 18:16:18 Good point. Done.
67 } 86 }
68 } 87 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698