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 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "content/public/common/origin_util.h" | 29 #include "content/public/common/origin_util.h" |
30 #include "content/public/common/renderer_preferences.h" | 30 #include "content/public/common/renderer_preferences.h" |
31 #include "headless/lib/browser/headless_browser_context_impl.h" | 31 #include "headless/lib/browser/headless_browser_context_impl.h" |
32 #include "headless/lib/browser/headless_browser_impl.h" | 32 #include "headless/lib/browser/headless_browser_impl.h" |
33 #include "headless/lib/browser/headless_browser_main_parts.h" | 33 #include "headless/lib/browser/headless_browser_main_parts.h" |
34 #include "headless/lib/browser/headless_devtools_client_impl.h" | 34 #include "headless/lib/browser/headless_devtools_client_impl.h" |
35 #include "headless/lib/browser/headless_tab_socket_impl.h" | 35 #include "headless/lib/browser/headless_tab_socket_impl.h" |
36 #include "printing/features/features.h" | 36 #include "printing/features/features.h" |
37 | 37 |
38 #if BUILDFLAG(ENABLE_BASIC_PRINTING) | 38 #if BUILDFLAG(ENABLE_BASIC_PRINTING) |
| 39 #include "components/printing/browser/print_manager_utils.h" |
39 #include "headless/lib/browser/headless_print_manager.h" | 40 #include "headless/lib/browser/headless_print_manager.h" |
40 #endif | 41 #endif |
41 | 42 |
42 namespace headless { | 43 namespace headless { |
43 | 44 |
44 // static | 45 // static |
45 HeadlessWebContentsImpl* HeadlessWebContentsImpl::From( | 46 HeadlessWebContentsImpl* HeadlessWebContentsImpl::From( |
46 HeadlessWebContents* web_contents) { | 47 HeadlessWebContents* web_contents) { |
47 // This downcast is safe because there is only one implementation of | 48 // This downcast is safe because there is only one implementation of |
48 // HeadlessWebContents. | 49 // HeadlessWebContents. |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 : content::WebContentsObserver(web_contents), | 277 : content::WebContentsObserver(web_contents), |
277 web_contents_delegate_(new HeadlessWebContentsImpl::Delegate(this)), | 278 web_contents_delegate_(new HeadlessWebContentsImpl::Delegate(this)), |
278 web_contents_(web_contents), | 279 web_contents_(web_contents), |
279 agent_host_(content::DevToolsAgentHost::GetOrCreateFor(web_contents)), | 280 agent_host_(content::DevToolsAgentHost::GetOrCreateFor(web_contents)), |
280 inject_mojo_services_into_isolated_world_(false), | 281 inject_mojo_services_into_isolated_world_(false), |
281 browser_context_(browser_context), | 282 browser_context_(browser_context), |
282 render_process_host_(web_contents->GetRenderProcessHost()), | 283 render_process_host_(web_contents->GetRenderProcessHost()), |
283 weak_ptr_factory_(this) { | 284 weak_ptr_factory_(this) { |
284 #if BUILDFLAG(ENABLE_BASIC_PRINTING) && !defined(CHROME_MULTIPLE_DLL_CHILD) | 285 #if BUILDFLAG(ENABLE_BASIC_PRINTING) && !defined(CHROME_MULTIPLE_DLL_CHILD) |
285 HeadlessPrintManager::CreateForWebContents(web_contents); | 286 HeadlessPrintManager::CreateForWebContents(web_contents); |
| 287 // TODO(weili): Add support for printing OOPIFs. |
| 288 printing::SetOopifEnabled(false); |
286 #endif | 289 #endif |
287 web_contents->GetMutableRendererPrefs()->accept_languages = | 290 web_contents->GetMutableRendererPrefs()->accept_languages = |
288 browser_context->options()->accept_language(); | 291 browser_context->options()->accept_language(); |
289 web_contents_->SetDelegate(web_contents_delegate_.get()); | 292 web_contents_->SetDelegate(web_contents_delegate_.get()); |
290 render_process_host_->AddObserver(this); | 293 render_process_host_->AddObserver(this); |
291 agent_host_->AddObserver(this); | 294 agent_host_->AddObserver(this); |
292 } | 295 } |
293 | 296 |
294 HeadlessWebContentsImpl::~HeadlessWebContentsImpl() { | 297 HeadlessWebContentsImpl::~HeadlessWebContentsImpl() { |
295 agent_host_->RemoveObserver(this); | 298 agent_host_->RemoveObserver(this); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 const MojoService& other) = default; | 507 const MojoService& other) = default; |
505 | 508 |
506 HeadlessWebContents::Builder::MojoService::MojoService( | 509 HeadlessWebContents::Builder::MojoService::MojoService( |
507 const std::string& service_name, | 510 const std::string& service_name, |
508 const ServiceFactoryCallback& service_factory) | 511 const ServiceFactoryCallback& service_factory) |
509 : service_name(service_name), service_factory(service_factory) {} | 512 : service_name(service_name), service_factory(service_factory) {} |
510 | 513 |
511 HeadlessWebContents::Builder::MojoService::~MojoService() {} | 514 HeadlessWebContents::Builder::MojoService::~MojoService() {} |
512 | 515 |
513 } // namespace headless | 516 } // namespace headless |
OLD | NEW |