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/devtools_session.h" |
9 #include "content/browser/frame_host/render_frame_host_impl.h" | 10 #include "content/browser/frame_host/render_frame_host_impl.h" |
10 #include "content/public/browser/navigation_controller.h" | 11 #include "content/public/browser/navigation_controller.h" |
11 #include "content/public/browser/navigation_entry.h" | 12 #include "content/public/browser/navigation_entry.h" |
12 #include "content/public/browser/security_style_explanations.h" | 13 #include "content/public/browser/security_style_explanations.h" |
13 #include "content/public/browser/ssl_status.h" | 14 #include "content/public/browser/ssl_status.h" |
14 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
15 #include "content/public/browser/web_contents_delegate.h" | 16 #include "content/public/browser/web_contents_delegate.h" |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 namespace protocol { | 19 namespace protocol { |
(...skipping 30 matching lines...) Expand all Loading... |
49 .SetSecurityState(security_style) | 50 .SetSecurityState(security_style) |
50 .SetSummary(it.summary) | 51 .SetSummary(it.summary) |
51 .SetDescription(it.description) | 52 .SetDescription(it.description) |
52 .SetHasCertificate(it.has_certificate) | 53 .SetHasCertificate(it.has_certificate) |
53 .Build()); | 54 .Build()); |
54 } | 55 } |
55 } | 56 } |
56 | 57 |
57 } // namespace | 58 } // namespace |
58 | 59 |
| 60 // static |
| 61 SecurityHandler* SecurityHandler::FromAgentHost(DevToolsAgentHostImpl* host) { |
| 62 DevToolsSession* session = DevToolsDomainHandler::GetFirstSession(host); |
| 63 if (!session) |
| 64 return nullptr; |
| 65 return static_cast<SecurityHandler*>( |
| 66 session->GetHandlerByName(Security::Metainfo::domainName)); |
| 67 } |
| 68 |
59 SecurityHandler::SecurityHandler() | 69 SecurityHandler::SecurityHandler() |
60 : DevToolsDomainHandler(Security::Metainfo::domainName), | 70 : DevToolsDomainHandler(Security::Metainfo::domainName), |
61 enabled_(false), | 71 enabled_(false), |
62 host_(nullptr) { | 72 host_(nullptr) { |
63 } | 73 } |
64 | 74 |
65 SecurityHandler::~SecurityHandler() { | 75 SecurityHandler::~SecurityHandler() { |
66 } | 76 } |
67 | 77 |
68 void SecurityHandler::Wire(UberDispatcher* dispatcher) { | 78 void SecurityHandler::Wire(UberDispatcher* dispatcher) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 web_contents->GetController().GetVisibleEntry()->GetSSL().certificate; | 168 web_contents->GetController().GetVisibleEntry()->GetSSL().certificate; |
159 if (!certificate) | 169 if (!certificate) |
160 return Response::Error("Could not find certificate"); | 170 return Response::Error("Could not find certificate"); |
161 web_contents->GetDelegate()->ShowCertificateViewerInDevTools( | 171 web_contents->GetDelegate()->ShowCertificateViewerInDevTools( |
162 web_contents, certificate); | 172 web_contents, certificate); |
163 return Response::OK(); | 173 return Response::OK(); |
164 } | 174 } |
165 | 175 |
166 } // namespace protocol | 176 } // namespace protocol |
167 } // namespace content | 177 } // namespace content |
OLD | NEW |