Chromium Code Reviews| 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 "headless/lib/browser/headless_web_contents_impl.h" | 5 #include "headless/lib/browser/headless_web_contents_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
| 16 #include "components/security_state/content/content_utils.h" | 16 #include "components/security_state/content/content_utils.h" |
| 17 #include "components/security_state/core/security_state.h" | 17 #include "components/security_state/core/security_state.h" |
| 18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 19 #include "content/public/browser/devtools_agent_host.h" | 19 #include "content/public/browser/devtools_agent_host.h" |
| 20 #include "content/public/browser/navigation_handle.h" | 20 #include "content/public/browser/navigation_handle.h" |
| 21 #include "content/public/browser/render_frame_host.h" | 21 #include "content/public/browser/render_frame_host.h" |
| 22 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
| 23 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
| 24 #include "content/public/browser/render_widget_host.h" | |
| 25 #include "content/public/browser/render_widget_host_view.h" | |
|
Eric Seckler
2017/02/22 09:00:04
nit: do we still need this include?
irisu
2017/02/23 00:02:26
Done.
| |
| 24 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 25 #include "content/public/browser/web_contents_delegate.h" | 27 #include "content/public/browser/web_contents_delegate.h" |
| 26 #include "content/public/common/bindings_policy.h" | 28 #include "content/public/common/bindings_policy.h" |
| 27 #include "content/public/common/origin_util.h" | 29 #include "content/public/common/origin_util.h" |
| 28 #include "headless/lib/browser/headless_browser_context_impl.h" | 30 #include "headless/lib/browser/headless_browser_context_impl.h" |
| 29 #include "headless/lib/browser/headless_browser_impl.h" | 31 #include "headless/lib/browser/headless_browser_impl.h" |
| 30 #include "headless/lib/browser/headless_browser_main_parts.h" | 32 #include "headless/lib/browser/headless_browser_main_parts.h" |
| 31 #include "headless/lib/browser/headless_devtools_client_impl.h" | 33 #include "headless/lib/browser/headless_devtools_client_impl.h" |
| 32 #include "services/service_manager/public/cpp/interface_registry.h" | 34 #include "services/service_manager/public/cpp/interface_registry.h" |
| 33 | 35 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 override { | 92 override { |
| 91 security_state::SecurityInfo security_info; | 93 security_state::SecurityInfo security_info; |
| 92 security_state::GetSecurityInfo( | 94 security_state::GetSecurityInfo( |
| 93 security_state::GetVisibleSecurityState(web_contents), | 95 security_state::GetVisibleSecurityState(web_contents), |
| 94 false /* used_policy_installed_certificate */, | 96 false /* used_policy_installed_certificate */, |
| 95 base::Bind(&content::IsOriginSecure), &security_info); | 97 base::Bind(&content::IsOriginSecure), &security_info); |
| 96 return security_state::GetSecurityStyle(security_info, | 98 return security_state::GetSecurityStyle(security_info, |
| 97 security_style_explanations); | 99 security_style_explanations); |
| 98 } | 100 } |
| 99 | 101 |
| 102 void ActivateContents(content::WebContents* contents) override { | |
| 103 contents->GetRenderViewHost()->GetWidget()->Focus(); | |
| 104 } | |
| 105 | |
| 100 private: | 106 private: |
| 101 HeadlessBrowserContextImpl* browser_context_; // Not owned. | 107 HeadlessBrowserContextImpl* browser_context_; // Not owned. |
| 102 DISALLOW_COPY_AND_ASSIGN(Delegate); | 108 DISALLOW_COPY_AND_ASSIGN(Delegate); |
| 103 }; | 109 }; |
| 104 | 110 |
| 105 // static | 111 // static |
| 106 std::unique_ptr<HeadlessWebContentsImpl> HeadlessWebContentsImpl::Create( | 112 std::unique_ptr<HeadlessWebContentsImpl> HeadlessWebContentsImpl::Create( |
| 107 HeadlessWebContents::Builder* builder) { | 113 HeadlessWebContents::Builder* builder) { |
| 108 content::WebContents::CreateParams create_params(builder->browser_context_, | 114 content::WebContents::CreateParams create_params(builder->browser_context_, |
| 109 nullptr); | 115 nullptr); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 294 HeadlessWebContents::Builder::MojoService::MojoService() {} | 300 HeadlessWebContents::Builder::MojoService::MojoService() {} |
| 295 | 301 |
| 296 HeadlessWebContents::Builder::MojoService::MojoService( | 302 HeadlessWebContents::Builder::MojoService::MojoService( |
| 297 const std::string& service_name, | 303 const std::string& service_name, |
| 298 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory) | 304 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory) |
| 299 : service_name(service_name), service_factory(service_factory) {} | 305 : service_name(service_name), service_factory(service_factory) {} |
| 300 | 306 |
| 301 HeadlessWebContents::Builder::MojoService::~MojoService() {} | 307 HeadlessWebContents::Builder::MojoService::~MojoService() {} |
| 302 | 308 |
| 303 } // namespace headless | 309 } // namespace headless |
| OLD | NEW |