| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/devtools/devtools_ui_bindings.h" | 5 #include "chrome/browser/devtools/devtools_ui_bindings.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
| 35 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" | 35 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" |
| 36 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
| 37 #include "chrome/common/url_constants.h" | 37 #include "chrome/common/url_constants.h" |
| 38 #include "chrome/grit/generated_resources.h" | 38 #include "chrome/grit/generated_resources.h" |
| 39 #include "components/infobars/core/confirm_infobar_delegate.h" | 39 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 40 #include "components/infobars/core/infobar.h" | 40 #include "components/infobars/core/infobar.h" |
| 41 #include "components/prefs/scoped_user_pref_update.h" | 41 #include "components/prefs/scoped_user_pref_update.h" |
| 42 #include "components/syncable_prefs/pref_service_syncable.h" | 42 #include "components/syncable_prefs/pref_service_syncable.h" |
| 43 #include "components/zoom/page_zoom.h" | 43 #include "components/zoom/page_zoom.h" |
| 44 #include "content/public/browser/cert_store.h" | |
| 45 #include "content/public/browser/devtools_external_agent_proxy.h" | 44 #include "content/public/browser/devtools_external_agent_proxy.h" |
| 46 #include "content/public/browser/devtools_external_agent_proxy_delegate.h" | 45 #include "content/public/browser/devtools_external_agent_proxy_delegate.h" |
| 47 #include "content/public/browser/navigation_controller.h" | 46 #include "content/public/browser/navigation_controller.h" |
| 48 #include "content/public/browser/navigation_entry.h" | 47 #include "content/public/browser/navigation_entry.h" |
| 49 #include "content/public/browser/notification_source.h" | 48 #include "content/public/browser/notification_source.h" |
| 50 #include "content/public/browser/render_frame_host.h" | 49 #include "content/public/browser/render_frame_host.h" |
| 51 #include "content/public/browser/render_process_host.h" | 50 #include "content/public/browser/render_process_host.h" |
| 52 #include "content/public/browser/render_view_host.h" | 51 #include "content/public/browser/render_view_host.h" |
| 53 #include "content/public/browser/user_metrics.h" | 52 #include "content/public/browser/user_metrics.h" |
| 54 #include "content/public/browser/web_contents.h" | 53 #include "content/public/browser/web_contents.h" |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 std::vector<base::StringPiece> cert_string_piece; | 709 std::vector<base::StringPiece> cert_string_piece; |
| 711 for (const auto& str : decoded) | 710 for (const auto& str : decoded) |
| 712 cert_string_piece.push_back(str); | 711 cert_string_piece.push_back(str); |
| 713 scoped_refptr<net::X509Certificate> cert = | 712 scoped_refptr<net::X509Certificate> cert = |
| 714 net::X509Certificate::CreateFromDERCertChain(cert_string_piece); | 713 net::X509Certificate::CreateFromDERCertChain(cert_string_piece); |
| 715 if (!cert) { | 714 if (!cert) { |
| 716 NOTREACHED(); | 715 NOTREACHED(); |
| 717 return; | 716 return; |
| 718 } | 717 } |
| 719 | 718 |
| 720 // TODO(jam): temporarily add the certificate to the cert store to get an ID | |
| 721 // so that we don't have to change the WCD method signature | |
| 722 // (will be done in followups). | |
| 723 if (!agent_host_ || !agent_host_->GetWebContents()) | 719 if (!agent_host_ || !agent_host_->GetWebContents()) |
| 724 return; | 720 return; |
| 725 content::WebContents* inspected_wc = agent_host_->GetWebContents(); | 721 content::WebContents* inspected_wc = agent_host_->GetWebContents(); |
| 726 content::RenderProcessHost* rph = inspected_wc->GetRenderProcessHost(); | |
| 727 int cert_id = content::CertStore::GetInstance()->StoreCert( | |
| 728 cert.get(), rph->GetID()); | |
| 729 web_contents_->GetDelegate()->ShowCertificateViewerInDevTools( | 722 web_contents_->GetDelegate()->ShowCertificateViewerInDevTools( |
| 730 inspected_wc, cert_id); | 723 inspected_wc, cert.get()); |
| 731 } | 724 } |
| 732 | 725 |
| 733 void DevToolsUIBindings::ZoomIn() { | 726 void DevToolsUIBindings::ZoomIn() { |
| 734 zoom::PageZoom::Zoom(web_contents(), content::PAGE_ZOOM_IN); | 727 zoom::PageZoom::Zoom(web_contents(), content::PAGE_ZOOM_IN); |
| 735 } | 728 } |
| 736 | 729 |
| 737 void DevToolsUIBindings::ZoomOut() { | 730 void DevToolsUIBindings::ZoomOut() { |
| 738 zoom::PageZoom::Zoom(web_contents(), content::PAGE_ZOOM_OUT); | 731 zoom::PageZoom::Zoom(web_contents(), content::PAGE_ZOOM_OUT); |
| 739 } | 732 } |
| 740 | 733 |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 void DevToolsUIBindings::FrontendLoaded() { | 1147 void DevToolsUIBindings::FrontendLoaded() { |
| 1155 if (frontend_loaded_) | 1148 if (frontend_loaded_) |
| 1156 return; | 1149 return; |
| 1157 frontend_loaded_ = true; | 1150 frontend_loaded_ = true; |
| 1158 | 1151 |
| 1159 // Call delegate first - it seeds importants bit of information. | 1152 // Call delegate first - it seeds importants bit of information. |
| 1160 delegate_->OnLoadCompleted(); | 1153 delegate_->OnLoadCompleted(); |
| 1161 | 1154 |
| 1162 AddDevToolsExtensionsToClient(); | 1155 AddDevToolsExtensionsToClient(); |
| 1163 } | 1156 } |
| OLD | NEW |