| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 web_contents_->GetController().LoadURLWithParams(params); | 197 web_contents_->GetController().LoadURLWithParams(params); |
| 198 web_contents_->Focus(); | 198 web_contents_->Focus(); |
| 199 return true; | 199 return true; |
| 200 } | 200 } |
| 201 | 201 |
| 202 void HeadlessWebContentsImpl::Close() { | 202 void HeadlessWebContentsImpl::Close() { |
| 203 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 203 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 204 browser_context()->DestroyWebContents(this); | 204 browser_context()->DestroyWebContents(this); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void HeadlessWebContentsImpl::Stop() { |
| 208 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 209 web_contents_->Stop(); |
| 210 } |
| 211 |
| 207 std::string HeadlessWebContentsImpl::GetDevToolsAgentHostId() { | 212 std::string HeadlessWebContentsImpl::GetDevToolsAgentHostId() { |
| 208 return agent_host_->GetId(); | 213 return agent_host_->GetId(); |
| 209 } | 214 } |
| 210 | 215 |
| 211 void HeadlessWebContentsImpl::AddObserver(Observer* observer) { | 216 void HeadlessWebContentsImpl::AddObserver(Observer* observer) { |
| 212 DCHECK(observer_map_.find(observer) == observer_map_.end()); | 217 DCHECK(observer_map_.find(observer) == observer_map_.end()); |
| 213 observer_map_[observer] = base::MakeUnique<WebContentsObserverAdapter>( | 218 observer_map_[observer] = base::MakeUnique<WebContentsObserverAdapter>( |
| 214 web_contents_.get(), observer); | 219 web_contents_.get(), observer); |
| 215 } | 220 } |
| 216 | 221 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 HeadlessWebContents::Builder::MojoService::MojoService() {} | 302 HeadlessWebContents::Builder::MojoService::MojoService() {} |
| 298 | 303 |
| 299 HeadlessWebContents::Builder::MojoService::MojoService( | 304 HeadlessWebContents::Builder::MojoService::MojoService( |
| 300 const std::string& service_name, | 305 const std::string& service_name, |
| 301 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory) | 306 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory) |
| 302 : service_name(service_name), service_factory(service_factory) {} | 307 : service_name(service_name), service_factory(service_factory) {} |
| 303 | 308 |
| 304 HeadlessWebContents::Builder::MojoService::~MojoService() {} | 309 HeadlessWebContents::Builder::MojoService::~MojoService() {} |
| 305 | 310 |
| 306 } // namespace headless | 311 } // namespace headless |
| OLD | NEW |