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

Side by Side Diff: content/browser/devtools/protocol/security_handler.cc

Issue 1163963002: Implement SecurityHandler to send the lock icon status to DevTools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
estark 2015/06/04 01:09:15 copyright should be 2015
lgarron 2015/06/05 01:29:18 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <string>
6
7 #include "base/logging.h"
8 #include "content/browser/devtools/protocol/security_handler.h"
estark 2015/06/04 01:09:14 This should be at the top of the #include list.
9
10 namespace content {
11 namespace devtools {
12 namespace security {
13
14 typedef DevToolsProtocolClient::Response Response;
15
16 SecurityHandler::SecurityHandler() : enabled_(false) {
17 }
18
19 SecurityHandler::~SecurityHandler() {
20 }
21
22 void SecurityHandler::SetClient(scoped_ptr<Client> client) {
23 client_.swap(client);
24 }
25
26 void SecurityHandler::SecurityStyleChanged(SecurityStyle security_style) {
27 if (!enabled_)
28 return;
29
30 const std::string security_state =
31 SecurityStyleToProtocolSecurityState(security_style);
32 client_->SecurityStateChanged(
estark 2015/06/05 00:59:10 Ah, just realized this won't build without the pro
lgarron 2015/06/06 00:57:40 I think it would make more sense to land protocol.
33 SecurityStateChangedParams::Create()->set_security_state(security_state));
34 }
35
36 Response SecurityHandler::Enable() {
37 enabled_ = true;
38 return Response::OK();
39 }
40
41 Response SecurityHandler::Disable() {
42 enabled_ = false;
43 return Response::FallThrough();
estark 2015/06/04 01:09:14 I think this should be Response::OK() like Enable(
lgarron 2015/06/05 01:29:18 Makes sense (I trust you on verifying that's what
44 }
45
46 std::string SecurityHandler::SecurityStyleToProtocolSecurityState(
47 SecurityStyle security_style) {
48 switch (security_style) {
49 case SECURITY_STYLE_UNKNOWN:
50 return "UNKNOWN";
estark 2015/06/04 01:09:15 It looks like constants for these enum values will
lgarron 2015/06/05 01:29:18 Done.
51 case SECURITY_STYLE_UNAUTHENTICATED:
52 return "HTTP";
53 case SECURITY_STYLE_AUTHENTICATION_BROKEN:
54 return "INSECURE";
55 case SECURITY_STYLE_WARNING:
56 return "WARNING";
57 case SECURITY_STYLE_AUTHENTICATED:
58 return "SECURE";
59 default:
estark 2015/06/04 01:09:14 Same comment here that I put in the other CL; I pr
pfeldman 2015/06/04 09:28:35 @estark: it is a good idea here, but don't do that
lgarron 2015/06/05 01:29:18 Good point. I'll leave it this way for now.
60 NOTREACHED();
61 }
62 }
63
64 } // namespace security
65 } // namespace devtools
66 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698