OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/render_frame_devtools_agent_host.h" | 5 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
6 | 6 |
7 #include <tuple> | 7 #include <tuple> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
(...skipping 21 matching lines...) Expand all Loading... | |
32 #include "content/browser/devtools/protocol/tracing_handler.h" | 32 #include "content/browser/devtools/protocol/tracing_handler.h" |
33 #include "content/browser/frame_host/navigation_handle_impl.h" | 33 #include "content/browser/frame_host/navigation_handle_impl.h" |
34 #include "content/browser/frame_host/render_frame_host_impl.h" | 34 #include "content/browser/frame_host/render_frame_host_impl.h" |
35 #include "content/browser/renderer_host/input/input_router_impl.h" | 35 #include "content/browser/renderer_host/input/input_router_impl.h" |
36 #include "content/browser/renderer_host/render_process_host_impl.h" | 36 #include "content/browser/renderer_host/render_process_host_impl.h" |
37 #include "content/browser/renderer_host/render_view_host_impl.h" | 37 #include "content/browser/renderer_host/render_view_host_impl.h" |
38 #include "content/browser/site_instance_impl.h" | 38 #include "content/browser/site_instance_impl.h" |
39 #include "content/browser/web_contents/web_contents_impl.h" | 39 #include "content/browser/web_contents/web_contents_impl.h" |
40 #include "content/common/view_messages.h" | 40 #include "content/common/view_messages.h" |
41 #include "content/public/browser/browser_context.h" | 41 #include "content/public/browser/browser_context.h" |
42 #include "content/public/browser/cert_store.h" | |
42 #include "content/public/browser/content_browser_client.h" | 43 #include "content/public/browser/content_browser_client.h" |
43 #include "content/public/browser/render_widget_host_iterator.h" | 44 #include "content/public/browser/render_widget_host_iterator.h" |
44 #include "content/public/browser/web_contents_delegate.h" | 45 #include "content/public/browser/web_contents_delegate.h" |
45 #include "content/public/common/browser_side_navigation_policy.h" | 46 #include "content/public/common/browser_side_navigation_policy.h" |
47 #include "net/cert/x509_certificate.h" | |
46 | 48 |
47 #if defined(OS_ANDROID) | 49 #if defined(OS_ANDROID) |
48 #include "content/public/browser/render_widget_host_view.h" | 50 #include "content/public/browser/render_widget_host_view.h" |
49 #include "device/power_save_blocker/power_save_blocker.h" | 51 #include "device/power_save_blocker/power_save_blocker.h" |
50 #endif | 52 #endif |
51 | 53 |
52 namespace content { | 54 namespace content { |
53 | 55 |
54 typedef std::vector<RenderFrameDevToolsAgentHost*> Instances; | 56 typedef std::vector<RenderFrameDevToolsAgentHost*> Instances; |
55 | 57 |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
736 return false; | 738 return false; |
737 if (!IsAttached()) | 739 if (!IsAttached()) |
738 return false; | 740 return false; |
739 bool handled = true; | 741 bool handled = true; |
740 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(RenderFrameDevToolsAgentHost, message, | 742 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(RenderFrameDevToolsAgentHost, message, |
741 render_frame_host) | 743 render_frame_host) |
742 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend, | 744 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend, |
743 OnDispatchOnInspectorFrontend) | 745 OnDispatchOnInspectorFrontend) |
744 IPC_MESSAGE_HANDLER(DevToolsAgentHostMsg_RequestNewWindow, | 746 IPC_MESSAGE_HANDLER(DevToolsAgentHostMsg_RequestNewWindow, |
745 OnRequestNewWindow) | 747 OnRequestNewWindow) |
748 IPC_MESSAGE_HANDLER(DevToolsAgentHostMsg_ShowCertificateViewer, | |
749 OnShowCertificateViewer) | |
746 IPC_MESSAGE_UNHANDLED(handled = false) | 750 IPC_MESSAGE_UNHANDLED(handled = false) |
747 IPC_END_MESSAGE_MAP() | 751 IPC_END_MESSAGE_MAP() |
748 return handled; | 752 return handled; |
749 } | 753 } |
750 | 754 |
751 void RenderFrameDevToolsAgentHost::DidAttachInterstitialPage() { | 755 void RenderFrameDevToolsAgentHost::DidAttachInterstitialPage() { |
752 if (page_handler_) | 756 if (page_handler_) |
753 page_handler_->DidAttachInterstitialPage(); | 757 page_handler_->DidAttachInterstitialPage(); |
754 | 758 |
755 // TODO(dgozman): this may break for cross-process subframes. | 759 // TODO(dgozman): this may break for cross-process subframes. |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1006 if (IsAttached() && sender->GetRoutingID() != new_routing_id && frame_host) { | 1010 if (IsAttached() && sender->GetRoutingID() != new_routing_id && frame_host) { |
1007 scoped_refptr<DevToolsAgentHost> agent = | 1011 scoped_refptr<DevToolsAgentHost> agent = |
1008 DevToolsAgentHost::GetOrCreateFor(frame_host); | 1012 DevToolsAgentHost::GetOrCreateFor(frame_host); |
1009 success = agent->Inspect(); | 1013 success = agent->Inspect(); |
1010 } | 1014 } |
1011 | 1015 |
1012 sender->Send(new DevToolsAgentMsg_RequestNewWindow_ACK( | 1016 sender->Send(new DevToolsAgentMsg_RequestNewWindow_ACK( |
1013 sender->GetRoutingID(), success)); | 1017 sender->GetRoutingID(), success)); |
1014 } | 1018 } |
1015 | 1019 |
1020 void RenderFrameDevToolsAgentHost::OnShowCertificateViewer( | |
1021 RenderFrameHost* sender, const std::string& certificate) { | |
1022 base::Pickle pickle(certificate.data(), certificate.size()); | |
1023 base::PickleIterator iterator(pickle); | |
1024 scoped_refptr<net::X509Certificate> cert = | |
1025 net::X509Certificate::CreateFromPickle( | |
1026 &iterator, | |
1027 net::X509Certificate::PICKLETYPE_CERTIFICATE_CHAIN_V3); | |
1028 DCHECK(cert); | |
1029 // TODO(jam): temporarily add the certificate to the cert store (it will | |
1030 // already be there, so this just gets an ID) so that we don't have to change | |
1031 // the WCD method signature (will be done in followups). | |
jam
2016/08/31 22:13:28
ditto for not making this patch even larger, i'll
| |
1032 int cert_id = CertStore::GetInstance()->StoreCert( | |
1033 cert.get(), sender->GetProcess()->GetID()); | |
1034 web_contents()->GetDelegate()->ShowCertificateViewerInDevTools( | |
1035 web_contents(), cert_id); | |
1036 } | |
1037 | |
1016 bool RenderFrameDevToolsAgentHost::HasRenderFrameHost( | 1038 bool RenderFrameDevToolsAgentHost::HasRenderFrameHost( |
1017 RenderFrameHost* host) { | 1039 RenderFrameHost* host) { |
1018 return (current_ && current_->host() == host) || | 1040 return (current_ && current_->host() == host) || |
1019 (pending_ && pending_->host() == host); | 1041 (pending_ && pending_->host() == host); |
1020 } | 1042 } |
1021 | 1043 |
1022 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 1044 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
1023 return current_ && current_->host()->GetParent(); | 1045 return current_ && current_->host()->GetParent(); |
1024 } | 1046 } |
1025 | 1047 |
1026 } // namespace content | 1048 } // namespace content |
OLD | NEW |