Index: headless/lib/browser/headless_web_contents_impl.cc |
diff --git a/headless/lib/browser/headless_web_contents_impl.cc b/headless/lib/browser/headless_web_contents_impl.cc |
index 2418c29644f46826d2bba29ad6ac1343ee618665..dfdf31b30db02da06f651e81ca368c836839d1c6 100644 |
--- a/headless/lib/browser/headless_web_contents_impl.cc |
+++ b/headless/lib/browser/headless_web_contents_impl.cc |
@@ -13,6 +13,8 @@ |
#include "base/memory/weak_ptr.h" |
#include "base/strings/utf_string_conversions.h" |
#include "base/trace_event/trace_event.h" |
+#include "components/security_state/content/content_utils.h" |
+#include "components/security_state/core/security_state.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/devtools_agent_host.h" |
#include "content/public/browser/navigation_handle.h" |
@@ -23,6 +25,7 @@ |
#include "content/public/browser/web_contents.h" |
#include "content/public/browser/web_contents_delegate.h" |
#include "content/public/common/bindings_policy.h" |
+#include "content/public/common/origin_util.h" |
#include "content/public/renderer/render_frame.h" |
#include "headless/lib/browser/headless_browser_context_impl.h" |
#include "headless/lib/browser/headless_browser_impl.h" |
@@ -80,6 +83,21 @@ class HeadlessWebContentsImpl::Delegate : public content::WebContentsDelegate { |
browser_context_->RegisterWebContents(std::move(web_contents)); |
} |
+ // Return the security style of the given |web_contents|, populating |
+ // |security_style_explanations| to explain why the SecurityStyle was chosen. |
+ blink::WebSecurityStyle GetSecurityStyle( |
+ content::WebContents* web_contents, |
+ content::SecurityStyleExplanations* security_style_explanations) |
+ override { |
+ security_state::SecurityInfo security_info; |
+ security_state::GetSecurityInfo( |
+ security_state::GetVisibleSecurityState(web_contents), |
+ false /* used_policy_installed_certificate */, |
+ base::Bind(&content::IsOriginSecure), &security_info); |
+ return security_state::GetSecurityStyle(security_info, |
+ security_style_explanations); |
+ } |
+ |
private: |
HeadlessBrowserContextImpl* browser_context_; // Not owned. |
DISALLOW_COPY_AND_ASSIGN(Delegate); |