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

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

Issue 2780433002: add print to pdf for headless (Closed)
Patch Set: Created 3 years, 8 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 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 12 matching lines...) Expand all
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" 24 #include "content/public/browser/render_widget_host.h"
25 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
26 #include "content/public/browser/web_contents_delegate.h" 26 #include "content/public/browser/web_contents_delegate.h"
27 #include "content/public/common/bindings_policy.h" 27 #include "content/public/common/bindings_policy.h"
28 #include "content/public/common/origin_util.h" 28 #include "content/public/common/origin_util.h"
29 #include "headless/lib/browser/headless_browser_context_impl.h" 29 #include "headless/lib/browser/headless_browser_context_impl.h"
30 #include "headless/lib/browser/headless_browser_impl.h" 30 #include "headless/lib/browser/headless_browser_impl.h"
31 #include "headless/lib/browser/headless_browser_main_parts.h" 31 #include "headless/lib/browser/headless_browser_main_parts.h"
32 #include "headless/lib/browser/headless_devtools_client_impl.h" 32 #include "headless/lib/browser/headless_devtools_client_impl.h"
33 #include "headless/lib/browser/headless_print_manager.h"
33 #include "services/service_manager/public/cpp/interface_registry.h" 34 #include "services/service_manager/public/cpp/interface_registry.h"
34 35
35 namespace headless { 36 namespace headless {
36 37
37 // static 38 // static
38 HeadlessWebContentsImpl* HeadlessWebContentsImpl::From( 39 HeadlessWebContentsImpl* HeadlessWebContentsImpl::From(
39 HeadlessWebContents* web_contents) { 40 HeadlessWebContents* web_contents) {
40 // This downcast is safe because there is only one implementation of 41 // This downcast is safe because there is only one implementation of
41 // HeadlessWebContents. 42 // HeadlessWebContents.
42 return static_cast<HeadlessWebContentsImpl*>(web_contents); 43 return static_cast<HeadlessWebContentsImpl*>(web_contents);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 HeadlessWebContentsImpl::HeadlessWebContentsImpl( 166 HeadlessWebContentsImpl::HeadlessWebContentsImpl(
166 content::WebContents* web_contents, 167 content::WebContents* web_contents,
167 HeadlessBrowserContextImpl* browser_context) 168 HeadlessBrowserContextImpl* browser_context)
168 : content::WebContentsObserver(web_contents), 169 : content::WebContentsObserver(web_contents),
169 web_contents_delegate_( 170 web_contents_delegate_(
170 new HeadlessWebContentsImpl::Delegate(browser_context)), 171 new HeadlessWebContentsImpl::Delegate(browser_context)),
171 web_contents_(web_contents), 172 web_contents_(web_contents),
172 agent_host_(content::DevToolsAgentHost::GetOrCreateFor(web_contents)), 173 agent_host_(content::DevToolsAgentHost::GetOrCreateFor(web_contents)),
173 browser_context_(browser_context), 174 browser_context_(browser_context),
174 render_process_host_(web_contents->GetRenderProcessHost()) { 175 render_process_host_(web_contents->GetRenderProcessHost()) {
176 printing::HeadlessPrintManager::CreateForWebContents(web_contents);
175 web_contents_->SetDelegate(web_contents_delegate_.get()); 177 web_contents_->SetDelegate(web_contents_delegate_.get());
176 render_process_host_->AddObserver(this); 178 render_process_host_->AddObserver(this);
177 } 179 }
178 180
179 HeadlessWebContentsImpl::~HeadlessWebContentsImpl() { 181 HeadlessWebContentsImpl::~HeadlessWebContentsImpl() {
180 if (render_process_host_) 182 if (render_process_host_)
181 render_process_host_->RemoveObserver(this); 183 render_process_host_->RemoveObserver(this);
182 } 184 }
183 185
184 void HeadlessWebContentsImpl::RenderFrameCreated( 186 void HeadlessWebContentsImpl::RenderFrameCreated(
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 HeadlessWebContents::Builder::MojoService::MojoService() {} 320 HeadlessWebContents::Builder::MojoService::MojoService() {}
319 321
320 HeadlessWebContents::Builder::MojoService::MojoService( 322 HeadlessWebContents::Builder::MojoService::MojoService(
321 const std::string& service_name, 323 const std::string& service_name,
322 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory) 324 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory)
323 : service_name(service_name), service_factory(service_factory) {} 325 : service_name(service_name), service_factory(service_factory) {}
324 326
325 HeadlessWebContents::Builder::MojoService::~MojoService() {} 327 HeadlessWebContents::Builder::MojoService::~MojoService() {}
326 328
327 } // namespace headless 329 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698