| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 187 } |
| 188 | 188 |
| 189 bool HeadlessWebContentsImpl::OpenURL(const GURL& url) { | 189 bool HeadlessWebContentsImpl::OpenURL(const GURL& url) { |
| 190 if (!url.is_valid()) | 190 if (!url.is_valid()) |
| 191 return false; | 191 return false; |
| 192 content::NavigationController::LoadURLParams params(url); | 192 content::NavigationController::LoadURLParams params(url); |
| 193 params.transition_type = ui::PageTransitionFromInt( | 193 params.transition_type = ui::PageTransitionFromInt( |
| 194 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); | 194 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); |
| 195 web_contents_->GetController().LoadURLWithParams(params); | 195 web_contents_->GetController().LoadURLWithParams(params); |
| 196 web_contents_->Focus(); | 196 web_contents_->Focus(); |
| 197 content::RenderWidgetHostView* host_view = |
| 198 web_contents_->GetRenderWidgetHostView(); |
| 199 host_view->Focus(); |
| 197 return true; | 200 return true; |
| 198 } | 201 } |
| 199 | 202 |
| 200 void HeadlessWebContentsImpl::Close() { | 203 void HeadlessWebContentsImpl::Close() { |
| 201 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 204 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 202 browser_context()->DestroyWebContents(this); | 205 browser_context()->DestroyWebContents(this); |
| 203 } | 206 } |
| 204 | 207 |
| 205 std::string HeadlessWebContentsImpl::GetDevToolsAgentHostId() { | 208 std::string HeadlessWebContentsImpl::GetDevToolsAgentHostId() { |
| 206 return agent_host_->GetId(); | 209 return agent_host_->GetId(); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 HeadlessWebContents::Builder::MojoService::MojoService() {} | 310 HeadlessWebContents::Builder::MojoService::MojoService() {} |
| 308 | 311 |
| 309 HeadlessWebContents::Builder::MojoService::MojoService( | 312 HeadlessWebContents::Builder::MojoService::MojoService( |
| 310 const std::string& service_name, | 313 const std::string& service_name, |
| 311 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory) | 314 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory) |
| 312 : service_name(service_name), service_factory(service_factory) {} | 315 : service_name(service_name), service_factory(service_factory) {} |
| 313 | 316 |
| 314 HeadlessWebContents::Builder::MojoService::~MojoService() {} | 317 HeadlessWebContents::Builder::MojoService::~MojoService() {} |
| 315 | 318 |
| 316 } // namespace headless | 319 } // namespace headless |
| OLD | NEW |