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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 178 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
179 browser_context()->DestroyWebContents(this); | 179 browser_context()->DestroyWebContents(this); |
180 } | 180 } |
181 | 181 |
182 std::string HeadlessWebContentsImpl::GetDevToolsAgentHostId() { | 182 std::string HeadlessWebContentsImpl::GetDevToolsAgentHostId() { |
183 return agent_host_->GetId(); | 183 return agent_host_->GetId(); |
184 } | 184 } |
185 | 185 |
186 void HeadlessWebContentsImpl::AddObserver(Observer* observer) { | 186 void HeadlessWebContentsImpl::AddObserver(Observer* observer) { |
187 DCHECK(observer_map_.find(observer) == observer_map_.end()); | 187 DCHECK(observer_map_.find(observer) == observer_map_.end()); |
188 observer_map_[observer] = base::WrapUnique( | 188 observer_map_[observer] = base::MakeUnique<WebContentsObserverAdapter>( |
189 new WebContentsObserverAdapter(web_contents_.get(), observer)); | 189 web_contents_.get(), observer); |
190 } | 190 } |
191 | 191 |
192 void HeadlessWebContentsImpl::RemoveObserver(Observer* observer) { | 192 void HeadlessWebContentsImpl::RemoveObserver(Observer* observer) { |
193 ObserverMap::iterator it = observer_map_.find(observer); | 193 ObserverMap::iterator it = observer_map_.find(observer); |
194 DCHECK(it != observer_map_.end()); | 194 DCHECK(it != observer_map_.end()); |
195 observer_map_.erase(it); | 195 observer_map_.erase(it); |
196 } | 196 } |
197 | 197 |
198 HeadlessDevToolsTarget* HeadlessWebContentsImpl::GetDevToolsTarget() { | 198 HeadlessDevToolsTarget* HeadlessWebContentsImpl::GetDevToolsTarget() { |
199 return web_contents()->GetMainFrame()->IsRenderFrameLive() ? this : nullptr; | 199 return web_contents()->GetMainFrame()->IsRenderFrameLive() ? this : nullptr; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 HeadlessWebContents::Builder::MojoService::MojoService() {} | 256 HeadlessWebContents::Builder::MojoService::MojoService() {} |
257 | 257 |
258 HeadlessWebContents::Builder::MojoService::MojoService( | 258 HeadlessWebContents::Builder::MojoService::MojoService( |
259 const std::string& service_name, | 259 const std::string& service_name, |
260 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory) | 260 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory) |
261 : service_name(service_name), service_factory(service_factory) {} | 261 : service_name(service_name), service_factory(service_factory) {} |
262 | 262 |
263 HeadlessWebContents::Builder::MojoService::~MojoService() {} | 263 HeadlessWebContents::Builder::MojoService::~MojoService() {} |
264 | 264 |
265 } // namespace headless | 265 } // namespace headless |
OLD | NEW |