Chromium Code Reviews| 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 #include "content/browser/devtools/protocol/security_handler.h" | 5 #include "content/browser/devtools/protocol/security_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" | 9 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" |
| 10 #include "content/public/browser/security_style_explanations.h" | 10 #include "content/public/browser/security_style_explanations.h" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 #include "content/public/browser/web_contents_delegate.h" | 12 #include "content/public/browser/web_contents_delegate.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 namespace devtools { | 15 namespace devtools { |
| 16 namespace security { | 16 namespace security { |
| 17 | 17 |
| 18 typedef DevToolsProtocolClient::Response Response; | 18 typedef DevToolsProtocolClient::Response Response; |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 std::string SecurityStyleToProtocolSecurityState( | 22 std::string SecurityStyleToProtocolSecurityState( |
| 23 SecurityStyle security_style) { | 23 SecurityStyle security_style) { |
| 24 switch (security_style) { | 24 switch (security_style) { |
| 25 case SECURITY_STYLE_UNKNOWN: | 25 case SECURITY_STYLE_UNKNOWN: |
| 26 return kSecurityStateUnknown; | 26 return kSecurityStateUnknown; |
| 27 case SECURITY_STYLE_UNAUTHENTICATED: | 27 case SECURITY_STYLE_UNAUTHENTICATED: |
| 28 return kSecurityStateHttp; | 28 return kSecurityStateNeutral; |
| 29 case SECURITY_STYLE_AUTHENTICATION_BROKEN: | 29 case SECURITY_STYLE_AUTHENTICATION_BROKEN: |
| 30 return kSecurityStateInsecure; | 30 return kSecurityStateInsecure; |
| 31 case SECURITY_STYLE_WARNING: | 31 case SECURITY_STYLE_WARNING: |
| 32 return kSecurityStateWarning; | 32 return kSecurityStateWarning; |
| 33 case SECURITY_STYLE_AUTHENTICATED: | 33 case SECURITY_STYLE_AUTHENTICATED: |
| 34 return kSecurityStateSecure; | 34 return kSecurityStateSecure; |
| 35 default: | 35 default: |
| 36 NOTREACHED(); | 36 NOTREACHED(); |
|
pfeldman
2015/08/18 23:48:52
Remove this so that you don't have to do complex t
lgarron
2015/08/19 06:17:30
This patch actually isn't affected by the NOTREACH
| |
| 37 return kSecurityStateUnknown; | 37 return kSecurityStateUnknown; |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 | 40 |
| 41 void AddExplanations( | 41 void AddExplanations( |
| 42 const std::string& security_style, | 42 const std::string& security_style, |
| 43 const std::vector<SecurityStyleExplanation>& explanations_to_add, | 43 const std::vector<SecurityStyleExplanation>& explanations_to_add, |
| 44 std::vector<scoped_refptr<SecurityStateExplanation>>* explanations) { | 44 std::vector<scoped_refptr<SecurityStateExplanation>>* explanations) { |
| 45 for (const auto& it : explanations_to_add) { | 45 for (const auto& it : explanations_to_add) { |
| 46 explanations->push_back(SecurityStateExplanation::Create() | 46 explanations->push_back(SecurityStateExplanation::Create() |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 | 135 |
| 136 Response SecurityHandler::Disable() { | 136 Response SecurityHandler::Disable() { |
| 137 enabled_ = false; | 137 enabled_ = false; |
| 138 WebContentsObserver::Observe(nullptr); | 138 WebContentsObserver::Observe(nullptr); |
| 139 return Response::OK(); | 139 return Response::OK(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace security | 142 } // namespace security |
| 143 } // namespace devtools | 143 } // namespace devtools |
| 144 } // namespace content | 144 } // namespace content |
| OLD | NEW |