| 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" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 167 |
| 168 HeadlessWebContentsImpl::~HeadlessWebContentsImpl() { | 168 HeadlessWebContentsImpl::~HeadlessWebContentsImpl() { |
| 169 web_contents_->Close(); | 169 web_contents_->Close(); |
| 170 if (render_process_host_) | 170 if (render_process_host_) |
| 171 render_process_host_->RemoveObserver(this); | 171 render_process_host_->RemoveObserver(this); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void HeadlessWebContentsImpl::RenderFrameCreated( | 174 void HeadlessWebContentsImpl::RenderFrameCreated( |
| 175 content::RenderFrameHost* render_frame_host) { | 175 content::RenderFrameHost* render_frame_host) { |
| 176 if (!mojo_services_.empty()) { | 176 if (!mojo_services_.empty()) { |
| 177 render_frame_host->GetRenderViewHost()->AllowBindings( | 177 render_frame_host->AllowBindings(content::BINDINGS_POLICY_HEADLESS); |
| 178 content::BINDINGS_POLICY_HEADLESS); | |
| 179 } | 178 } |
| 180 | 179 |
| 181 service_manager::InterfaceRegistry* interface_registry = | 180 service_manager::InterfaceRegistry* interface_registry = |
| 182 render_frame_host->GetInterfaceRegistry(); | 181 render_frame_host->GetInterfaceRegistry(); |
| 183 | 182 |
| 184 for (const MojoService& service : mojo_services_) { | 183 for (const MojoService& service : mojo_services_) { |
| 185 interface_registry->AddInterface(service.service_name, | 184 interface_registry->AddInterface(service.service_name, |
| 186 service.service_factory, | 185 service.service_factory, |
| 187 browser()->BrowserMainThread()); | 186 browser()->BrowserMainThread()); |
| 188 } | 187 } |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 HeadlessWebContents::Builder::MojoService::MojoService() {} | 308 HeadlessWebContents::Builder::MojoService::MojoService() {} |
| 310 | 309 |
| 311 HeadlessWebContents::Builder::MojoService::MojoService( | 310 HeadlessWebContents::Builder::MojoService::MojoService( |
| 312 const std::string& service_name, | 311 const std::string& service_name, |
| 313 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory) | 312 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory) |
| 314 : service_name(service_name), service_factory(service_factory) {} | 313 : service_name(service_name), service_factory(service_factory) {} |
| 315 | 314 |
| 316 HeadlessWebContents::Builder::MojoService::~MojoService() {} | 315 HeadlessWebContents::Builder::MojoService::~MojoService() {} |
| 317 | 316 |
| 318 } // namespace headless | 317 } // namespace headless |
| OLD | NEW |