Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Unified Diff: headless/lib/browser/headless_web_contents_impl.cc

Issue 2507003002: Enable security state computation for HeadlessWebContents. (Closed)
Patch Set: fix copyright Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « headless/lib/browser/DEPS ('k') | headless/lib/headless_web_contents_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « headless/lib/browser/DEPS ('k') | headless/lib/headless_web_contents_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698