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

Side by Side Diff: headless/lib/browser/headless_web_contents_impl.cc

Issue 2762593002: Add --headless flag to Windows (Closed)
Patch Set: added TODO Created 3 years, 7 months 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 unified diff | Download patch
OLDNEW
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 #include <vector> 9 #include <vector>
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 content::WebContents* new_contents) override { 83 content::WebContents* new_contents) override {
84 std::unique_ptr<HeadlessWebContentsImpl> web_contents = 84 std::unique_ptr<HeadlessWebContentsImpl> web_contents =
85 HeadlessWebContentsImpl::CreateFromWebContents(new_contents, 85 HeadlessWebContentsImpl::CreateFromWebContents(new_contents,
86 browser_context_); 86 browser_context_);
87 87
88 DCHECK(new_contents->GetBrowserContext() == browser_context_); 88 DCHECK(new_contents->GetBrowserContext() == browser_context_);
89 89
90 browser_context_->RegisterWebContents(std::move(web_contents)); 90 browser_context_->RegisterWebContents(std::move(web_contents));
91 } 91 }
92 92
93 #if !defined(CHROME_MULTIPLE_DLL_CHILD)
93 // Return the security style of the given |web_contents|, populating 94 // Return the security style of the given |web_contents|, populating
94 // |security_style_explanations| to explain why the SecurityStyle was chosen. 95 // |security_style_explanations| to explain why the SecurityStyle was chosen.
95 blink::WebSecurityStyle GetSecurityStyle( 96 blink::WebSecurityStyle GetSecurityStyle(
96 content::WebContents* web_contents, 97 content::WebContents* web_contents,
97 content::SecurityStyleExplanations* security_style_explanations) 98 content::SecurityStyleExplanations* security_style_explanations)
98 override { 99 override {
99 security_state::SecurityInfo security_info; 100 security_state::SecurityInfo security_info;
100 security_state::GetSecurityInfo( 101 security_state::GetSecurityInfo(
101 security_state::GetVisibleSecurityState(web_contents), 102 security_state::GetVisibleSecurityState(web_contents),
102 false /* used_policy_installed_certificate */, 103 false /* used_policy_installed_certificate */,
103 base::Bind(&content::IsOriginSecure), &security_info); 104 base::Bind(&content::IsOriginSecure), &security_info);
104 return security_state::GetSecurityStyle(security_info, 105 return security_state::GetSecurityStyle(security_info,
105 security_style_explanations); 106 security_style_explanations);
106 } 107 }
108 #endif // !defined(CHROME_MULTIPLE_DLL_CHILD)
107 109
108 void ActivateContents(content::WebContents* contents) override { 110 void ActivateContents(content::WebContents* contents) override {
109 contents->GetRenderViewHost()->GetWidget()->Focus(); 111 contents->GetRenderViewHost()->GetWidget()->Focus();
110 } 112 }
111 113
112 void CloseContents(content::WebContents* source) override { 114 void CloseContents(content::WebContents* source) override {
113 if (!browser_context_) { 115 if (!browser_context_) {
114 return; 116 return;
115 } 117 }
116 118
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 HeadlessWebContentsImpl::HeadlessWebContentsImpl( 197 HeadlessWebContentsImpl::HeadlessWebContentsImpl(
196 content::WebContents* web_contents, 198 content::WebContents* web_contents,
197 HeadlessBrowserContextImpl* browser_context) 199 HeadlessBrowserContextImpl* browser_context)
198 : content::WebContentsObserver(web_contents), 200 : content::WebContentsObserver(web_contents),
199 web_contents_delegate_( 201 web_contents_delegate_(
200 new HeadlessWebContentsImpl::Delegate(browser_context)), 202 new HeadlessWebContentsImpl::Delegate(browser_context)),
201 web_contents_(web_contents), 203 web_contents_(web_contents),
202 agent_host_(content::DevToolsAgentHost::GetOrCreateFor(web_contents)), 204 agent_host_(content::DevToolsAgentHost::GetOrCreateFor(web_contents)),
203 browser_context_(browser_context), 205 browser_context_(browser_context),
204 render_process_host_(web_contents->GetRenderProcessHost()) { 206 render_process_host_(web_contents->GetRenderProcessHost()) {
205 #if BUILDFLAG(ENABLE_BASIC_PRINTING) 207 #if BUILDFLAG(ENABLE_BASIC_PRINTING) && !defined(CHROME_MULTIPLE_DLL_CHILD)
206 printing::HeadlessPrintManager::CreateForWebContents(web_contents); 208 printing::HeadlessPrintManager::CreateForWebContents(web_contents);
207 #endif 209 #endif
208 web_contents_->SetDelegate(web_contents_delegate_.get()); 210 web_contents_->SetDelegate(web_contents_delegate_.get());
209 render_process_host_->AddObserver(this); 211 render_process_host_->AddObserver(this);
210 agent_host_->AddObserver(this); 212 agent_host_->AddObserver(this);
211 } 213 }
212 214
213 HeadlessWebContentsImpl::~HeadlessWebContentsImpl() { 215 HeadlessWebContentsImpl::~HeadlessWebContentsImpl() {
214 agent_host_->RemoveObserver(this); 216 agent_host_->RemoveObserver(this);
215 if (render_process_host_) 217 if (render_process_host_)
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 HeadlessWebContents::Builder::MojoService::MojoService() {} 396 HeadlessWebContents::Builder::MojoService::MojoService() {}
395 397
396 HeadlessWebContents::Builder::MojoService::MojoService( 398 HeadlessWebContents::Builder::MojoService::MojoService(
397 const std::string& service_name, 399 const std::string& service_name,
398 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory) 400 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory)
399 : service_name(service_name), service_factory(service_factory) {} 401 : service_name(service_name), service_factory(service_factory) {}
400 402
401 HeadlessWebContents::Builder::MojoService::~MojoService() {} 403 HeadlessWebContents::Builder::MojoService::~MojoService() {}
402 404
403 } // namespace headless 405 } // namespace headless
OLDNEW
« no previous file with comments | « headless/lib/browser/headless_printing_unittest.cc ('k') | headless/lib/headless_browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698